Skip to content

Filter out BLS entries not managed by bootc#2243

Open
Dudecake wants to merge 3 commits into
bootc-dev:mainfrom
Dudecake:filter-custom-bls-entries
Open

Filter out BLS entries not managed by bootc#2243
Dudecake wants to merge 3 commits into
bootc-dev:mainfrom
Dudecake:filter-custom-bls-entries

Conversation

@Dudecake

Copy link
Copy Markdown

Fixes #2228

The cases that the tests in the last commit check cannot occur anymore because of the changes in get_sorted_type1_boot_entries_helper. If they're unneeded, I can drop the commit.

@bootc-bot bootc-bot Bot requested a review from jeckersb June 10, 2026 12:59
@Dudecake Dudecake force-pushed the filter-custom-bls-entries branch from dba7de3 to 9ade58e Compare June 10, 2026 13:08

@Johan-Liebert1 Johan-Liebert1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This would work, but only for the first boot, and will probably fail on updates and switches as these entries won't be copied to the staged directory.

pub(crate) const UKI_NAME_PREFIX: &str = TYPE1_BOOT_DIR_PREFIX;

/// The prefix for BLS file entries
pub(crate) const BLS_ENTRY_PREFIX: &str = "bootc_";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We have TYPE1_BOOT_DIR_PREFIX for this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I didn't want to change that from bootc_composefs- -> bootc_ as it's used in other places. The format the BLS entry seems to follow is bootc_${ID}-${verity}-${index}.conf, though maybe I've misunderstood what the BLS entry is...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't need this anymore?

@Dudecake

Copy link
Copy Markdown
Author

This would work, but only for the first boot, and will probably fail on updates and switches as these entries won't be copied to the staged directory.

Sad face. That makes this pretty useless as installing to a populated ESP works without issue, only bootc status and bootc update are broken.

Would the caller of list_type1_entries have to filter out these entries before calling get_verity on them?

@Johan-Liebert1

Copy link
Copy Markdown
Collaborator

Would the caller of list_type1_entries have to filter out these entries before calling get_verity on them?

yes, and these need special treatment for updates/switches. Also, we need to make sure these appear last in the boot entries list etc etc. There are a few more cases that need to be handled

@Dudecake Dudecake marked this pull request as draft June 11, 2026 04:46
@Dudecake Dudecake force-pushed the filter-custom-bls-entries branch from 9ade58e to 80be97c Compare June 22, 2026 06:47
@Dudecake

Copy link
Copy Markdown
Author

I've been looking at this last- and previous weekend and attempting to have the caller filter these entries out would require a lot of changes as the original filename isn't included in the return value of list_type1_entries.

Creating unique filenames for entries using the same efi argument would be possible (but quite annoying) by also putting the title and/or options in the filename, so instead in create_staged_bls_entries copies any non-managed BLS entry to the staging directory.

@Dudecake Dudecake marked this pull request as ready for review June 22, 2026 12:08
@bootc-bot bootc-bot Bot requested a review from henrywang June 22, 2026 12:09
@Johan-Liebert1 Johan-Liebert1 added the ci/tier-1 Run CI for tier-1 OS (centos-10) only label Jun 22, 2026

@Johan-Liebert1 Johan-Liebert1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

State resilience test seems to be failing with

                        content: Error:   x Assertion failed.
                        content:     ,-[/var/tmp/tmt/bootc-tmt-mldew2as-tmt-plans-integration-plan-45-composefs-corruped-state-resilience/tmt/plans/integration/plan-45-composefs-corruped-state-resilience/discover/default-0/tests/tmt/tests/booted/test-composefs-corruped-state-resilience.nu:51:12]
                        content:  50 |     
                        content:  51 | ,->     assert (
                        content:  52 | |           journalctl F_MESSAGE_ID=d264f924dadb4c31bff0412107d391fb
                        content:  53 | |           | str contains $"No origin file for deployment bad-verity"
                        content:  54 | |->     )
                        content:     : `---- It is not true.
                        content:  55 |     
                        content:     `----

This is because we log a journal message when we encounter an entry that bootc doesn't own (doesn't start with our prefix). I think it's better now to change this error message as we are handling these entries

}

let original_entries = boot_dir.open_dir(TYPE1_ENT_PATH)?;
for entry in original_entries.entries()? {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can use entries_utf8 to avoid to_string_lossy below

pub(crate) const UKI_NAME_PREFIX: &str = TYPE1_BOOT_DIR_PREFIX;

/// The prefix for BLS file entries
pub(crate) const BLS_ENTRY_PREFIX: &str = "bootc_";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't need this anymore?

let entry = entry?;
let entry_name = entry.file_name();
if entry.file_type()?.is_file() && !entry_name.to_string_lossy().starts_with(BLS_ENTRY_PREFIX) {
original_entries.copy(entry.file_name(), &staged_entries, entry_name)?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Error context would be nice here

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

Labels

ci/tier-1 Run CI for tier-1 OS (centos-10) only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding custom BLS entry blocks most bootc operations

2 participants