-
Notifications
You must be signed in to change notification settings - Fork 9
setup-root: Create overlay mount for /etc to provide files from /usr #53
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
Conversation
The existing tmpfile logic took care of folders that the ebuild keepdir directive wanted to exist on the OS. However, files and symlinks were not created, causing them to be missing if we didn't explicitly modify the ebuild files in coreos-overlay to use tmpfiles or patching of paths to be in /usr. We need a logic to provide /etc files from the current /usr partition without getting stale. This can be done best with an overlay mount which requires to keep the original /etc files under /usr. Set up an overlay mount from the initrd after basic root fs preparation (ensure that the user db and machine-id file are as expected and create non-/etc tmpfiles). What we get with an overlay mount is essentially a similar behavior to a 3-way merge because as long as the user didn't change the files, the old version is replaced with the new version and as soon as the user did changes, that file is frozen and wins over the provided old (in case of a rollback) or new versions from /usr. It does not work on file lines but on whole file contents, yet that is also what rpm-ostree does to my knowledge.
If the syscfg feature turns out to provide something similar, we can migrate - i.e. drop the custom mount command again and turn |
This pulls in flatcar/bootengine#53 to provide files in /etc through an overlay mount from /usr/share/flatcar/etc - essentially giving us a 3-way merge of config files that allows us to update /etc while keeping user changes.
I now see that the arm64 qemu test for Edit: Looks like a race condition, even - either in the check or the test or in the real behavior. |
Yes, we can review these downstream symlinks and config path changes and make use of |
This pulls in flatcar/bootengine#53 to provide files in /etc through an overlay mount from /usr/share/flatcar/etc - essentially giving us a 3-way merge of config files that allows us to update /etc while keeping user changes.
Maybe it's better to add the boot cleanup action to duplicate files in a follow-up. This is ready to review now. Here the list of contents that get upcopied/modified after boot as of now (
This is mostly expected (e.g., the user/group files get managed by flatcar-tmpfiles), odd cases are just things like udev where the 12 MB bin file gets copied over on each boot. I consider the goal of not getting slowly-outdated config files as reached. |
This pulls in flatcar/bootengine#53 to provide files in /etc through an overlay mount from /usr/share/flatcar/etc - essentially giving us a 3-way merge of config files that allows us to update /etc while keeping user changes.
This pulls in flatcar/bootengine#53 to provide files in /etc through an overlay mount from /usr/share/flatcar/etc - essentially giving us a 3-way merge of config files that allows us to update /etc while keeping user changes.
The existing tmpfile logic took care of folders that the ebuild keepdir directive wanted to exist on the OS. However, files and symlinks were not created, causing them to be missing if we didn't explicitly modify the ebuild files in coreos-overlay to use tmpfiles or patching of paths to be in /usr. We need a logic to provide /etc files from the current /usr partition without getting stale. This can be done best with an overlay mount which requires to keep the original /etc files under /usr.
Set up an overlay mount from the initrd after basic root fs preparation (ensure that the user db and machine-id file are as expected and create non-/etc tmpfiles). What we get with an overlay mount is essentially a similar behavior to a 3-way merge because as long as the user didn't change the files, the old version is replaced with the new version and as soon as the user did changes, that file is frozen and wins over the provided old (in case of a rollback) or new versions from /usr. It does not work on file lines but on whole file contents, yet that is also what rpm-ostree does to my knowledge.
How to use
Follow-up: I would like to add a boot cleanup action before setting up the mount, and it should remove duplicate files to keep the
/etc
folder clean and actually make use of the up-to-date lower files from/usr/share/flatcar/etc
. ← But not a blocker from my point of viewFollow-up (mantle repo): Write a kola test that checks for unexpected upcopies (for now I did manual checks)
Follow-up: We should identify what downstream modifications in
coreos-overlay
we can drop now to have config files in/etc
for legacy software.Note: We should find out why systemd-tmpfiles causes upcopies for
L
andC
entries and see if we can avoid it - maybe even upstream. For now I committed a change in the scripts repo to drop some rules after we used them to create/usr/share/flatcar/etc
via ased -i '/^[CLd] *\/etc\//d' /usr/lib/tmpfiles.d/*
but it would be nice to fix this upstream.Testing done
Jenkins kola tests passed, locally I checked the contents by mounting the image after a boot.