Skip to content

Comments

initrd-setup-root: Clean up whiteout entries for files to be recreated#79

Merged
pothos merged 1 commit intoflatcar-masterfrom
kai/overlay-whiteouts
Nov 30, 2023
Merged

initrd-setup-root: Clean up whiteout entries for files to be recreated#79
pothos merged 1 commit intoflatcar-masterfrom
kai/overlay-whiteouts

Conversation

@pothos
Copy link
Member

@pothos pothos commented Nov 29, 2023

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.conf and reboot brings it back.

Note that not all files have a tmpfiles rule, e.g., sshd_config has not. We could identify files like that which need to exist for a working system by running rm -rf /etc/* and rebooting.
This is different from the removal of /etc contents after umount /etc which works without a problem and brings all files back.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@pothos
Copy link
Member Author

pothos commented Nov 30, 2023

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.
@pothos pothos force-pushed the kai/overlay-whiteouts branch from 0bcd405 to 4b44a62 Compare November 30, 2023 10:56
@pothos pothos merged commit 31d24b8 into flatcar-master Nov 30, 2023
@pothos pothos deleted the kai/overlay-whiteouts branch November 30, 2023 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants