lxc cgroup2: containers unbootable
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxc (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
If one sets in /etc/default/grub (as e.g. desired by facebook oomd):
GRUB_CMDLINE_
lxc is not able to start any containers anymore.
# lxc-start -F n04-01
lxc-start: n04-01: conf.c: lxc_setup_boot_id: 3249 Permission denied - Failed to mount /dev/.lxc-boot-id to /proc/sys/
[!!!!!!] Failed to mount API filesystems.
Exiting PID 1...
config:
-------
# Common configuration
lxc.include = /usr/share/
# Container specific configuration
lxc.apparmor.
lxc.start.auto = 1
lxc.rootfs.path = dir:/zones/
lxc.rootfs.options = noatime
lxc.mount.fstab = /zones/n04-01/fstab
lxc.uts.name = n04-01
lxc.arch = amd64
# Network configuration
lxc.net.0.type = macvlan
lxc.net.
lxc.net.0.flags = up
lxc.net.0.link = vlan2
lxc.net.0.hwaddr = 00:80:41:22:0d:10
lxc.net.0.name = n04-01_0
#lxc.include = /zones/
lxc.start.order = 16
#lxc.net.0.ipv4 = 10.2.1.65/16
#lxc.net.
The error you're getting is coming from systemd in the container which for some reason is trying to mount a cgroup1 hierarchy rather than using cgroup2 like the rest of your system.
You may be able to workaround that by using `lxc.init_cmd` to pass /sbin/init with additional arguments to change the systemd behavior in the container.