1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-28 02:50:16 +03:00

semaphore-runner: disable cgroup setup in lxc

lxc tries to mount /sys/fs/cgroup/ following host hierarchy by default,
which is problematic for us since we want to unconditionally use
cgroup v2 in cgns. Disable it hence and let pid1 figure it out.
This commit is contained in:
Mike Yuan 2025-03-10 19:42:05 +01:00
parent fddd9459a9
commit 5329be530f
No known key found for this signature in database
GPG Key ID: 417471C0A40F58B3

View File

@ -23,9 +23,19 @@ create_container() {
sudo lxc-create -n "$CONTAINER" -t download -- -d "$DISTRO" -r "$RELEASE" -a "$ARCH"
# unconfine the container, otherwise some tests fail
echo 'lxc.apparmor.profile = unconfined' | sudo tee -a "/var/lib/lxc/$CONTAINER/config"
#
# disable automatic cgroup setup, instead let pid1 figure it out in mount_setup().
# This is especially important to ensure we get unified cgroup hierarchy
#
# FIXME: drop systemd.unified_cgroup_hierarchy=1 once the host runs on unified hierarchy
sudo tee "/var/lib/lxc/$CONTAINER/config.systemd_upstream" <<EOF
lxc.apparmor.profile = unconfined
lxc.mount.auto =
lxc.mount.auto = proc:mixed sys:mixed
lxc.init.cmd = /sbin/init systemd.unified_cgroup_hierarchy=1
EOF
sudo lxc-start -n "$CONTAINER"
sudo lxc-start -n "$CONTAINER" --define "lxc.include=/var/lib/lxc/$CONTAINER/config.systemd_upstream"
# enable source repositories so that apt-get build-dep works
sudo lxc-attach -n "$CONTAINER" -- sh -ex <<EOF
@ -111,6 +121,7 @@ EOF
../systemd_*.dsc \
-o "$ARTIFACTS_DIR" \
-- lxc -s "$CONTAINER" \
--define "lxc.include=/var/lib/lxc/$CONTAINER/config.systemd_upstream" \
|| [ $? -eq 2 ]
;;
*)