2009年6月4日木曜日

lxc のインストール 2

続き。
# lxc-execute -n tetest /bin/bash
/usr/local/libexec/lxc-init: error while loading shared libraries: liblxc-0.6.2.so: cannot open shared object file: No such file or directory
# ldd /usr/local/libexec/lxc-init
linux-gate.so.1 => (0xb8070000)
libutil.so.1 => /lib/i686/cmov/libutil.so.1 (0xb8060000)
liblxc-0.6.2.so => /usr/local/lib/liblxc-0.6.2.so (0xb804a000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7eef000)
/lib/ld-linux.so.2 (0xb8071000)
# ls -l /usr/local/lib/liblxc-0.6.2.so
-rwxr-xr-x 1 root staff 271005 2009-06-04 20:48 /usr/local/lib/liblxc-0.6.2.so
って何よ何。で Google 様に尋ねたところ chroot 先 ldconfig の問題との事。liblxc-0.6.2.so/usr/lib にコピーしてあげれば OK でこだわる必要無いけど....
lxc-createした後 chroot 先は var/lib/lxc。今回の場合は /usr/local/var/lxc なので
# cd /usr/local/var/lib/lxc/
# ls
tetest
# cd tetest
# ls
config fstab network rootfs state utsname
# cd rootfs
# ls
rootfs
# cd rootfs
# ls
bin dev etc lib lib64 proc root sbin sys tmp usr var
# cd etc
# ls
group gshadow passwd shadow ssh
# cat > ld.so.conf
/usr/local/lib
# cp /usr/local/lib/liblxc-0.6.2.so /usr/lib/
# lxc-execute -n tetest /sbin/ldconfig
# pwd
/usr/local/var/lib/lxc/tetest/rootfs/rootfs/etc
# ls -l ld.so.cache
-rw-r--r-- 1 root root 37669 2009-06-04 21:29 ld.so.cache
# rm /usr/lib/liblxc-0.6.2.so
# cd
# lxc-execute -n tetest /bin/bash
# hostname
tetest
鶏卵だけど /usr/local にインストールした場合、chroot 先に /usr/local/lib 含んだ /etc/ld.so.cache が必要。で 本筋に戻って
# lxc-execute -n tetest /usr/sbin/sshd
^Z
[1]+ Stopped lxc-execute -n tetest /usr/sbin/sshd
# bg
[1]+ lxc-execute -n tetest /usr/sbin/sshd &
# ping 192.168.1.100
PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
64 bytes from 192.168.1.100: icmp_seq=1 ttl=64 time=1.08 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=64 time=0.157 ms
64 bytes from 192.168.1.100: icmp_seq=3 ttl=64 time=0.159 ms
^C
--- 192.168.1.100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.157/0.466/1.082/0.435 ms
おぉ....
# slogin 192.168.1.100
The authenticity of host '192.168.1.100 (192.168.1.100)' can't be established.
RSA key fingerprint is ff:9e:86:97:0e:98:44:23:98:44:93:b0:2e:2c:a8:ee.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.100' (RSA) to the list of known hosts.
root@192.168.1.100's password:
PTY allocation request failed on channel 0
# 応答なし
もぉ....
# あと二つ三つつづく。

0 件のコメント: