Failed to start container: cgfsng - ../lxc-5.0.2/src/lxc/cgroups/cgfsng.c:cgfsng_mount:2139 - No such file or directory - Failed to create cgroup at_mnt 24()

My LXD/LXC 5.0.2 installation started to show a strange behavior. Right after booting the host, starting containers via lxc start <name> works just fine. However, soon after that, I am unable to start containers, even the ones that had already run before.

I think the relevant part from the container’s log is

cgfsng - ../lxc-5.0.2/src/lxc/cgroups/cgfsng.c:cgfsng_mount:2139 - No such file or directory - Failed to create cgroup at_mnt 24()

Looking at the source

I find it strange that h->at_mnt appears to point to the empty string, hence the empty string appears within the parenthesis of 24() in the log message. But maybe this not unexpected?

The full --show-log output of an example container is

flo@neo-pc ~ $ lxc info --show-log gentoo-dnssec-test   
Name: gentoo-dnssec-test
Status: STOPPED
Type: container
Architecture: x86_64
Created: 2023/04/12 21:28 CEST
Last Used: 2023/04/13 09:18 CEST

Log:

lxc gentoo-dnssec-test 20230413071838.357 ERROR    cgfsng - ../lxc-5.0.2/src/lxc/cgroups/cgfsng.c:cgfsng_mount:2139 - No such file or directory - Failed to create cgroup at_mnt 24()
lxc gentoo-dnssec-test 20230413071838.357 ERROR    conf - ../lxc-5.0.2/src/lxc/conf.c:lxc_mount_auto_mounts:852 - No such file or directory - Failed to mount "/sys/fs/cgroup"
lxc gentoo-dnssec-test 20230413071838.357 ERROR    conf - ../lxc-5.0.2/src/lxc/conf.c:lxc_setup:4433 - Failed to setup remaining automatic mounts
lxc gentoo-dnssec-test 20230413071838.357 ERROR    start - ../lxc-5.0.2/src/lxc/start.c:do_start:1272 - Failed to setup container "gentoo-dnssec-test"
lxc gentoo-dnssec-test 20230413071838.357 ERROR    sync - ../lxc-5.0.2/src/lxc/sync.c:sync_wait:34 - An error occurred in another process (expected sequence number 4)
lxc gentoo-dnssec-test 20230413071838.359 WARN     network - ../lxc-5.0.2/src/lxc/network.c:lxc_delete_network_priv:3631 - Failed to rename interface with index 0 from "eth0" to its initial name "veth4ed08481"
lxc gentoo-dnssec-test 20230413071838.359 ERROR    start - ../lxc-5.0.2/src/lxc/start.c:__lxc_start:2107 - Failed to spawn container "gentoo-dnssec-test"
lxc gentoo-dnssec-test 20230413071838.359 ERROR    lxccontainer - ../lxc-5.0.2/src/lxc/lxccontainer.c:wait_on_daemonized_start:878 - Received container state "ABORTING" instead of "RUNNING"
lxc gentoo-dnssec-test 20230413071838.359 WARN     start - ../lxc-5.0.2/src/lxc/start.c:lxc_abort:1036 - No such process - Failed to send SIGKILL via pidfd 19 for process 216747
lxc gentoo-dnssec-test 20230413071843.611 WARN     cgfsng - ../lxc-5.0.2/src/lxc/cgroups/cgfsng.c:cgroup_tree_remove:490 - No such file or directory - Failed to destroy 10(lxc.payload.gentoo-dnssec-test)
lxc 20230413071843.658 ERROR    af_unix - ../lxc-5.0.2/src/lxc/af_unix.c:lxc_abstract_unix_recv_fds_iov:218 - Connection reset by peer - Failed to receive response
lxc 20230413071843.658 ERROR    commands - ../lxc-5.0.2/src/lxc/commands.c:lxc_cmd_rsp_recv_fds:128 - Failed to receive file descriptors for command "get_state"

I do not see anything suspicious in the system’s journal log. And I’ve tried to remove and re-install lxd/lxc. But the issues persists.

So far, I was unable to debug the issue further. Any help and pointers to solve this are appreciated.

To answer my own question: This is caused by a known compatibility issue between portage, Gentoo’s package manager, which FEATURE="cgroup" active and lxd.

See

for reference