Skip to content

Commit

Permalink
Merge pull request #35 from flatcar-linux/jepio/runtime-revert-to-cgr…
Browse files Browse the repository at this point in the history
…oupv1

Support flag file to switch to cgroupv1 at boot time.
  • Loading branch information
jepio authored Mar 1, 2022
2 parents dac35d0 + 03f47d3 commit d586e78
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dracut/99switch-root/initrd-parse-etc-override.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
ExecStartPost=-/bin/sh -c "[ -f /sys/fs/cgroup/cgroup.subtree_control ] && [ -f /sysroot/etc/flatcar-cgroupv1 ] && echo INIT=/sbin/init.wrapper >/etc/switch-root.env"
16 changes: 16 additions & 0 deletions dracut/99switch-root/module-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

depends() {
echo systemd
}

install() {
inst_simple "${moddir}/override.conf" \
"${systemdsystemunitdir}/initrd-switch-root.service.d/override.conf"
inst_simple "${moddir}/initrd-parse-etc-override.conf" \
"${systemdsystemunitdir}/initrd-parse-etc.service.d/override.conf"
inst_simple "${moddir}/nocgroup.conf" \
"/etc/systemd/system.conf.d/nocgroup.conf"
}
7 changes: 7 additions & 0 deletions dracut/99switch-root/nocgroup.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Manager]
DefaultCPUAccounting=no
DefaultIOAccounting=no
DefaultIPAccounting=no
DefaultBlockIOAccounting=no
DefaultMemoryAccounting=no
DefaultTasksAccounting=no
6 changes: 6 additions & 0 deletions dracut/99switch-root/override.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Service]
Type=oneshot
Environment=INIT=
EnvironmentFile=-/etc/switch-root.env
ExecStart=
ExecStart=systemctl --no-block switch-root /sysroot $INIT

0 comments on commit d586e78

Please sign in to comment.