Categories
Linux/Unix

SSH connection keepalive

Add these lines into you ~/.ssh/config file. It can help you send keepalive message 6 times every 30 seconds.

Host *
  ServerAliveInterval 30
  ServerAliveCountMax 6

Categories
Linux/Unix

Enable backspace in VIOS command line

Log in as padmin

$ oem_setup_env
# echo "export ENV=/home/padmin/.kshrc" >> /home/padmin/.profile     

# echo "export HOST=\"\$(/usr/bin/uname -n)\"\nif [ \"\`whoami\`\" = \"root\" ]; then\n  PS1=\"\`whoami\`@\$HOST:\\\$PWD # \"\nelse\n  PS1=\"\`whoami\`@\$HOST:\\\$PWD $ \"\nfi\n\nset -o emacs;alias -x __A=\"\$(echo '\\\\020')\"; alias -x __B=\"\$(echo '\\\\016')\"; alias -x __C=\"\$(echo '\\\\006')\"; alias -x __D=\"\$(echo '\\\\002')\"; alias -x __H=\"\$(echo '\\\\001')\"; alias -x __Y=\"\$(echo '\\\\005')\"\n" >> /home/padmin/.kshrc
Categories
Linux/Unix Software

OS X Terminal: -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

Uncheck the box “Set locale variables automatically” in iTerm2 under Preferences -> Profiles -> Terminal

Categories
Linux/Unix

X11 forwarding box font…

Try to install X11 font

yum install xorg-x11-fonts-Type1

 

Categories
Cloud

Build docker for OpenPOWER (ppc64le)

It’s a nightmare if you have a unsupported arch while building tools. I have tried to build docker for RHEL/CentOS, Ubuntu for ppc64le. It took me lots of time.

Fortunately, from 1.10, docker will support arch ppc64le officially. ppc64le will be the default arch for OpenPOWER system. As of now, docker code is still in reorg. So there might be some tricks while building docker for ppc64le. Follow below steps. You can get a preview docker 1.10.0-dev for your system. Let’s try it.

It is much simpler than before. Only two commands~

docker build -t docker -f Dockerfile.ppc64le .
docker run --privileged docker ./hack/make.sh gccg

Let’s check the running version.

./docker-1.10.0-dev version
Client:
 Version:      1.10.0-dev
 API version:  1.23
 Go version:   go1.4.2 gccgo (GCC) 5.3.0
 Git commit:   6f86bce-unsupported
 Built:        Sun Jan 31 16:11:15 2016
 OS/Arch:      linux/ppc64le

Server:
 Version:      1.10.0-dev
 API version:  1.23
 Go version:   go1.4.2 gccgo (GCC) 5.3.0
 Git commit:   6f86bce-unsupported
 Built:        Sun Jan 31 16:11:15 2016
 OS/Arch:      linux/ppc64le
Categories
Hardware

Linux 下安装识别 Marvell 88SE91xx 硬盘

88SE91xx 可以使用 AHCI 驱动,但是默认 Linux 无法识别 88SE91xx 需要手动添加到 AHCI 列表中。方法如下。

  • 首先获得到 88SE91xx 的 Vendor ID 和 Device ID
$ lspci -nnk | grep Marvell
04:00.0 RAID bus controller [0104]: Marvell Technology Group Ltd. 88SE9172 SATA III 6Gb/s RAID Controller [1b4b:9192] (rev 11)
  • 使 AHCI 识别
$ /bin/echo 1b4b 9192 > /sys/bus/pci/drivers/ahci/new_id

 

这样就能识别到在 88SE91xx 上的硬盘了。

Categories

强制 VMware vSphere Client 语言以英文运行

步骤:

  1. 右击 vSphere Client 图标
  2. 选择 “快捷方式” 选项卡,在目标后加上 “-locale en_US”
  3. 确定退出
  4. 使用更改后的快捷方式打开 vSphere Client

英文运行vSphere Client

Categories
Uncategorized

fatal error: Python.h: No such file or directory

root@raspberrypi ~/tools/RPi.GPIO-0.5.2a # python setup.py install
running install
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing RPi.GPIO.egg-info/PKG-INFO
writing top-level names to RPi.GPIO.egg-info/top_level.txt
writing dependency_links to RPi.GPIO.egg-info/dependency_links.txt
reading manifest file 'RPi.GPIO.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'RPi.GPIO.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv6l/egg
running install_lib
running build_py
running build_ext
building 'RPi.GPIO' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
source/py_gpio.c:23:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

解决方法:

安装对应版本的 python-dev,

root@raspberrypi ~/tools/RPi.GPIO-0.5.2a # apt-get install python2.7-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  python2.7-dev
0 upgraded, 1 newly installed, 0 to remove and 343 not upgraded.
Need to get 28.7 MB of archives.
After this operation, 35.3 MB of additional disk space will be used.
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python2.7-dev armhf 2.7.3-6 [28.7 MB]
Fetched 28.7 MB in 17s (1,644 kB/s)
Selecting previously unselected package python2.7-dev.
(Reading database ... 66907 files and directories currently installed.)
Unpacking python2.7-dev (from .../python2.7-dev_2.7.3-6_armhf.deb) ...
Processing triggers for man-db ...
Setting up python2.7-dev (2.7.3-6) ...

 

Categories
Python

判断 Python 模块是否安装

在不加载 module 的情况下判断 module 是否已安装

import imp

class checkModule:
    def check_psutil(self):
        try:
            imp.find_module('psutil')
            found = True
        except ImportError:
            found = False

        if not found:
            raise AssertionError('Module psutil is not installed.')
        else:
            print('Module psutil is installed.')
Categories
Linux/Unix

CentOS/RHEL 5 中 Samba 服务无法访问

新安装的 CentOS 6.3 的服务器使用原始 Samba 配置文件却无法正常工作,症状是:能够访问,但是进入目录提示没有权限。

尝试方法:

关闭 SELinux

vim /etc/sysconfig/selinux

改为如下:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
#SELINUX=enforcing
SELINUX=disable
#
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted