存档

2009年11月 的存档

xenconsole: Could not read tty from store: No such file or directory

2009年11月27日 评论已被关闭

#xem在配置heartbeat时遇到的一个问题,重启虚拟机出现了问题,系统无法启动,控制台也无法登陆。
xm console xm-2hei.net
xenconsole: Could not read tty from store: No such file or directory

原来是xenconsoled进程不在了,重启即可
#/usr/sbin/xenconsoled

另外一个xen的小tip是,“]”键可以方便的从控制台退出来,哈哈!

分类: OpenSource 标签:

Read-only file system on CentOS5

2009年11月25日 评论已被关闭

We have 5 Dell server collocated running CentOS 4.x and 5.x server operating system. Sometime my file system (ext3) goes read-only.
I’d like to know what could be causing such a problem?

CentOS 5.x Read-only file system

form http://www.cyberciti.biz/tips/linux-filesytem-goes-read-only.html:
a) Hardware problem / hard disk problem, check harddisk for errors.

b) High disk I/O aka busy I/O retry error can mark low level disk call as failed. This will force ext3 to go into read only mode.

c) High disk I/O on SAN

d) SAN is not configured properly for the path failover.

In all sort of problems ext3 goes read-only to protect the filesystem and further damage. If you are using VMWARE, check out official webpage to download SCSI patches or workaround for vmware problems.
So what could be causing the file system on Linux go read-only?

Apart from above generic problem, any other error can trigger filesystem on Linux go read only. I hope our reader / seasoned Linux admin can help to answer this question.

reboot my OS , file system recovery.

and you can try others:
mount -o remount,rw /
mount -o remount /

分类: OpenSource 标签:

mptscsih: ioc0: attempting task abort

2009年11月23日 评论已被关闭

Nov 19 00:03:14 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81004f0c7380)
Nov 19 00:03:14 2hei.net kernel: sd 0:0:0:0:
Nov 19 00:03:14 2hei.net kernel: command: Read(10): 28 00 00 26 15 d7 00 00 48 00
Nov 19 00:03:14 2hei.net kernel: mptbase: ioc0: LogInfo(0x31140000): Originator={PL}, Code={IO Executed}, SubCode(0x0000)
Nov 19 00:03:14 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81004f0c7380)
Nov 19 00:03:24 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81004f0c7380)
Nov 19 00:03:24 2hei.net kernel: sd 0:0:0:0:
Nov 19 00:03:24 2hei.net kernel: command: Test Unit Ready: 00 00 00 00 00 00
Nov 19 00:03:25 2hei.net kernel: mptbase: ioc0: LogInfo(0x31130000): Originator={PL}, Code={IO Not Yet Executed}, SubCode(0x0000)
Nov 19 00:03:25 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81004f0c7380)
Nov 19 00:03:25 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81006dce49c0)
Nov 19 00:03:25 2hei.net kernel: sd 0:0:0:0:
Nov 19 00:03:25 2hei.net kernel: command: Write(10): 2a 00 04 c4 a5 f2 00 01 40 00
Nov 19 00:12:10 2hei.net kernel: mptbase: ioc0: LogInfo(0x31140000): Originator={PL}, Code={IO Executed}, SubCode(0x0000)
Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81006dce49c0)
Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81006dce49c0)
Nov 19 00:12:11 2hei.net kernel: sd 0:0:0:0:
Nov 19 00:12:11 2hei.net kernel: command: Test Unit Ready: 00 00 00 00 00 00
Nov 19 00:12:11 2hei.net kernel: mptbase: ioc0: LogInfo(0x31130000): Originator={PL}, Code={IO Not Yet Executed}, SubCode(0x0000)
Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81006dce49c0)
Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81007f0d4980)

Linux 2hei.net.163.com 2.6.18-53.1.13.el5 #1 SMP Tue Feb 12 13:02:30 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

[root@2hei.net ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: HP Model: DF072A9844 Rev: HPD0
Type: Direct-Access ANSI SCSI revision: 05

[root@2hei.net ~]# modinfo mptsas
filename: /lib/modules/2.6.18-53.1.13.el5/kernel/drivers/message/fusion/mptsas.ko
version: 3.04.04
license: GPL
description: Fusion MPT SAS Host driver
author: LSI Logic Corporation
srcversion: D0507BBC402F30BCC5539C0
alias: pci:v00001000d00000062sv*sd*bc*sc*i*
alias: pci:v00001000d00000058sv*sd*bc*sc*i*
alias: pci:v00001000d00000056sv*sd*bc*sc*i*
alias: pci:v00001000d00000054sv*sd*bc*sc*i*
alias: pci:v00001000d00000050sv*sd*bc*sc*i*
depends: mptscsih,mptbase,scsi_mod,scsi_transport_sas
vermagic: 2.6.18-53.1.13.el5 SMP mod_unload gcc-4.1
parm: mpt_pt_clear: Clear persistency table: enable=1 (default=MPTSCSIH_PT_CLEAR=0) (int)
parm: max_lun: max lun, default=16895 (int)

Do you have acpi=off parameter passed to kernel? Try to set it on.
Also, do you use ReiserFS as filesystem?

http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c00715023&lang=en&cc=us&taskId=101&prodSeriesId=428936&prodTypeId=15351
http://h50176.www5.hp.com/support/292889-291/solve/108727.html

分类: OpenSource 标签:

linux下用python实现文本menu

2009年11月17日 评论已被关闭

linux用shell实现menu比较简单,今天用python实现了一个,因为python没有switch语法,所以使用了dict来替代,另外调用了linux的clear来清屏,本例只是说明一下简单的实现方法,菜单的命令或者语句可以自由发挥 呵呵。

截个图先:
2009-11-17-linux-python-menu.png

具体代码如下:
#!/usr/bin/evn python
# -*- coding: utf-8 -*-
#Author: 2hei#2hei.net
#Date: 2009-11-17 18:24

import os,sys

running = True
menu = “””
             menu
——————————
    1:   Disk info
    2:   Mem info
    3:   Network info
    4:   Sys load info
    5:   Process info
    h:   Help
    q:   Quit
——————————
“””

menu_dict={
      “h”: “echo help ^_^”,
      “1”: “df -h”,
      “2”: “free -m”,
      “3”: “netstat -lnt”,
      “4”: “uptime”,
      “5”: “ps x”
      }

def commands(args):
    cmd = menu_dict.get(args)
    return cmd

if __name__ == “__main__”:
    os.system(‘clear’)
    print menu   
    while running:
        cmd = raw_input(“Input your commond :\n”)
        if cmd != ‘q’:
            os.system(‘clear’)
            try:
                print menu
                if commands(cmd) != None:
                    fo = os.popen(commands(cmd))
                    print fo.read()
                else:
                    print “Input is Wrong!\n”
            except Exception,e:
                print menu
                print e            
        else:
            print ‘we will exit the menu\n’
            sys.exit()

分类: OpenSource, python 标签:

python 访问带有web认证的页面

2009年11月5日 评论已被关闭

python 访问带有web认证的页面,经测试方法一可用!

#!/usr/bin/env python
# -*- coding: utf-8 -*-

#方法一
#————————————————————–
def request_auth_http(url, User = None, Pass = None):
    import urllib2
    # this creates a password manager
    passman = urllib2.HTTPPasswordMgrWithDefaultRealm()    
    passman.add_password(None, url, User, Pass)
    # create the AuthHandler
    authhandler = urllib2.HTTPBasicAuthHandler(passman)    
    opener = urllib2.build_opener(authhandler)    
    urllib2.install_opener(opener)
    pagehandle = urllib2.urlopen(url)
    data = pagehandle.read()
    pagehandle.close()
    return data

#方法二
#————————————————————–
    #auth = “Basic %s” % base64.encodestring(“%s:%s” % (User, Pass))[:-1]
    #request.add_header(“User-Agent”, “Python-2.5”)
    #request.add_header(“Authorization”,auth)
    #opener = urllib2.build_opener()    
    #data = opener.open(request).read()
    #print data
    #htmlFile = urllib2.urlopen(request)
    #htmlData = htmlFile.read()
    #htmlFile.close()
    #return htmlData

#————————————————————–
def main():
    url = “https://2hei.net/login”
    User = “user”
    Pass = “passwd”
    print request_auth_http(url,User,Pass)

#————————————————————–
if __name__ == “__main__”:
    main()

实际的结果是,方法一正解,方法二页面返回401错误。

分类: OpenSource 标签:

wget访问带认证的web页面

2009年11月3日 评论已被关闭

同样的wget语句在不通的机器上居然执行效果不一样,原因是wget版本的问题:

wget –help | head
GNU Wget 1.9+cvs-stable (Red Hat modified), a non-interactive network retriever.
Usage: wget [OPTION]… [URL]…

/usr/bin/wget -O /tmp/2hei.txt –http-user=username –http-passwd=123456 “https://10.10.10.10/login.jsp”

wget –help | head
GNU Wget 1.10.2 (Red Hat modified), a non-interactive network retriever.
Usage: wget [OPTION]… [URL]…

/usr/bin/wget -O /tmp/2hei.txt –no-check-certificate  –http-user=username –http-password=123456 “https://10.10.10.10/login.jsp”

分类: OpenSource 标签:

ImportError: No module named xen.xm

2009年11月3日 评论已被关闭

xen的其中一个虚拟机无法使用,重启xen后发现无法启动。

最后发现原因是升级了python版本所致,升级到了2.6.2:

之前的版本是:python -V
2.4.3

降回到原来的python版本,重试OK!

分类: OpenSource, python 标签: