On systemd 252, Linux 6.0.14 When I start a container, it fails: % lxc start clangformat Error: Failed to run: /usr/bin/lxd forkstart clangformat /var/lib/lxd/containers /var/log/lxd/clangformat/lxc.conf: exit status 1 Try `lxc info --show-log clangformat` for more info % lxc info --show-log clangformat Name: clangformat Status: STOPPED Type: container Architecture: x86_64 Created: 2022/11/22 18:16 CET Last Used: 2023/02/14 15:34 CET Log: lxc clangformat 20230214143445.256 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 clangformat 20230214143445.256 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 clangformat 20230214143445.256 ERROR conf - ../lxc-5.0.2/src/lxc/conf.c:lxc_setup:4433 - Failed to setup remaining automatic mounts lxc clangformat 20230214143445.256 ERROR start - ../lxc-5.0.2/src/lxc/start.c:do_start:1272 - Failed to setup container "clangformat" lxc clangformat 20230214143445.256 ERROR sync - ../lxc-5.0.2/src/lxc/sync.c:sync_wait:34 - An error occurred in another process (expected sequence number 4) lxc clangformat 20230214143445.258 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 "vethf6925fa1" lxc clangformat 20230214143445.258 ERROR start - ../lxc-5.0.2/src/lxc/start.c:__lxc_start:2107 - Failed to spawn container "clangformat" lxc clangformat 20230214143445.258 ERROR lxccontainer - ../lxc-5.0.2/src/lxc/lxccontainer.c:wait_on_daemonized_start:878 - Received container state "ABORTING" instead of "RUNNING" lxc clangformat 20230214143445.258 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 33869 lxc clangformat 20230214143450.390 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.clangformat) lxc 20230214143450.499 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 20230214143450.499 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" After I umount /sys/fs/cgroup/portage, the container can start. % sudo umount /sys/fs/cgroup/portage % lxc start clangformat Why exactly does this happend? What needs to be done to fix it properly?
Where does /sys/fs/cgroup/portage come from? Is it some custom cgroup rule you have? It could be a permission-related issue.
(In reply to Joonas Niilola from comment #1) > Where does /sys/fs/cgroup/portage come from? Is it some custom cgroup rule > you have? It could be a permission-related issue. Portage mounts it on emerges if using FEATURES="cgroup", not sure if it does for anything else.
Created attachment 860884 [details] lxc-container-failed.log I can confirm this behavior and I am pretty sure that it is related to portage's FEATURES="cgroup" being enabled. $ mount |grep cg cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime) $ lxc start gentoo-dnssec-test <no-issues> $ FEATURES="cgroup" sudo -E emerge -1 <something> $ mount |grep cg cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime) tmpfs on /sys/fs/cgroup/portage type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/usr/lib/portage/python3.10/cgroup-release-agent,name=portage) $ lxc start gentoo-riscv-crossdev-test Error: Failed to run: /usr/bin/lxd forkstart gentoo-riscv-crossdev-test /var/lib/lxd/containers /var/log/lxd/gentoo-riscv-crossdev-test/lxc.conf: exit status 1 Try `lxc info --show-log gentoo-riscv-crossdev-test` for more info Attached output of "lxc info --show-log gentoo-riscv-crossdev-test".
@juppis thanks for digging out that lxd issue. It seems to confirm that this is probably a portage bug: mounting a v1 cgroup /sys/fs/cgroup/portage over a v2 cgroup /sys/fs/cgroup For cross referencing, here is the link to my LXD forum post: https://discuss.linuxcontainers.org/t/failed-to-start-container-cgfsng-lxc-5-0-2-src-lxc-cgroups-cgfsng-c2139-no-such-file-or-directory-failed-to-create-cgroup-at-mnt-24/16929
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=f8e3b11496bd6d602a690535c4a3bb32bb8e9744 commit f8e3b11496bd6d602a690535c4a3bb32bb8e9744 Author: Florian Schmaus <flow@gentoo.org> AuthorDate: 2023-06-14 15:20:13 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-07-29 11:24:45 +0000 Drop FEATURES=cgroup, i.e., v1 cgroup usage Remove portage's usage of Linux version 1 cgroups, which are itself superseded by version 2 cgroups. This basically reverts b01a1b90d8c5 ("Add FEATURES=cgroup to isolate phase processes."). Portage's usage of version 1 cgroups has caused some issues in the past. For example https://bugs.gentoo.org/894398, where LXD got confused by the existence of the version 1 cgroup created by portage. Arguably, this could be considered a bug in LXD, but with FEATURES=pid-sandbox, as better alternative to FEATURES=cgroup exists. And removing the code for FEATURES=cgroup reduces portage's code size, which is also a plus. Bug: https://bugs.gentoo.org/894398 Signed-off-by: Florian Schmaus <flow@gentoo.org> Reviewed-by: Michał Górny <mgorny@gentoo.org> Closes: https://github.com/gentoo/portage/pull/1057 Signed-off-by: Sam James <sam@gentoo.org> NEWS | 5 ++ lib/_emerge/AbstractEbuildProcess.py | 88 ------------------------------------ lib/_emerge/SpawnProcess.py | 63 -------------------------- lib/portage/const.py | 1 - lib/portage/process.py | 14 ------ man/make.conf.5 | 4 -- 6 files changed, 5 insertions(+), 170 deletions(-)
We really need to change the default in OpenRC as well...
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=858dfd771ac4c6c9315ac5851f4aeeb233fc21d5 commit 858dfd771ac4c6c9315ac5851f4aeeb233fc21d5 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-08-09 02:54:12 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-08-09 02:54:12 +0000 sys-apps/portage: add 3.0.50 Closes: https://bugs.gentoo.org/908971 Closes: https://bugs.gentoo.org/640658 Closes: https://bugs.gentoo.org/894398 Closes: https://bugs.gentoo.org/895908 Closes: https://bugs.gentoo.org/909067 Closes: https://bugs.gentoo.org/909148 Closes: https://bugs.gentoo.org/909853 Closes: https://bugs.gentoo.org/910035 Closes: https://bugs.gentoo.org/910376 Closes: https://bugs.gentoo.org/911594 Closes: https://bugs.gentoo.org/911574 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.50.ebuild | 229 +++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=376ab2c56e3dc7e7904ec862128bdabc07f6a00a commit 376ab2c56e3dc7e7904ec862128bdabc07f6a00a Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2024-09-29 20:18:14 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2024-09-29 22:47:07 +0000 SpawnProcess: Remove unused _CGROUP_CLEANUP_RETRY_MAX Left over from FEATURES="cgroup". Fixes: f8e3b11496bd6d602a690535c4a3bb32bb8e9744 Bug: https://bugs.gentoo.org/894398 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/SpawnProcess.py | 4 ---- 1 file changed, 4 deletions(-)