Skip to content

image: Mount deployment image content - #2621

Open
ckyrouac wants to merge 10 commits into
bootc-dev:mainfrom
ckyrouac:feature/image-mount-api
Open

ckyrouac wants to merge 10 commits into
bootc-dev:mainfrom
ckyrouac:feature/image-mount-api

Conversation

@ckyrouac

@ckyrouac ckyrouac commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Opening this as a draft for an initial design review.


Expose paths from booted or staged deployment images through caller-owned read-only mounts. Keep image content and persistent /var ownership separate, and add explicit unmount and integration coverage.

Assisted-by: AI

@ckyrouac
ckyrouac requested a review from jmarrero November 2, 2026 17:14
@github-actions github-actions Bot added the area/documentation Updates to the documentation label Nov 2, 2026
@bootc-bot
bootc-bot Bot requested a review from henrywang November 2, 2026 17:14
@jmarrero jmarrero self-assigned this Nov 4, 2026
@jmarrero
jmarrero requested a balanced review from Copilot November 4, 2026 19:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical mount-handling defects expose deployment-local configuration, break the OSTree fallback on older kernels, and prevent unmounting, while integration tests contain command errors and lack deterministic staged-image coverage.

5 open issues
What changed in this PR

Adds experimental access to booted or staged deployment image content through caller-owned read-only mounts, separate from persistent deployment state.

Changes:

  • Adds bootc image mount and unmount commands for OSTree and composefs deployments.
  • Adds path validation and mount restrictions while intentionally allowing execution.
  • Documents mount behavior and adds unit tests and an integration plan.
File Description
tmt/​tests/​tests.fmf Registers the image-mount integration test.
tmt/​tests/​booted/​test-64-image-mount.nu Tests mounted content, restrictions, execution, and cleanup.
tmt/​plans/​integration.fmf Adds the image-mount test plan.
docs/​src/​bootc-experimental-image.7.md Documents commands, backend selection, and mount semantics.
crates/​lib/​src/​lib.rs Registers the image-mount module.
crates/​lib/​src/​image_mount.rs Implements deployment selection, mounting, unmounting, and unit tests.
crates/​lib/​src/​cli.rs Adds and dispatches the new image subcommands.
crates/​initramfs/​src/​lib.rs Adds a helper for read-only mount restrictions.

Review effort: Balanced

Comment thread crates/lib/src/image_mount.rs Resolved
Comment thread crates/lib/src/image_mount.rs Resolved
Comment thread crates/lib/src/image_mount.rs Resolved
Comment thread tmt/tests/booted/test-64-image-mount.nu Resolved
Comment thread tmt/tests/booted/test-64-image-mount.nu Resolved

## Mounting deployment image content

`bootc image mount` exposes a path from the locally available booted or staged

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.

A lot of overlap with bootc install mount right? We should rationalize these two.

not initialize storage, migrate repository metadata, configure the ESP, or
change mount namespaces.

The mounted content is read-only, `nosuid`, and `nodev`. It intentionally

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.

Hmm, I'm not sure we need to enforce these type of mount options by default, but we should support -o or equivalent to specify

@ckyrouac
ckyrouac force-pushed the feature/image-mount-api branch from c998b14 to 26bc5ac Compare November 12, 2026 19:51
@ckyrouac ckyrouac added the ci/tier-1 Run CI for tier-1 OS (centos-10) only label Nov 12, 2026
@ckyrouac
ckyrouac marked this pull request as ready for review November 12, 2026 20:38
@bootc-bot
bootc-bot Bot requested a review from gursewak1997 November 12, 2026 20:38
@ckyrouac
ckyrouac force-pushed the feature/image-mount-api branch from 26bc5ac to 676d47f Compare November 12, 2026 20:42
@ckyrouac
ckyrouac force-pushed the feature/image-mount-api branch from 676d47f to 04ba242 Compare November 13, 2026 16:22
Expose paths from booted or staged deployment images through
caller-owned read-only mounts. Keep image content and persistent /var
ownership separate, and add explicit unmount and integration coverage.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Invoke external rm when capturing cleanup status, and close the mountpoint descriptor before unmounting it to avoid EBUSY.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Acquire the OSTree lock through a writable detached sysroot clone while keeping read-only data paths attached. Stage detached source mounts in a private worker namespace before cloning so they can be attached in the caller namespace.

Fix Nushell cleanup command capture and assert image mounts leave /sysroot options unchanged.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Map checkout fallback /etc requests to pristine /usr/etc, and reject whole-root exports that cannot safely preserve that replacement in a non-recursive mount. Keep other source subtrees available without a detached child-mount operation.

Document the backend-specific behavior and add divergent-marker regression coverage.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Build and stage a distinct containers-storage image with a unique marker, then verify bootc image mount selects its /usr content rather than the booted image. Keep booted checks on Secure Boot composefs UKIs, where the shared fixture helper cannot produce a signed staged image.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Libostree exposes runtime staged deployments through the current-root sysroot, not the detached backing sysroot used for locking. Use the selected deployment's relative path and checksum directly while keeping the real backing-sysroot lock and attached read-only data paths.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
ComposefsRepository::set_insecure returns a Result. Propagate it so docgen builds don't reject an unused must-use result and callers see setup failures.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Register test and plan 64 from the current booted test metadata and remove stale entries for test 68.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
The staged marker is read without a trailing line feed in the image-mount test. Generate the sentinel without one and compare against that exact content, so the assertion remains strict without depending on line-ending normalization.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Some UEFI test VMs do not expose the SecureBoot EFI variable. Treat only the missing-variable diagnostic as unknown, skip the unsealed staged fixture in that case, and continue the booted-image mount checks.

Assisted-by: AI
Signed-off-by: ckyrouac <ckyrouac@redhat.com>

This branch has not been deployed

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

Labels

area/documentation Updates to the documentation 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.

4 participants