[Lxc-users] lxc-destroy does not destroy cgroup

Serge Hallyn serge.hallyn at canonical.com
Tue Dec 20 14:53:04 UTC 2011


Quoting Arie Skliarouk (skliarie at gmail.com):
> I don't have the /cgroup directory mounted. Somehow, the directory is
> mounted automatically onto the /sys/fs/cgroup
> 
> *root at mf:~# df | grep cgroup
> cgroup                12368328         0  12368328   0% /sys/fs/cgroup
> root at mf:~# ls /sys/fs/cgroup/
> blkio  cpu  cpuacct  cpuset  devices  freezer  memory  net_cls  perf_event*
> 
> Each subdirectory of the above contains directory per container with knobs
> that are specific to the resource:
> 
> *root at mf:~# ls /sys/fs/cgroup/cpu/dev
> cgroup.clone_children  cgroup.procs      cpu.rt_runtime_us
> notify_on_release
> cgroup.event_control   cpu.rt_period_us  cpu.shares         tasks
> root at mf:~#*
> 
> Could well be this is because of the 3.0.0-12-server kernel. I don't see

No, userspace does the mounting.  i.e. in ubuntu the cgroup-lite or
cgroup-bin packages both do it.

> how I can rename a stuck cgroup easily in this situation. Any advices?

You can build an lxc with my patch (until Daniel has a chance to apply it),
but in the meantime you can make a script 'move_cgroup.sh' along the lines
of:

#!/bin/sh
if [ $# -lt 1 ]; then
	echo "Usage: $0 <cgroup-name>"
	echo " Moves the <cgroup-name> out of the way."
fi
g=$1

t=`mktemp -u cg.XXXXXXXX`
for d in /sys/fs/cgroup/*; do
	mv $d/$g $d/$g.$t
done

Note that doesn't clean anything up, so if there are hung tasks those will
still be around.  A script to list details of each task in the hung cgroup
would be pretty simple too, and useful - if you write one, you might send
it here for inclusion in lxc!

> BTW, I once had /cgroup mounted from fstab like this:
> 
> *none /cgroup cgroup defaults 0 0*
> 
> It grouped all settings into per-container directory nicely, but the server
> failed to boot with that.

Yes, once early userspace has mounted the /sys/fs/cgroup/*, that fstab
entry would cause trouble.  But if you remove the package doing the
cgroup mounting, you should be able to go back to using this fstab
entry.

-serge




More information about the lxc-users mailing list