initrd-setup-root: Clean up whiteout entries for files to be recreated#79
Merged
pothos merged 1 commit intoflatcar-masterfrom Nov 30, 2023
Merged
initrd-setup-root: Clean up whiteout entries for files to be recreated#79pothos merged 1 commit intoflatcar-masterfrom
pothos merged 1 commit intoflatcar-masterfrom
Conversation
201d973 to
0bcd405
Compare
2 tasks
krnowak
approved these changes
Nov 30, 2023
Member
Author
|
Tested with flatcar/mantle#488 |
The removal of files in the overlay present in the lowerdir creates whiteout entries that mask the lowerdir entries. For those files that have a tmpfile rule for creation, a reboot would cause the file to be created in the upperdir, meaning this file is not updated from the lowerdir when it changes. In addition we have filtered out some tmpfile rules that caused upcopies (symlinks and directories) which meant that removing the /etc/resolv.conf symlink didn't bring it back after reboot. To make files from the lowerdir show up if they have a tmpfile rule that normally would recreate them we keep a list of whiteout entries that we clean up on boot. This also prevents freezing files because systemd-tmpfiles does not need to recreate them in the upperdir.
0bcd405 to
4b44a62
Compare
This file contains hidden or 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
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.
The removal of files in the overlay present in the lowerdir creates whiteout entries that mask the lowerdir entries. For those files that have a tmpfile rule for creation, a reboot would cause the file to be created in the upperdir, meaning this file is not updated from the lowerdir when it changes. In addition we have filtered out some tmpfile rules that caused upcopies (symlinks and directories) which meant that removing the /etc/resolv.conf symlink didn't bring it back after reboot. To make files from the lowerdir show up if they have a tmpfile rule that normally would recreate them we keep a list of whiteout entries that we clean up on boot. This also prevents freezing files because systemd-tmpfiles does not need to recreate them in the upperdir.
How to use
Backport to Stable
Testing done
Removal of
/etc/resolv.confand reboot brings it back.Note that not all files have a tmpfiles rule, e.g.,
sshd_confighas not. We could identify files like that which need to exist for a working system by runningrm -rf /etc/*and rebooting.This is different from the removal of
/etccontents afterumount /etcwhich works without a problem and brings all files back.changelog/directory (user-facing change, bug fix, security fix, update)/bootand/usrsize, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.