Repository navigation
initramfs: Require bootc-root-setup for initrd-root-fs.target - #2667
Merged
Merged
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Missing VM validation leaves unconfirmed whether root-setup failures block switch-root after locked-root emergency-shell exit or with rd.shell=0, and whether recovery retries work on supported dracut/systemd versions.
No open issues 🎉
What changed in this PR
This PR makes composefs root setup a required initramfs dependency, preventing boot from continuing into an unverified /sysroot when setup fails.
Changes:
- Changes the dracut dependency from
WantstoRequiresforbootc-root-setup.service. - Documents failure handling, emergency-shell behavior, and the
rd.shell=0option.
| File | Description |
|---|---|
| docs/src/man/bootc-root-setup.service.5.md | Documents setup failures, retries, and dracut emergency options. |
| docs/src/bootc-boot-failure-detection.7.md | Clarifies boot failure behavior and links to the service manual. |
| crates/initramfs/dracut/module-setup.sh | Installs the service under initrd-root-fs.target.requires. |
| crates/initramfs/bootc-root-setup.service | Adds comments explaining the required dependency; no functional unit changes. |
Review effort: Balanced
The dracut module linked bootc-root-setup.service into initrd-root-fs.target.wants, so a failure of the service did not fail the target. The failure isolates emergency.target, and dracut's emergency.service starts the default target again when the shell exits. On an image with root locked, sulogin returns at once, so with the default rd.shell the default target is started again and the service is retried. Once systemd's start rate limit (5 starts in 10 s by default) refuses a restart, the unit stays failed, OnFailure= does not fire again, and the boot goes on: initrd-root-fs.target is reached without the service, initrd-parse-etc.service runs, and the initramfs switches root into /sysroot without the composefs image ever having been mounted or verified. On a sealed image that defeats the guarantee the signed composefs digest is meant to give. Link the service into initrd-root-fs.target.requires instead. The service is already ordered before the target, so a failure now fails the target, including a start refused by the rate limit, since start failure propagates to units that require the failed unit. initrd-parse-etc.service, whose OnSuccess= is the only way to initrd-cleanup.service and switch-root in a systemd initramfs, requires the target, so switch-root cannot happen until the service has succeeded. Starting the default target again after the emergency shell retries the service rather than skipping it. Document the behaviour on failure, including that rd.shell=0 makes dracut power off (or follow rd.emergency=) instead of offering a shell. Tested by hand: a dracut initramfs built with the module now carries initrd-root-fs.target.requires/bootc-root-setup.service and no .wants link. A stand-in reproduction under systemd 259, with units carrying the same dependencies as initrd-root-fs.target, initrd-parse-etc.service, initrd-cleanup.service and dracut's emergency.service, and a setup unit that always fails, confirmed that with the .wants link the boot can reach switch-root after the emergency shell, and that with the .requires link the target stays inactive and switch-root never runs. The rate-limit mechanism itself follows from source analysis of systemd. Not tested in a booted VM. Generated-by: AI Signed-off-by: Arsslen Idadi <[email protected]> Signed-off-by: Joseph Marrero Corchado <[email protected]>
jmarrero
force-pushed
the
initramfs-require-root-setup
branch
from
November 19, 2026 19:46
ea31a8e to
bff0d7d
Compare
gursewak1997
approved these changes
Nov 19, 2026
jmarrero
enabled auto-merge (rebase)
November 19, 2026 20:09
Merged
Johan-Liebert1
approved these changes
Nov 20, 2026
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 dracut module linked
bootc-root-setup.serviceintoinitrd-root-fs.target.wants, so a failure of the service did not fail the target. On a sealed composefs image with root locked, the emergency shell returns at once and the boot could continue to switch-root into an unverified/sysroot. Link the service intoinitrd-root-fs.target.requiresinstead, so a failure fails the target and switch-root cannot happen until the service has succeeded. Also document the failure behaviour, includingrd.shell=0.This is the fix from the temporary private fork for GHSA-9889-q45r-84v7, re-raised as a public PR because required status checks cannot run in advisory forks. The commit is cherry-picked unchanged from that fork and was already approved there by @cgwalters and me. Authored by Arsslen Idadi.