Skip to content

lib: Fix bootc status on non-bootc systems#1851

Merged
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:status-outside-container
Dec 14, 2025
Merged

lib: Fix bootc status on non-bootc systems#1851
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:status-outside-container

Conversation

@cgwalters
Copy link
Collaborator

Previously, BootedStorage::new() unconditionally tried to open /sysroot before checking the environment type. This caused bootc status to fail on non-ostree/composefs systems.

(We did work in containers and we had tests for that; but
the container case is special cased even earlier)

Fixes: https://issues.redhat.com/browse/RHEL-135687

Assisted-by: Claude Code (Opus 4.5)

Previously, `BootedStorage::new()` unconditionally tried to open
`/sysroot` before checking the environment type. This caused
`bootc status` to fail on non-ostree/composefs systems.

(We did work in containers and we had tests for that; but
 the container case is special cased even earlier)

Fixes: https://issues.redhat.com/browse/RHEL-135687

Assisted-by: Claude Code (Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
@bootc-bot bootc-bot bot requested a review from ckyrouac December 12, 2025 20:35
Copy link
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 correctly fixes an issue where bootc status would fail on non-bootc systems. The change refactors the code to only attempt opening /sysroot when on a bootc-managed system, which is the right approach. The addition of a new integration test to verify the fix in a simulated non-bootc environment is excellent. Overall, this is a solid improvement. I have one minor suggestion to improve the documentation for the new helper function to make its side-effects clearer for future maintainability.

Composefs(BootedComposefs),
}

/// Open the physical root (/sysroot) and /run directories for a booted system.
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The new helper function get_physical_root_and_run has an important side effect of remounting /sysroot as read-write. The current documentation doesn't mention this. It would be beneficial for future maintenance to make this explicit in the doc comment, and also to note the precondition that this should only be called within a private mount namespace to ensure system stability.

/// Open the physical root (/sysroot) and /run directories for a booted system,
/// remounting /sysroot as read-write.
///
/// This function should only be called inside a private mount namespace.

Copy link
Contributor

Choose a reason for hiding this comment

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

open_dir_remount_rw(&d, ".".into())?

was there in the original code I don't think this is right.

@cgwalters cgwalters enabled auto-merge (rebase) December 12, 2025 21:24
Copy link
Contributor

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

lgtm

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