Skip to content

systemd: serialize generated initrd fsck device probes - #18640

Draft
Pawel Winogrodzki (PawelWMS) wants to merge 1 commit into
microsoft:3.0-devfrom
PawelWMS:pawelwi/systemd-fsck-device-lock
Draft

systemd: serialize generated initrd fsck device probes#18640
Pawel Winogrodzki (PawelWMS) wants to merge 1 commit into
microsoft:3.0-devfrom
PawelWMS:pawelwi/systemd-fsck-device-lock

Conversation

@PawelWMS

@PawelWMS Pawel Winogrodzki (PawelWMS) commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Temporary workaround

Important

This change is temporary until the upstream e2fsck: take flock(LOCK_EX) on whole-disk device during filesystem check patch is available and integrated into Azure Linux.

Remove this workaround as part of that integration. The outer udevadm lock and the proposed native e2fsck lock must not run together: each opens the whole disk independently, so e2fsck can block waiting for the lock held by its waiting parent and deadlock boot.

What

  • Patch systemd-fstab-generator so generated initrd root and /usr filesystem checks run through udevadm lock.
  • Use the exact generated device path for lock acquisition and systemd-fsck.
  • Update existing generator fixtures and add coverage for generated /usr filesystem checks.

Why

systemd-udevd can probe filesystem metadata while fsck is still updating it. Serializing the writer against udev's shared whole-disk lock prevents udev from observing transient metadata and removing filesystem identity links before the mount begins.

Scope

This option targets only generator-synthesized initrd systemd-fsck-root.service and systemd-fsck-usr.service units. Static root and instantiated post-switch-root checks remain unchanged. Draft #18639 explores the alternative root drop-in implementation.

Risk

  • The behavior is unconditional after the package upgrade and initramfs regeneration; rollback requires removing the patch and rebuilding the initramfs.
  • Lock acquisition has a hard 180-second ceiling; timeout prevents fsck from starting and fails the generated unit.
  • Root and /usr partitions on one physical disk serialize instead of checking concurrently.
  • This downstream source patch must be rebased when systemd changes the generator or fixtures.

Verification

  • Verified the corrected patch applies to the pristine systemd v255 source used by this package.
  • Updated all affected test-fstab-generator fixtures, including generated /usr coverage and the existing command-line /usr case.
  • Ran git diff --check.
  • Passed repository commit and push hooks.
  • Completed adversarial Advocate, Skeptic, and Architect review.
  • Previous CI built the package and exposed a missing expected fixture; the corrected generator test rerun is pending.

Prevent udev from probing filesystem metadata while initrd fsck updates it.

Temporarily wrap generated root and /usr checks with udevadm lock. Update
all affected fstab-generator fixtures, including the existing command-line
/usr case.

Remove this workaround when native e2fsprogs whole-disk locking is
integrated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bb0e6716-4886-4e95-9efe-71dcde8687d6
@PawelWMS
Pawel Winogrodzki (PawelWMS) force-pushed the pawelwi/systemd-fsck-device-lock branch from e73eb17 to 118c1be Compare August 27, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0-dev PRs Destined for AzureLinux 3.0 Packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant