Skip to content

composefs: Backwards compatibility#2128

Closed
Johan-Liebert1 wants to merge 4 commits intobootc-dev:mainfrom
Johan-Liebert1:backwards-compat
Closed

composefs: Backwards compatibility#2128
Johan-Liebert1 wants to merge 4 commits intobootc-dev:mainfrom
Johan-Liebert1:backwards-compat

Conversation

@Johan-Liebert1
Copy link
Copy Markdown
Collaborator

composefs/boot: Get os_id from mounted EROFS

Instead of reading the in memory filesystem to get /usr/lib/os-release
get it from the mounted EROFS. This is also prep for providing backwards
compatibility due to our newly introduced prefix bootc_composefs-
where we'll need to create new boot entries and we can get the os_id
from the mounted root


composefs: Handle backwads compatibility with older versions

While finishing up GC, we had come up with the idea of prepending our
boot binaries (UKI PEs, BLS directories) with a certain prefix and we
ended up hard requiring these prefixes.

If someone has an older version of bootc which they used to install
their system with, then upgrade to a new version, many if not all of the
important operations would cease to work.

This basically handles the backwards compatibility of new binaries on
older systems by prepending our custom prefix to all existing boot binaries


composefs: Check for meta.json

Check if the repo has meta.json file and if not apply our fix of
prepending custom prefix to our bootloader entries and boot binaries


Since we depend on the existence of meta.json in the composefs repo, we need #2044 first. After that's merged, we'll need to update the underlying repo and add some tests

Instead of reading the in memory filesystem to get /usr/lib/os-release
get it from the mounted EROFS. This is also prep for providing backwards
compatibility due to our newly introduced prefix `bootc_composefs-`
where we'll need to create new boot entries and we can get the `os_id`
from the mounted root

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@bootc-bot bootc-bot bot requested a review from jmarrero April 7, 2026 09:32
Copy link
Copy Markdown
Contributor

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

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 introduces a backward compatibility layer to migrate existing boot entries, including EFI binaries and BLS configurations, to a new naming convention using a custom prefix. The migration is automatically triggered during storage initialization when a legacy system state is detected. Review feedback identifies critical logic errors in the staging of BLS and GRUB entries where existing prefixed entries are inadvertently excluded, which would result in data loss. Furthermore, the rollback mechanism for failed renames incorrectly utilizes EXCHANGE flags for files that have already been moved, and the integration of the migration logic into the core storage initialization path is flagged as a potential stability risk that could make the tool unusable upon failure.

Comment on lines +229 to +233
if meta_json.is_none() {
let cmdline = composefs_booted()?
.ok_or_else(|| anyhow::anyhow!("Could not get booted composefs cmdline"))?;
prepend_custom_prefix(&storage, &cmdline).await?;
}
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.

medium

Triggering a potentially heavy and risky filesystem operation like prepend_custom_prefix inside BootedStorage::new is quite aggressive. Since BootedStorage::new is called at the start of almost every bootc command (including status), any failure during the prefix migration (e.g., due to an unexpected file in the ESP or a transient I/O error) will make the bootc tool completely unusable for the user. Consider logging a warning on failure instead of returning an error, or restricting this migration to specific operations like upgrade.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this is a point of contention on where this operation should be performed

While finishing up GC, we had come up with the idea of prepending our
boot binaries (UKI PEs, BLS directories) with a certain prefix and we
ended up hard requiring these prefixes.

If someone has an older version of bootc which they used to install
their system with, then upgrade to a new version, many if not all of the
important operations would cease to work.

This basically handles the backwards compatibility of new binaries on
older systems by prepending our custom prefix to all existing boot binaries

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Check if the repo has meta.json file and if not apply our fix of
prepending custom prefix to our bootloader entries and boot binaries

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@cgwalters
Copy link
Copy Markdown
Collaborator

Some potential conflicts here with #2044

One thing I think would clearly really help is standing up some mocked-unit testing for the boot layout. I have some PoC code incoming

@cgwalters
Copy link
Copy Markdown
Collaborator

@Johan-Liebert1 can you look at squashing in https://github.com/cgwalters/bootc/tree/composefs-gc-tests ?

@Johan-Liebert1
Copy link
Copy Markdown
Collaborator Author

Some potential conflicts here with #2044

That's okay. We need #2044 first anyway

Add some basic infra to mock up enough of an installed root
to use in unit tests - specifically targeted for the bootloader
logic.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters
Copy link
Copy Markdown
Collaborator

OK I rolled the commits here into #2044

@cgwalters cgwalters closed this Apr 8, 2026
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.

2 participants