[lxc-users] Ubuntu (maverick) container hangs at init

Stephen Zhang zsrkmyn at gmail.com
Thu May 15 07:56:27 UTC 2014


Hi all,
  I installed a ubuntu maverick (really an old release, but I have to use
it) using the following command:
           lxc-creat -t ubuntu -n ubuntu -f config -- -r maverick
the official repository is invalid now, so I changed it to
http://mirror.usu.ru/ubuntu/ in debootstap script and lxc-ubuntu template.
 The create produce ended successfully with no warning or error. Then I
started the container using "lxc-start -nubuntu -f config", but it failed.
So I made some changes of the rootfs of the container following  by the
tutorial here [1], including removing some files in /etc/init/ and mknod in
/dev . And I also disabled the dhcp in /etc/network/interfaces of eth0. But
it still couldn't start up successfully.
I used lxc-top (which used to be lxc-ps in previous time), seeing no
process running, and I used "pstree $(pidof lxc-start)" in host, only
/sbin/init found.
Finally, I started the container with "lxc-start -nubuntu -f config --
/sbin/init --verbose", it showed:

init: Handling startup event
init: lxcguest goal changed from stop to start
init: lxcguest state changed from waiting to starting
init: hostname goal changed from stop to start
init: hostname state changed from waiting to starting
init: Handling starting event
init: lxcguest state changed from starting to pre-start
init: lxcguest pre-start process (4)
init: Handling starting event
init: hostname state changed from starting to pre-start
init: hostname state changed from pre-start to spawned
init: hostname main process (5)
init: hostname state changed from spawned to post-start
init: hostname state changed from post-start to running
init: Handling started event
init: hostname main process (5) exited normally
init: hostname goal changed from start to stop
init: hostname state changed from running to stopping
init: Handling stopping event
init: hostname state changed from stopping to killed
init: hostname state changed from killed to post-stop
init: hostname state changed from post-stop to waiting
init: Handling stopped event
init: lxcguest pre-start process (4) exited normally
init: lxcguest state changed from pre-start to spawned
init: lxcguest state changed from spawned to post-start
init: lxcguest state changed from post-start to running
init: Handling started event

And my lxcguest.conf in /etc/init/ is here (removing this file also failed
to start the container):

description "track if this is lxc instance"

start on startup

env container
env LIBVIRT_LXC_UUID

pre-start script
   [ -z $container ] && [ -z $LIBVIRT_LXC_UUID ] && stop
   # clean up /var/run - in case the container shutdown did not
   rm -rf /var/run/*
   touch /var/run/utmp
   chown root:utmp /var/run/utmp
   exit 0
end script

My config file is here:

lxc.utsname = ubuntu
lxc.autodev = 1
lxc.tty = 5
lxc.pts = 1024
lxc.rootfs = /home/stephen/lxc/ubuntu/rootfs
lxc.mount = /home/stephen/lxc/ubuntu/fstab
#lxc.mount.entry = sysfs sys sysfs ro,defaults 0 0
#lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
#lxc.mount.entry = /proc/sys /home/stephen/lxc/ubuntu/rootfs/proc/sys none
ro,bind 0 0
#lxc.cap.drop = mknod sys_module mac_admin mac_override
# loop mount
#networking
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags = up
lxc.network.ipv4 = 192.168.100.3
lxc.network.name = eth0
#cgroups
lxc.cgroup.devices.deny = a
lxc.cgroup.devices.allow = c *:* m
lxc.cgroup.devices.allow = b *:* m
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
lxc.cgroup.devices.allow = c 1:7 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:2 rwm
lxc.cgroup.devices.allow = c 136:* rwm

My fstab file is here:

none /lxc/rootfs.ubuntu/dev/pts devpts defaults 0 0
sysfs sys sysfs ro,defaults 0 0
proc proc proc nodev,noexec,nosuid 0 0
/proc/sys /home/stephen/lxc/ubuntu/rootfs/proc/sys none ro,bind 0 0
/etc/resolv.conf /home/stephen/lxc/ubuntu/rootfs/etc/resolv.conf none
ro,bind 0 0

So, what's wrong with my container?

[1]http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/

Regards,
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140515/4f92d548/attachment.html>


More information about the lxc-users mailing list