-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support flag file to runtime switch to cgroupv1 #35
Merged
Conversation
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
1 task
jepio
force-pushed
the
jepio/runtime-revert-to-cgroupv1
branch
2 times, most recently
from
February 21, 2022 12:12
abff4a8
to
4182225
Compare
1 task
pothos
reviewed
Feb 22, 2022
pothos
reviewed
Feb 22, 2022
jepio
changed the title
Jepio/runtime revert to cgroupv1
support flag file to runtime switch to cgroupv1
Feb 22, 2022
Pass a custom init commands (init.wrapper) to 'systemctl switch-root' when leaving the initramfs. This init.wrapper is responsible for disabling all cgroup controllers and unmounting cgroup2, and injecting (by means of a bind mount) custom kernel arguments so that sysroot systemd sets up cgroupv1. We're adding this so that Flatcar users don't have to reboot to switch back to cgroupv1, which is disruptive in many deployments. The usage of init.wrapper is conditional on two things: * initramfs used up cgroupv2. * user opted into to this behavior by creating the `/etc/flatcar-cgroupv1` flag file There is a reason to not go through init.wrapper unconditionally, and decide whether to take action-or-not there. When systemd runs in sysroot and initramfs, it serializes some data structures and passes them from the initramfs to allow some introspection. I believe this is primarily systemd-analyze timing information. This doesn't work when we inject a custom init between sysroot and initramfs (init.wrapper), so ensure we only use the custom init when we really need to. This is accomplished by passing the init.wrapper path through an INIT environment variable, which is only defined when '/etc/flatcar-cgroupv1' exists in the sysroot. An alternative would have been to conditionally symlink the override snippet, which would get applied in the 'systemctl daemon-reload' in 'initrd-parse-etc.service'. Neither option is particularly obvious, but this one seems slightly easier to follow.
…fault Moving controllers between cgroup v1 and v2 is difficult once they have been used. So create a system.conf.d snippet that sets the Default*Accounting=no so that moving controllers becomes possible.
jepio
force-pushed
the
jepio/runtime-revert-to-cgroupv1
branch
from
February 23, 2022 09:10
4182225
to
03f47d3
Compare
3 tasks
pothos
approved these changes
Feb 25, 2022
jepio
added a commit
to flatcar-archive/coreos-overlay
that referenced
this pull request
Mar 1, 2022
…ange This pulls in flatcar/bootengine#35 and flatcar/init#62, which enable boot time switching back to legacy cgroups by creating a flag files (/etc/flatcar-cgroupv1) from ignition.
jepio
added a commit
to flatcar-archive/coreos-overlay
that referenced
this pull request
Mar 1, 2022
…ange This pulls in flatcar/bootengine#35 and flatcar/init#62, which enable boot time switching back to legacy cgroups by creating a flag files (/etc/flatcar-cgroupv1) from ignition.
jepio
added a commit
to flatcar-archive/coreos-overlay
that referenced
this pull request
Mar 1, 2022
…ange This pulls in flatcar/bootengine#35 and flatcar/init#62, which enable boot time switching back to legacy cgroups by creating a flag files (/etc/flatcar-cgroupv1) from ignition.
jepio
added a commit
that referenced
this pull request
Mar 17, 2022
support flag file to runtime switch to cgroupv1
jepio
added a commit
to flatcar-archive/coreos-overlay
that referenced
this pull request
Mar 17, 2022
…ange This pulls in flatcar/bootengine#35 and flatcar/init#62, which enable boot time switching back to legacy cgroups by creating a flag files (/etc/flatcar-cgroupv1) from ignition. Also contains the subsequent bugfix to coreos-init: c21ee83 "coreos-base/coreos-init: move processes to root cgroup before unbinding controllers"
t-lo
pushed a commit
to flatcar/scripts
that referenced
this pull request
Apr 13, 2023
…ange This pulls in flatcar/bootengine#35 and flatcar/init#62, which enable boot time switching back to legacy cgroups by creating a flag files (/etc/flatcar-cgroupv1) from ignition. Also contains the subsequent bugfix to coreos-init: c21ee83df0a2302c0b7cfa375a5f191c14800ec8 "coreos-base/coreos-init: move processes to root cgroup before unbinding controllers"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
support flag file to runtime switch to cgroupv1
The idea is to detect the presence of a flag file (
/etc/flatcar-cgroupv1
), to callsystemctl switch-root
withinit.wrapper
as an argument.init.wrapper
takes care of unmounting the currently mounted cgroup after initramfs, allowing sysroot systemd to remount cgroupv1.The detection is done at the end of initrd-parse-etc.service, and the parameters are passed to initrd-switch-root.service through a temporary environment file.
How to use
To be used with flatcar/init#62.
Testing done
changelog/
directory (user-facing change, bug fix, security fix, update)