User can't suspend laptop/control wireless via dbus/systemd-logind if cgroups are disabled in kernel
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
This is kind of a long chain, but I think this is where it ends.
I custom compile my kernel for battery savings, as I spend lots of time flying. I recently went back to BFS in 3.14 as my scheduler, but immediately ran into lots of problems (it used to give me 15 more minutes on average). The most interesting, that I can't work around is this:
I disable cgroups because BFS doesn't use them at all. and when I did, even with the ubuntu linux-source package, I suddenly couldn't put my laptop to sleep, and I couldn't control my network connections anymore. Investigating lead me to discover that "start systemd-logind" was failing.
So, here's my relevant config:
rob@kubuntu4:~$ grep CGROUP /boot/config-`uname -r`; sudo start systemd-logind; dmesg |tail -1; ls /sys/fs/cgroup
# CONFIG_CGROUPS is not set
start: Job failed to start
[ 1450.848491] init: systemd-logind pre-start process (10865) terminated with status 32
ls: cannot access /sys/fs/cgroup: No such file or directory
the /sys/fs/cgroup folder doesn't exist because CONFIG_CGROUPS isn't set in the kernel. So what is "status 32" from the pre-script for systemd-logind ?
the problem seems to be in the mount statements in the systemd-logind prestart script:
grep mount /etc/init/
# this is being done by systemd or mountall usually, but not during
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=
# mounting the cgroup does not work in LXC, there it uses cgmanager
if [ ! -e /run/container_type ] && ! mountpoint -q /sys/fs/
mount -t cgroup -o nosuid,
Testing:
sudo mount -t tmpfs -o uid=0,gid=
[sudo] password for rob:
mount: mount point /sys/fs/cgroup does not exist
32
Rebooting into the stock ubuntu kernel, and I can put my laptop to sleep again, albeit at the cost of a bunch of battery life.
I don't understand why cgroups are required for dbus and PolicyKit to be able to allow me to put my laptop to sleep, so I'm filing this as a bug. the systemd pre-script doesn't bother to check if the /sys/fs/cgroup folder even exists, so there's definitely a "defensive programming" bug in systemd not handling this situation better.
currently "sudo pm_suspend" is an easy workaround for the sleep issue, but my wireless access issue has no workaround.
I'm afraid logind does require cgroups to be available. The init script reflects that, as without the cgroup mount logind wouldn't work. You already noticed the failure to suspend etc., but I'm quite surprised that you get a desktop session at all. I expect that dynamic ACLs to devices (sound, USB, etc.) are also not working.
So I recommend enabling cgroups in your custom kernels. This should hardly have any power usage effect?