systemd: serialize initrd root fsck with a drop-in - #18639
Draft
Pawel Winogrodzki (PawelWMS) wants to merge 1 commit into
Draft
systemd: serialize initrd root fsck with a drop-in#18639Pawel Winogrodzki (PawelWMS) wants to merge 1 commit into
Pawel Winogrodzki (PawelWMS) wants to merge 1 commit into
Conversation
Pawel Winogrodzki (PawelWMS)
force-pushed
the
pawelwi/fsck-device-lock-dropins
branch
from
August 27, 2026 20:07
5e559b8 to
838b384
Compare
Prevent udev from probing root filesystem metadata while fsck updates it. Ship a root-only systemd drop-in and helper in the initramfs. The helper derives the generated root device from its BindsTo dependency, acquires the whole-disk lock, and then runs systemd-fsck against that exact device. Keep the static non-initrd root path working by falling back to --backing=/ when the generated device dependency is absent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bb0e6716-4886-4e95-9efe-71dcde8687d6
Pawel Winogrodzki (PawelWMS)
force-pushed
the
pawelwi/fsck-device-lock-dropins
branch
from
August 27, 2026 21:49
838b384 to
ef51c07
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.
What
systemd-fsck-root.serviceexecution with a root-only lock helper.Why
The root filesystem check can update ext4 metadata while
systemd-udevdprobes the same disk. If udev observes metadata during that update, its filesystem probe can temporarily lose the filesystem UUID and remove the corresponding/dev/disk/by-uuidlink. The generated root mount then cannot resolve its device, and boot stops in the initramfs.systemd-udevdalready takes a shared whole-disk lock while probing. Running the root filesystem check under an exclusiveudevadm lockprevents those reads from overlapping the metadata update.How it works
Inside the initramfs,
systemd-fstab-generatorcreatessystemd-fsck-root.servicefor the exact root device. The generated unit includes a dependency such as:BindsTo=dev-disk-by\x2duuid-....deviceThe drop-in replaces the generated
ExecStartwithsystemd-fsck-root-device-lock. That single-purpose helper:BindsTo=property ofsystemd-fsck-root.service.dev-*.devicedependency./dev/...path.udevadm lock --device=<path>.systemd-fsck <path>while the lock is held.The same unit name also has a static non-initrd form. When no generated device dependency exists, the helper preserves that path by resolving the mounted root through
udevadm lock --backing=/and invoking argument-freesystemd-fsck.Initramfs integration
The systemd RPM installs
50-systemd-fsck-root-device-lock.confunder/usr/lib/dracut/dracut.conf.d. Azure Linux'sinitramfspackage already watches systemd updates and runsdracut --regenerate-all.During regeneration, dracut reads this configuration from the host filesystem and copies only these custom files into each initramfs:
Standard dracut modules already provide
systemctl,systemd-escape,udevadm, andsystemd-fsck.split-files.pygenerates file lists for systemd's RPM subpackages. Its one-line change excludes only the dracut-owned parent directory entries. The configuration file itself remains insystemd-udevand is installed on the final image.Scope
This change targets only the generated root filesystem check involved in the boot failure. It does not change separate
/usrchecks or instantiated checks for other filesystems. Draft #18640 demonstrates the alternative generator-layer implementation.Risk
systemctl show,systemd-escape, and dracut file inclusion.BindsTo=dependency.Verification
systemd-escape --unescape --path.install_itemsentries and exact staged source hashes.%checkchanges remain.