mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd
on the host. Then it works. However, ubuntu 18.04 was a just a test. What I actually want is a 32-bit ubuntu 16.04. And that one still doesn’t work. lxc launch ubuntu-daily:16.04/i386 ubuntu32 installs and launches it, but then:
# lxc console ubuntu32 --show-log
Console log:
systemd 229 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN)
Detected virtualization lxc.
Detected architecture x86.
Welcome to Ubuntu 16.04.6 LTS!
Set hostname to <ubuntu32>.
Failed to read AF_UNIX datagram queue length, ignoring: No such file or directory
Failed to install release agent, ignoring: Permission denied
Failed to create /init.scope control group: Permission denied
Failed to allocate manager object: Permission denied
[!!!!!!] Failed to allocate manager object, freezing.
Freezing execution.
Most likely, you are affected by this, https://github.com/systemd/systemd/issues/9563
It is about nspawn, which is similar to LXC/LXD. But the error you get is the same, bad mismatch between versions of systemd between the host and the container.
The Troubleshooting page for LXD at gentoo mentions compatibility issues when you use the default OpenRC init/rc system. It is strange that you had to perform the mount even when you are using systemd. I suppose you have used the instructions at https://wiki.gentoo.org/wiki/Systemd to switch init/rc.
Systemd has been working without issues since 2016 when I did the switch. OpenRC is not even installed anymore. However, I do not know who or what is responsible for mounting /sys/fs/cgroup/systemd. Is it me in /etc/fstab? Doesn’t seem possible because it needs an mkdir first. Is systemd supposed to do that? Or some systemd service? I can’t find any information about it :-/
In the nspawn bug, I found UNIFIED_CROUP_HIERARCHY=0 so I exported that in the same root shell I use to lxc start ubuntu32, but it didn’t help. Same issue.
There’s also this:
systemd.legacy_systemd_cgroup_controller=yes
It’s supposed to be set via Parameters=. Not sure where to set that in this case though.