[Lxc-users] Container failed, can't remove cgroup

Serge Hallyn serge.hallyn at canonical.com
Mon Jan 28 21:55:20 UTC 2013


Quoting Lars Kellogg-Stedman (lars at oddbit.com):
> I'm runing LXC 0.7.5 under Fedora 17 (3.7.3-101.fc17.x86_64).  I've been
> banging my head against LXC for a bit today.  My latest problem is that
> if a container fails to start, I run into this situation:
> 
>   # lxc-start -n node0
>   lxc-start: Device or resource busy - failed to remove previous cgroup '/sys/fs/cgroup/systemd/node0'
>   lxc-start: failed to spawn 'node0'
>   lxc-start: Device or resource busy - failed to remove cgroup '/sys/fs/cgroup/systemd/node0'
> 
> There does indeed exist a cgroup by this name:
> 
>   # find /sys/fs/cgroup -name node0
>   /sys/fs/cgroup/systemd/node0
> 
> But it has no tasks:
> 
>   # cat /sys/fs/cgroup/systemd/node0/tasks 
>   #
> 
> It does, however, have a number of child cgroups:
> 
>   # find /sys/fs/cgroup/systemd/node0/ -type d
>   /sys/fs/cgroup/systemd/node0/
>   /sys/fs/cgroup/systemd/node0/system
>   /sys/fs/cgroup/systemd/node0/system/getty at .service
>   /sys/fs/cgroup/systemd/node0/system/getty at .service/tty1
>   /sys/fs/cgroup/systemd/node0/system/systemd-logind.service
>   /sys/fs/cgroup/systemd/node0/system/dbus.service
>   /sys/fs/cgroup/systemd/node0/system/systemd-journald.service
>   /sys/fs/cgroup/systemd/node0/system/sys-kernel-config.mount
>   /sys/fs/cgroup/systemd/node0/system/dev-hugepages.mount
>   /sys/fs/cgroup/systemd/node0/system/sys-kernel-debug.mount
>   /sys/fs/cgroup/systemd/node0/system/sys-fs-fuse-connections.mount
>   /sys/fs/cgroup/systemd/node0/system/dev-mqueue.mount
> 
> I can remove these by hand:
> 
>   # find /sys/fs/cgroup/systemd/node0/ -type d | tac | xargs rmdir
> 
> ...but is there any way to prevent this situation from happening in the
> first place?

No idea about the systemd aspects, but the best way to get those cgroups
to be autoremoved is using a release_agent.  See
Documentation/cgroups/cgroups.txt in the kernel source.

-serge




More information about the lxc-users mailing list