[lxc-users] lxc-autostart, systemd and cgroups

Carlos Alberto Lopez Perez clopez at igalia.com
Wed Jan 20 17:59:57 UTC 2016


Hello,

I've found that when lxc-autostart is executed via systemd, the cgroups
assigned to the container are wrong for some control groups.

See the following two examples:

1. Container started via systemd (/lib/systemd/system/lxc.service unit
that calls lxc-autostart).

# cat /proc/${pidofsomeprocessinsidethecontainer}/cgroup
9:perf_event:/lxc/clopeztest3
8:blkio:/
7:net_cls,net_prio:/lxc/clopeztest3
6:freezer:/lxc/clopeztest3
5:devices:/
4:memory:/
3:cpu,cpuacct:/
2:cpuset:/lxc/clopeztest3
1:name=systemd:/system.slice/lxc.service


2. Container started manually by first stopping it and then executing
lxc-autostart from a ssh session.

# cat /proc/${pidofsomeprocessinsidethecontainer}/cgroup
9:perf_event:/lxc/clopeztest3
8:blkio:/lxc/clopeztest3
7:net_cls,net_prio:/lxc/clopeztest3
6:freezer:/lxc/clopeztest3
5:devices:/lxc/clopeztest3
4:memory:/lxc/clopeztest3
3:cpu,cpuacct:/lxc/clopeztest3
2:cpuset:/lxc/clopeztest3
1:name=systemd:/user.slice/user-0.slice/session-1.scope

As you can see, when systemd calls lxc-autostart, the cgroups for
memory, devices, cpu, cpuacct and blkio are not correctly set.

The effect of this is that any limitation configured on such container
(for example: amount of memory available for the container) is not
respected.

Are any of you aware of this behavior?
Is there any workaround to fix this?

Regards!
--------

Some notes about the environment:
 - This is a Debian 8 (jessie) system running the default LXC version
(lxc=1:1.0.6-6+deb8u2).
 - The memory cgroup was enabled (is disabled by default on Debian) by
setting on /etc/default/grub

 GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1"

 and running update-grub && reboot

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 883 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20160120/17068d98/attachment.sig>


More information about the lxc-users mailing list