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/ gccg

Let’s check the running version.

./docker-1.10.0-dev version
 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

 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

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 上的硬盘了。

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

root@raspberrypi ~/tools/RPi.GPIO-0.5.2a # python 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 ''
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:
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 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) ...


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.
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.

Device Mapper Multipath Configuration

1. Setup Steps

1.1 install and load device mapper (not necessary in RHEL58)

a) install Device Mapper Multipath/DMMP

yum install device-mapper device-mapper-multipath

b) load and check device mapper and multipath modules

modprobe dm-multipath
modprobe dm-round-robin
lsmod | grep md

c) start the multipathd service

Continue reading

bash 中的双引号和单引号

echo "b=$a+2"     # 显示 b=3+2
echo 'b=$a+2'     # 显示 b=$a+2

在 bash 中,

单引号 可以保证引用区域内的文字不被转换,起到保护作用,一般可以用在显示 code 之类;
双引号 可以包含文字或者函数段。其中,反引号中的函数,$ 开头的变量和 \ 开头反转换的字符外,其他都是直接输出。


SSH/SCP 不用输入密码连接远程 Linux 主机



ssh-keygen -t rsa


这个命令生成一个密钥对:id_rsa(私钥文件)和公钥文件)。默认被保存在 ~/.ssh/ 目录下。

2)将公钥添加到远程主机的 authorized_keys 文件中
SSH 到登陆到远程主机,将公钥追加到 authorized_keys 文件中