forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In f31, the default cgroup changed to v2. However, we've decided to stay on v1 for the time being. Thus, we don't want older nodes upgrading to f31 to be forced into v2. Add a tiny service which just scans the BLS configs and injects the `systemd.unified_cgroup_hierarchy` karg as needed. For more information, see: coreos/fedora-coreos-tracker#292 coreos/fedora-coreos-streams#26 (comment)
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
overlay.d/90cgroups/usr/lib/systemd/system/coreos-keep-cgroup-v1.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=CoreOS Keep CGroups v1 | ||
Documentation=https://github.com/coreos/fedora-coreos-tracker/issues/292 | ||
RequiresMountsFor=/boot | ||
# Note we don't conditionalize on ConditionKernelCommandLine= here because the | ||
# kernel arg might've been added manually just for this boot; we still want to | ||
# change the BLS entries in that case. | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/libexec/coreos-keep-cgroup-v1 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
for f in /boot/loader/entries/*.conf; do | ||
options=$(grep '^options ' "$f" | cut -f2- -d' ') | ||
|
||
# If it's already specified, don't touch whatever value is there. That way, | ||
# users that purposely opted into v2 early keep it. It also makes this | ||
# script idempotent. | ||
if grep -q "systemd.unified_cgroup_hierarchy" <<< "$options"; then | ||
continue | ||
fi | ||
|
||
# otherwise, make sure we stay on v1 | ||
sed -e "/^options / s/$/ systemd.unified_cgroup_hierarchy=0/" -i "$f" | ||
echo "$(basename "$f"): injected systemd.unified_cgroup_hierarchy=0" | ||
done |