Skip to content

composefs: Report failed finalization on the next boot - #80

Draft
cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-41306252221
Draft

cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-41306252221

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Collaborator

A shutdown finalization error should not disappear into the previous boot's journal while the following boot looks successful. Persist its diagnostic and report it once through a composefs-only bootc-boot-complete.service, required and ordered before boot-complete.target so failure also prevents consumers such as systemd-bless-boot.service from blessing the boot. The check is inactive without a failure stamp and does not enable boot counting or automatic rollback.

Use /boot, as OSTree does, with the existing persistent /sysroot/boot layout when /boot is not mounted; the image's unmounted /boot is read-only. Successful finalization clears the stamp; reporting renames it to .previous. Reads and stored diagnostics are bounded to 16 KiB. The unit is installed by the existing systemd wildcard and enabled by the composefs generator. No production failure-injection option is added.

The registered three-boot TMT test stages a derived image, externally renames the staged deployment's etc directory to etc.saved after preflight, then checks the old deployment, failed service and diagnostic, and unreached boot-complete.target. A further reboot must be clean. The test explicitly pulls the passive target into the boot transaction, including on GRUB.

Verification

Final checks and exit status:

  • cargo test -p bootc-lib failure_stamp --lib: 0 (3 tests).
  • cargo test -p bootc-lib boot_complete_required_dependency --lib: 0.
  • cargo test -p bootc-lib --lib --quiet: 0 (337 passed, 1 ignored).
  • cargo xtask update-generated direct: 0; cargo xtask update-generated direct --check: 0.
  • PATH=/tmp/opencode/rustfmt/usr/lib/rust-1.93/bin:$PATH cargo fmt --all: 0; the same command with --check: 0.
  • git diff --check: 0.
  • just validate: 1; generated metadata check passed, but container setup could not reach the sandbox's loopback proxy to download CentOS repository metadata. Container clippy/man/schema validation did not run.
  • just unit-tests: 1; blocked by the same container setup failure. The host library suite above passed, but this is not a passing container unit suite.
  • cargo xtask run-tmt --env=BOOTC_variant=composefs --filesystem=ext4 --boot-type=bls --seal-state=unsealed localhost/bootc composefs-finalize-failure: 1; bcvk is missing, and tmt is also unavailable. The VM/reboot test did not run.
  • systemd-analyze verify systemd/bootc-boot-complete.service: 1; this host lacks /usr/bin/bootc and its man page.

Early development checks caught and corrected a buffered-writer API error, an include path error, and directory fsync on an O_PATH descriptor. The initial host fmt attempt was unavailable; formatting subsequently used an extracted distribution rustfmt package.

Review: two passes; the first found an unmounted-/boot blocker and an enablement-test gap, both fixed; the final delta review left no blockers or follow-ups. Human review and an actual rebooting test remain required.

Deferred documentation text

No man pages are changed because the boot failure detection page is being revised separately. Proposed replacement for the composefs Key Services discussion in docs/src/bootc-boot-failure-detection.7.md:

bootc-finalize-staged.service finalizes staged composefs deployments during shutdown. If finalization returns an error, bootc saves its diagnostic in /boot/bootc-finalize-failure.stamp, or in /sysroot/boot/bootc-finalize-failure.stamp when /boot is not mounted. A successful finalization removes a stale stamp. On the next composefs boot, bootc-boot-complete.service runs when boot-complete.target is requested and a stamp exists. It reports the saved error and recommends journalctl -b -1 -u bootc-finalize-staged.service, then fails. Because boot-complete.target requires the service and is ordered after it, the target cannot be reached in that transaction and consumers requiring successful boot completion cannot bless that boot. The stamp is renamed with a .previous suffix, so the diagnostic is reported once rather than failing every subsequent boot. Failure to persist or consume the stamp can prevent this one-shot behavior. This detects returned shutdown finalization errors, not every interrupted shutdown or early-boot failure, and does not configure boot counting or automatic rollback.

Proposed replacement for the boot-complete/boot-counting bullet in docs/src/bootc-composefs.7.md, Limitations:

The composefs backend reports shutdown finalization errors once on the next boot through bootc-boot-complete.service when boot-complete.target is requested. It does not configure boot counting or automatic rollback; see boot failure detection.

Target: draft PR in cgwalters-forge/bootc against its default branch, forge. No upstream changes or comments.

Closes #65

Generated by dispatch · ◷

A shutdown finalization error is easy to miss in the previous boot's
journal. Report it once on the next boot and prevent boot-complete.target
from being reached, without enabling boot counting or rollback.

Host tests pass; main has the same crun failure and missing bcvk.

Generated-by: https://github.com/cgwalters/#llms
@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

The poll stopped following this pull request: a draft with no checkpoint; mark it ready if the work is complete. It is labelled needs-human; remove the label to have the poll start again on it, with fresh fix rounds.

Generated-by: https://github.com/cgwalters/#llms

@cgwalters-bot

cgwalters-bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Rebase round 1 of 2 for c82f7add6486: run.

Generated-by: https://github.com/cgwalters/#llms

@cgwalters-bot

cgwalters-bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

✅ dispatch ended well. Result: #80

@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

Fix run report:

One independent review found no rebase regression but confirmed that a normal boot may never request boot-complete.target, leaving the failure unreported.

{"schema":"agent-board/recommendation/v1","pr":80,"head":"58e745cc4c7893c782cbc9b6abdcf6b56226960b","action":"operator_question","reason":"The original feature only reports errors when boot-complete.target is requested; resolving that behavior is outside this rebase.","detail":{"question":"Should the check run on ordinary composefs boots, or should the proposal explicitly limit reporting to boot-completion consumers?"}}

Generated-by: https://github.com/cgwalters/#llms

Generated by dispatch · ◷

@cgwalters-bot
cgwalters-bot force-pushed the dispatch/implement/agent-run-41306252221 branch from c82f7ad to 58e745c Compare December 2, 2026 00:26
@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

✅ dispatch ended well. Result: #80

@cgwalters-bot

cgwalters-bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Rebase round 2 of 2 for 58e745cc4c78: run.

Generated-by: https://github.com/cgwalters/#llms

@cgwalters-bot
cgwalters-bot force-pushed the dispatch/implement/agent-run-41306252221 branch from 58e745c to c598571 Compare December 2, 2026 21:50
@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

Fix run report:

Rebased onto 15f9f67 as a single commit (dropping the fork-only accept-owner-branches commit, which this hand-back cannot carry), keeping both the new LogBoot and ComposefsBootComplete internals arms and regenerating the tmt plan for main's Packit skip; one review pass found no blocker, leaving open that boot-complete.target is only pulled in when something requests it, stamp-consume failure handling, aboot gating on storage-load failure, and the stamp location on systemd-boot.

Generated by dispatch · ◷

@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

✅ dispatch ended well. Result: #80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:deep Bot draft that needs a real review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant