I've made a new installation of Debian 11. Regarding LXC, I copied the working setup of my Debian 10 computer. I use a separate user, lxcuser which I su to, to lxc-start.
The configuration, ~/.config/lxc/default.conf
lxc.idmap = u 0 165536 65536 lxc.idmap = g 0 165536 65536 lxc.apparmor.profile = unconfined lxc.mount.auto = proc:mixed sys:ro cgroup:mixed lxc.net.0.type = veth lxc.net.0.link = lxcbr0 lxc.net.0.flags = up lxc.net.0.hwaddr = 00:FF:xx:xx:xx:xx #lxc.include = /etc/lxc/default.conf File system permissions are set using ACLs, as I did on my previous setup.
lxc-checkconfig
LXC version 4.0.6 Kernel configuration not found at /proc/config.gz; searching... Kernel configuration found at /boot/config-5.10.0-7-amd64 --- Namespaces --- Namespaces: enabled Utsname namespace: enabled Ipc namespace: enabled Pid namespace: enabled User namespace: enabled Network namespace: enabled --- Control groups --- Cgroups: enabled Cgroup v1 mount points: Cgroup v2 mount points: /sys/fs/cgroup Cgroup v1 systemd controller: missing Cgroup v1 freezer controller: missing Cgroup namespace: required Cgroup device: enabled Cgroup sched: enabled Cgroup cpu account: enabled Cgroup memory controller: enabled Cgroup cpuset: enabled --- Misc --- Veth pair device: enabled, not loaded Macvlan: enabled, not loaded Vlan: enabled, not loaded Bridges: enabled, loaded Advanced netfilter: enabled, loaded CONFIG_NF_NAT_IPV4: missing CONFIG_NF_NAT_IPV6: missing 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: Note : Before booting a new kernel, you can check its configuration usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig After running with debugging option, I think I've pinned down the error on these lines:
DEBUG cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1355 - Failed to create cgroup "(null)" WARN cgfsng - cgroups/cgfsng.c:mkdir_eexist_on_last:1152 - Permission denied - Failed to create directory "/sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope/lxc.monitor.arch" Changing permissions on /sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope directory has no effect; using sudo cannot write there either.
I believe the issue has arisen due to cgroupv2 which is enabled by default on Debian 11. I tried various ways I found on the net as workabouts, nothing works so far.
Any ideas? Either to make unprivileged LXC work with cgroupv2 or the proper way to disable cgroupv2 and enable cgroupv1 on Debian 11 (or imitate Debian 10's cgroup setup). Other solutions welcomed of course!
Some links:
Same issue, unaswered
My blog on how I setup unprivileged LXC on Debian 10, copied the setup
Update: adding systemd.unified_cgroup_hierarchy=false systemd.legacy_systemd_cgroup_controller=false" to kernel parametres helped to start containers. But I still get this error from inside the container:
Arch Linux:
Welcome to Arch Linux! Failed to create /init.scope control group: Permission denied Failed to allocate manager object: Permission denied [!!!!!!] Failed to allocate manager object. Exiting PID 1... Centos 8:
Welcome to CentOS Linux 8! Failed to read AF_UNIX datagram queue length, ignoring: No such file or directory Failed to install release agent, ignoring: No such file or directory Failed to create /init.scope control group: Permission denied Failed to allocate manager object: Permission denied [!!!!!!] Failed to allocate manager object, freezing. Freezing execution.