lxc complains about cgroup not available

Bug #936756 reported by Ritesh Raj Sarraf
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I have been trying to work with lxc to make use of my uml image. My config is as follows:

12:21:05 rrs@champaran:~$ cat /var/lib/lxc/test/config
lxc.utsname = test
lxc.rootfs = /home/rrs/Debian-Wheezy-AMD64-root_fs
lxc.rootfs.mount = /tmp/foo

lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.deny = a
lxc.cgroup.devices.allow = c 1:3 rw
lxc.cgroup.devices.allow = b 8:0 rw
#lxc.mount = /etc/fstab.complex
lxc.mount.entry = /lib /root/myrootfs/lib none ro,bind 0 0
lxc.cap.drop = sys_module mknod setuid net_raw
lxc.cap.drop = mac_override

When I try to start the instance, I get the following error:

12:16:04 rrs@champaran:~$ sudo lxc-start -n test
lxc-start: cgroup is not mounted
lxc-start: failed to setup the cgroups for 'test'
lxc-start: failed to setup the container
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn 'test'

But as you can see below, cgroup is already mounted.

12:16:49 rrs@champaran:~$ mount
/dev/sda6 on / type ext4 (rw,errors=remount-ro,commit=600)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda2 on /boot type ext4 (rw,commit=600)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
cgroups on /sys/fs/cgroup type tmpfs (rw,uid=0,gid=0,mode=0755)
gvfs-fuse-daemon on /home/rrs/.cache/gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=rrs)

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: lxc 0.7.5-3ubuntu28
ProcVersionSignature: Ubuntu 3.2.0-17.26-generic 3.2.6
Uname: Linux 3.2.0-17-generic x86_64
ApportVersion: 1.91-0ubuntu1
Architecture: amd64
Date: Mon Feb 20 12:17:21 2012
SourcePackage: lxc
UpgradeStatus: Upgraded to precise on 2012-01-24 (26 days ago)
mtime.conffile..etc.default.lxc: 2012-01-25T01:58:25.599609

Revision history for this message
Ritesh Raj Sarraf (rrs) wrote :
Revision history for this message
Ritesh Raj Sarraf (rrs) wrote :

actually, this must be a problem at my end. I just tried with lxc-create, and it was able to create a container. Sorry for the noise.

Changed in lxc (Ubuntu):
status: New → Invalid
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

@Ritesh,

actually lxc-create doesn't need the cgroups, so that doesn't mean there is no problem. However, your mount output only shows that a tmpfs called cgroup is mounted under /sys/fs/cgroup. It doesn't show that actual cgroup filesystems are mounted under there. Take a look at /proc/self/mounts, and you should see something like:

serge@ubuntu:~$ grep cgroup /proc/self/mounts
cgroup /sys/fs/cgroup tmpfs rw,relatime,mode=755 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0
cgroup /sys/fs/cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,relatime,freezer 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,relatime,blkio 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,relatime,perf_event 0 0

Revision history for this message
Arie Skliarouk (skliarie) wrote :

kernel 3.2.0-30-generic
cgroup-bin 0.37.1-1ubuntu10

After boot cgroup fs is mounted onto /sys/fs/cgroup

# df | grep cgroup
 cgroups 4088656 0 4088656 0% /sys/fs/cgroup
# mount | grep cgroup
cgroups on /sys/fs/cgroup type tmpfs (rw,uid=0,gid=0,mode=0755)
#

and lxc-start complains on "lxc-start: cgroup is not mounted"

To workaround the problem following had to be done:
/etc/init.d/cgconfig stop
mkdir -p /cgroup
mount none -t cgroup /cgroup

After that lxc-start worked properly...

Revision history for this message
Stéphane Graber (stgraber) wrote :

Remove cgroup-bin from your system and replace it with cgroup-lite.

cgroup-bin is known to have a variety of issues and is in the process of getting killed to replace by the much simpler and much more reliable cgroup-lite.

Revision history for this message
eval- (eval-) wrote :

I had to remove cgroup-lite and install cgroup-bin in order to avoid this error. cgroup-lite was not mounting /sys/fs/cgroup which lxc-execute required. Once I installed cgroup-bin and invoked /etc/init.d/cgconfig everything worked fine on my 12.04.3 LTS

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Ah, are you running a saucy or trusty backport kernel?

the precise cgroup-lite still is 'start on mounted MOUNTPOINT=/sys', whereas later it had to become 'MOUNTPOINT=/sys/fs/cgroup',

It sounds like we need to update the precise job to handle both cases.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Filed bug 1304538 for the cgroup-lite bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.