Unprivileged LXC containers don't work under systemd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Medium
|
Martin Pitt |
Bug Description
With systemd 208, unprivileged containers stop working when running under systemd (working fine under upstart with cgmanager). Quoting Stephane Graber:
In this setup, things don't work nearly as well. On login I'm only
placed into the name=systemd cgroup and not in any of the others, which
means that unprivileged LXC isn't usable.
Martin suggested setting JoinControllers in /etc/systemd/
upon closer inspection, this isn't at all what we want. This setting is
used to tell systemd what controllers to co-mount, by default this is
set to cpu,cpuset (which caused the earlier cgmanager breakage).
Even though this option isn't helpful for what we want (i.e. setting the
list of cgroup controllers the first PID of a user session should be
added to), we should nonetheless set it to an empty string which should
instruct systemd not to co-mount any controller, therefore giving us a
more reliable behavior (identical to what we have in the upstart world
and unlikely to confuse lxc and other stuff doing direct cgroup access).
Additionally, we need to find an equivalent to our good old
"Controllers" logind.conf option, or re-introduce it or just patch
logind so that it will always join all the controllers (similar to what
the shim does).
== Actions ==
* Update systemd.conf to set JoinControllers to an empty value.
* Make it so new user sessions are joined to all the available
controllers by doing one of the following:
- Find the magic undocumented config variable
- Re-introduce the "Controllers" option in logind.conf
- Patch logind to have it always join all available controllers
tags: | added: systemd-boot |
Changed in systemd (Ubuntu): | |
status: | New → Triaged |
Changed in systemd (Ubuntu): | |
milestone: | none → ubuntu-14.12 |
assignee: | nobody → Martin Pitt (pitti) |
Changed in systemd (Ubuntu): | |
status: | Triaged → In Progress |
I have an unprivileged container setup in my test VM now, and they continue to work with 208. However, LXC under systemd currently requires some work (bug 1312532 and bug 1350947), so this should land first so that system-level containers work under systemd. Then I'll look into the cgroups issue.
Stéphane, can I check this without LXC somehow? I think my session processes already are in all cgroups:
$ cat /proc/$$/cgroup net_prio: / systemd: /user.slice/ user-1000. slice/session- c2.scope
10:hugetlb:/
9:perf_event:/
8:blkio:/
7:net_cls,
6:freezer:/
5:devices:/
4:memory:/
3:cpu,cpuacct:/
2:cpuset:/
1:name=
$ grep $$ /sys/fs/ cgroup/ */cgroup. procs cgroup/ blkio/cgroup. procs:2898 cgroup/ cpuacct/ cgroup. procs:2898 cgroup/ cpu/cgroup. procs:2898 cgroup/ cpu,cpuacct/ cgroup. procs:2898 cgroup/ cpuset/ cgroup. procs:2898 cgroup/ devices/ cgroup. procs:2898 cgroup/ freezer/ cgroup. procs:2898 cgroup/ hugetlb/ cgroup. procs:2898 cgroup/ memory/ cgroup. procs:2898 cgroup/ net_cls/ cgroup. procs:2898 cgroup/ net_cls, net_prio/ cgroup. procs:2898 cgroup/ net_prio/ cgroup. procs:2898 cgroup/ perf_event/ cgroup. procs:2898
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
/sys/fs/
Or do I misunderstand this?