From e0fb3ab18465cc32b1c803bd0b4bfc667a8d4980 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 24 Oct 2024 14:25:23 +0000 Subject: [PATCH] cgroupv1: abort the update if Flatcar version does not support it See: https://github.com/systemd/systemd/releases/tag/v256-rc3 See: https://github.com/flatcar/scripts/pull/2145 --- flatcar-postinst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/flatcar-postinst b/flatcar-postinst index 5ee639a..b6b8f40 100644 --- a/flatcar-postinst +++ b/flatcar-postinst @@ -244,6 +244,14 @@ if mountpoint -q /etc; then unshare -m sh -c "umount /etc && mkdir -p /etc/extensions && attr -R -r overlay.opaque /etc/extensions || true" fi +# Systemd version >= 256 does not boot anymore if cgroupv1 is enabled or SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1 is set +# See: https://github.com/systemd/systemd/releases/tag/v256-rc3 +MAX_NEXT_VERSION_ID=5000 +if [ "${NEXT_VERSION_ID%%.*}" -ge $MAX_NEXT_VERSION_ID && ! -f "/sys/fs/cgroup/cgroup.controllers" ]; then + echo "Flatcar version ${MAX_NEXT_VERSION_ID} or higher does not support cgroupv1 anymore. Aborting the update..." + exit +fi + # Keep old nodes on cgroup v1 if [[ "${BUILD_ID}" != "dev-"* ]]; then if [ "${VERSION_ID%%.*}" -lt 2956 ]; then