A clear non-kernel-modifying solution to containers not starting due to CGroup issue

Hello.

Let me add my basic data for info first:

Manjaro Stable
6.1 Stable Kernel

Ubuntu 22.04 (jammy) container OS.

sudo lxc-checkconfig                                                     
LXC version 5.0.3

--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Warning: newuidmap is not setuid-root
Warning: newgidmap is not setuid-root
Network namespace: enabled

--- Control groups ---
Cgroups: enabled
Cgroup namespace: enabled
Cgroup v1 mount points: 
 - /sys/fs/cgroup/net_cls
Cgroup v2 mount points: 
 - /sys/fs/cgroup
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: enabled, loaded
Macvlan: enabled, not loaded
Vlan: enabled, not loaded
Bridges: enabled, loaded
Advanced netfilter: enabled, loaded
CONFIG_IP_NF_TARGET_MASQUERADE: enabled, not loaded
CONFIG_IP6_NF_TARGET_MASQUERADE: enabled, not loaded
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled, not loaded
CONFIG_NETFILTER_XT_MATCH_COMMENT: enabled, not loaded
FUSE (for use with lxcfs): enabled, loaded

--- Checkpoint/Restore ---
checkpoint restore: enabled
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: enabled
CONFIG_INET_DIAG: enabled
CONFIG_PACKET_DIAG: enabled
CONFIG_NETLINK_DIAG: enabled
File capabilities: enabled

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig

I’ve been following the breadcrumbs of this CGroup issue starting at the first problem:

Applying these 2 lines to the contaier config:

lxc.cgroup.devices.allow =
lxc.cgroup.devices.deny =

Fixes the first problem of:

lxc-start: epub: ../src/lxc/cgroups/cgfsng.c: cg_legacy_set_data: 3098 No such file or directory - Failed to setup limits for the "devices" controller. The controller seems to be unused by "cgfsng" cgroup driver or not enabled on the cgroup hierarchy

Problem 2 is based on:

Failed to mount cgroup at /sys/fs/cgroup/systemd: Operation not permitted
[!!!!!!] Failed to mount API filesystems.
Exiting PID 1...

The solutions here and here say we need to modify the kernel on its boot.

But this legacy issue shouldn’t be affecting newer host OSes (or should it?) nor newer container OSes.

How can I fix the issue without modifying what the kernel does on boot? Or should I drop Ubuntu and use a container OS that works without fiddling too much?

(I am a power-user that doesn’t want too much system modifications because they may break on future updates)

Those posts are correct, a system booted with cgroup2 cannot provide the cgroup1 interface needed by old containers like the one you’re dealing with.

Reboot your host system in cgroup1 mode to have it work, no alternative here.

Worth noting that very recent distros now have the opposite problem where they cannot boot on a cgroup1 system. So you’re soon going to have to choose whether you want to be able to run old distros (boot in cgroup1) or run new ones (boot in cgroup2), both will not be possible in parallel.

Alternatively, which container OS can I use that is CGroup2?

Is Ubuntu Jammy really considered ‘old’? It was released around April 2022.