[lxc-devel] issue with cgroups on very first start of any container after bootstrapping the host
Jäkel, Guido
G.Jaekel at dnb.de
Thu Jun 21 09:33:34 UTC 2012
Hello Developers,
using Gentoo's lxc-0.8.0_rc1-r4 with a Kernel gentoo-sources-3.3.5 I observe the following issue concerning the cgroupfs:
For reasons of compatibility I have still mounted the controllers of the cgroupfs at a single mountpoint /cgroup/ .
# grep cgroup /etc/fstab:
cgroup /cgroup cgroup defaults 0 0
After a bootstrap of the host this shows up as
# grep cgroup /proc/mounts
cgroup /cgroup cgroup rw,relatime,blkio,freezer,devices,memory,cpuacct,cpu,cpuset 0 0
If I now try to start the first container, it will fail (for *any* previous well working container). The important messages in the log are:
lxc-start 1340194612.650 INFO lxc_cgroup - [1] found cgroup mounted at '/cgroup',opts='rw,relatime,blkio,freezer,devices,memory,cpuacct,cpu,cpuset'
lxc-start 1340194612.650 DEBUG lxc_cgroup - get_init_cgroup: found init cgroup for subsys (null) at /
lxc-start 1340194612.650 DEBUG lxc_cgroup - cgroup /cgroup has flags 0x0
lxc-start 1340194612.682 INFO lxc_cgroup - created cgroup '/cgroup//lxc/testcat0'
lxc-start 1340194612.682 DEBUG lxc_cgroup - checking '/proc/bus/usb' (usbfs)
lxc-start 1340194612.683 DEBUG lxc_conf - move '(null)' to '10591'
lxc-start 1340194612.762 DEBUG lxc_start - Dropped cap_sys_boot
lxc-start 1340194612.762 INFO lxc_conf - '' hostname has been setup
lxc-start 1340194612.792 DEBUG lxc_conf - mac address '00:50:C2:45:3C:14' on 'eth0' has been setup
lxc-start 1340194612.795 DEBUG lxc_conf - 'eth0' has been setup
lxc-start 1340194612.795 INFO lxc_conf - network has been setup
lxc-start 1340194612.795 DEBUG lxc_conf - mounted '/etc/lxc/testcat0/rootfs' on '/usr/lib/lxc/rootfs'
[...]
lxc-start 1340194612.797 INFO lxc_conf - mount points have been setup
lxc-start 1340194612.798 ERROR lxc_conf - No such file or directory - failed to mount '/cgroup/testcat0' on '/usr/lib/lxc/rootfs/cgroup' <<-- SHOULD BE /cgroup/lxc/testcat0 HERE ???
lxc-start 1340194612.798 ERROR lxc_conf - failed to setup the mount entries for 'testcat0'
lxc-start 1340194612.798 ERROR lxc_start - failed to setup the container
lxc-start 1340194612.798 ERROR lxc_sync - invalid sequence number 1. expected 2
lxc-start 1340194612.799 ERROR lxc_start - failed to spawn 'testcat0'
lxc-start 1340194612.799 DEBUG lxc_cgroup - get_init_cgroup: found init cgroup for subsys (null) at /
lxc-start 1340194612.799 DEBUG lxc_cgroup - destroying /cgroup//lxc/testcat0
lxc-start 1340194612.858 DEBUG lxc_cgroup - '/cgroup//lxc/testcat0' unlinked
After this first try, there is the new lxc super directory /cgroups/lxc and the mount options of the cgroupfs now show an additional clone_childern
cgroup /cgroup cgroup rw,relatime,blkio,freezer,devices,memory,cpuacct,cpu,cpuset,clone_children 0 0
respectively /cgroup/cgroup.clone_children is 1.
As from now, starting of the containers will work:
lxc-start 1340194763.755 INFO lxc_cgroup - [1] found cgroup mounted at '/cgroup',opts='rw,relatime,blkio,freezer,devices,memory,cpuacct,cpu,cpuset,clone_children'
lxc-start 1340194763.755 DEBUG lxc_cgroup - get_init_cgroup: found init cgroup for subsys (null) at /
lxc-start 1340194763.755 DEBUG lxc_cgroup - cgroup /cgroup has flags 0x0
lxc-start 1340194763.798 INFO lxc_cgroup - created cgroup '/cgroup//lxc/testcat0'
lxc-start 1340194763.798 DEBUG lxc_cgroup - checking '/proc/bus/usb' (usbfs)
lxc-start 1340194763.799 DEBUG lxc_conf - move '(null)' to '10730'
lxc-start 1340194763.858 DEBUG lxc_start - Dropped cap_sys_boot
lxc-start 1340194763.858 INFO lxc_conf - '' hostname has been setup
lxc-start 1340194763.900 DEBUG lxc_conf - mac address '00:50:C2:45:3C:14' on 'eth0' has been setup
lxc-start 1340194763.904 DEBUG lxc_conf - 'eth0' has been setup
lxc-start 1340194763.904 INFO lxc_conf - network has been setup
lxc-start 1340194763.904 DEBUG lxc_conf - mounted '/etc/lxc/testcat0/rootfs' on '/usr/lib/lxc/rootfs'
[...]
lxc-start 1340194763.905 INFO lxc_conf - mount points have been setup
lxc-start 1340194763.906 DEBUG lxc_conf - remounting /cgroup/lxc/testcat0 on /usr/lib/lxc/rootfs/cgroup to respect bind or remount options
lxc-start 1340194763.906 DEBUG lxc_conf - mounted '/cgroup/lxc/testcat0' on '/usr/lib/lxc/rootfs/cgroup', type 'none'
lxc-start 1340194763.906 INFO lxc_conf - mount points have been setup
lxc-start 1340194763.906 DEBUG lxc_cgroup - lxc_cgroup_path_get: called for subsys devices name testcat0
lxc-start 1340194763.907 DEBUG lxc_cgroup - using cgroup mounted at '/cgroup/lxc'
lxc-start 1340194763.907 DEBUG lxc_cgroup - lxc_cgroup_path_get: returning /cgroup/lxc/testcat0 for subsystem devices.deny
lxc-start 1340194763.907 DEBUG lxc_conf - cgroup 'devices.deny' set to 'a'
lxc-start 1340194763.907 DEBUG lxc_cgroup - lxc_cgroup_path_get: called for subsys devices name testcat0
If manually clear or set /cgroup/cgroup.clone_children and delete/create /cgroup/lxc it shows, that especial the absence of the lxc super-directory will reproduce the issue. It will be created by the first start of lxc afterwards (and never removed afterwards), but not yet used in this run. Therefore, a quick workaround is to create it in the host init scripts.
greetings
Guido
More information about the lxc-devel
mailing list