Skip to content

composefs/upgrade: Remove existing staged entries - #1861

Merged
Johan-Liebert1 merged 1 commit into
bootc-dev:mainfrom
Johan-Liebert1:upgrade-staged-fix
Dec 18, 2025
Merged

Johan-Liebert1 merged 1 commit into
bootc-dev:mainfrom
Johan-Liebert1:upgrade-staged-fix

Conversation

@Johan-Liebert1

Copy link
Copy Markdown
Member

When upgrading, switching if there is already a staged directory for bootloader entries, then delete it as we would overwrite it anyway

Fixes: #1857

@bootc-bot
bootc-bot Bot requested a review from ckyrouac December 17, 2025 07:24

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds logic to remove an existing staged bootloader entries directory during an upgrade. The change is correct in principle, but I've identified a potential race condition and suggested a more robust implementation that also improves code clarity.

Comment thread crates/lib/src/bootc_composefs/boot.rs Resolved
@henrywang

Copy link
Copy Markdown
Collaborator

testing-farm:fedora-rawhide failure has been fixed by PR #1856.

@Johan-Liebert1

Copy link
Copy Markdown
Member Author

Thanks, I'll rebase and push again

@cgwalters cgwalters left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK as is but gemini's suggestion would be nice to apply

@Johan-Liebert1
Johan-Liebert1 enabled auto-merge (rebase) December 18, 2025 04:35
@Johan-Liebert1

Copy link
Copy Markdown
Member Author

Applied Gemini's suggested change

@henrywang

Copy link
Copy Markdown
Collaborator

Failure has been fixed by PR #1867. This PR needs a rebase. Thanks.

When upgrading, switching if there is already a staged directory for
bootloader entries, then delete it as we would overwrite it anyway

Fixes: bootc-dev#1857

Signed-off-by: Pragyan Poudyal <[email protected]>
@Johan-Liebert1
Johan-Liebert1 merged commit fa1726b into bootc-dev:main Dec 18, 2025
krissedout added a commit to krissedout/bootc that referenced this pull request Nov 10, 2026
Staging a UKI wrote its entries into loader/entries.staged next to
whatever an earlier staged deployment left there. An entry's file name
carries the version from the UKI's os-release, so staging an image of
another version over a staged one kept the earlier entry. Status then
found a deployment that was neither staged nor rollback, garbage
collection removed its image while its entry and state directory
stayed, and from then on status failed to open the manifest. Upgrade,
switch and finalization all go through status, so the system was stuck
on the booted deployment, and rebooting didn't help.

Remove the staged entries before writing the new ones, as
setup_composefs_bls_boot() has done since bootc-dev#1861.

Assisted-by: AI
Signed-off-by: Kristof Imeri <[email protected]>
Johan-Liebert1 pushed a commit that referenced this pull request Nov 11, 2026
Staging a UKI wrote its entries into loader/entries.staged next to
whatever an earlier staged deployment left there. An entry's file name
carries the version from the UKI's os-release, so staging an image of
another version over a staged one kept the earlier entry. Status then
found a deployment that was neither staged nor rollback, garbage
collection removed its image while its entry and state directory
stayed, and from then on status failed to open the manifest. Upgrade,
switch and finalization all go through status, so the system was stuck
on the booted deployment, and rebooting didn't help.

Remove the staged entries before writing the new ones, as
setup_composefs_bls_boot() has done since #1861.

Assisted-by: AI
Signed-off-by: Kristof Imeri <[email protected]>
krissedout added a commit to krissedout/bootc that referenced this pull request Nov 11, 2026
setup_composefs_bls_boot() and write_systemd_uki_config() each had
their own copy of writing a deployment's Type 1 entry: into
loader/entries on install, or, when staging, into a fresh
loader/entries.staged next to the booted deployment's entry. The UKI
copy only started clearing the earlier staged entries in bootc-dev#2630, after
the BLS one had done so since bootc-dev#1861.

Move it into write_type1_entries(), which both now call, so the two
can't drift apart again. It also fsyncs the entries directory it wrote
to for UKIs too, where it used to fsync the ESP's root.

Assisted-by: AI
Signed-off-by: Kristof Imeri <[email protected]>
cgwalters pushed a commit that referenced this pull request Nov 13, 2026
setup_composefs_bls_boot() and write_systemd_uki_config() each had
their own copy of writing a deployment's Type 1 entry: into
loader/entries on install, or, when staging, into a fresh
loader/entries.staged next to the booted deployment's entry. The UKI
copy only started clearing the earlier staged entries in #2630, after
the BLS one had done so since #1861.

Move it into write_type1_entries(), which both now call, so the two
can't drift apart again. It also fsyncs the entries directory it wrote
to for UKIs too, where it used to fsync the ESP's root.

Assisted-by: AI
Signed-off-by: Kristof Imeri <[email protected]>
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.

bootc upgrade stacks bootloader entries in entries.staged (composefs) (systemd-boot)

3 participants