Skip to content

install/flat: Use composefs pipeline for rootfs#2028

Open
ericcurtin wants to merge 1 commit intobootc-dev:mainfrom
ericcurtin:bootc-flat
Open

install/flat: Use composefs pipeline for rootfs#2028
ericcurtin wants to merge 1 commit intobootc-dev:mainfrom
ericcurtin:bootc-flat

Conversation

@ericcurtin
Copy link
Contributor

@ericcurtin ericcurtin commented Feb 27, 2026

--flat install implementation will go through the composefs
repository. This gives several advantages:

  • SELinux labeling is handled by composefs-rs (selabel), which applies
    labels from the image's file_contexts rather than inheriting the
    running container's labels.
  • The kernel installation flow is reused from composefs-rs
    (get_boot_resources / UsrLibModulesVmlinuz).
  • The composefs repo is preserved at /sysroot/composefs, making it
    easy to convert to immutable/bootc mode later. Users who don't want
    the metadata overhead can rm -rf /sysroot/composefs.
  • write_to_path supports reflink copies on btrfs/XFS, sharing blocks
    with the composefs object store.
  • --source-imgref now works with --flat (the in_host_mountns guard is
    removed since we pull via the image reference, not via cp /).

@github-actions github-actions bot added the area/install Issues related to `bootc install` label Feb 27, 2026
@bootc-bot bootc-bot bot requested a review from henrywang February 27, 2026 15:07
@ericcurtin ericcurtin marked this pull request as draft February 27, 2026 15:08
@ericcurtin
Copy link
Contributor Author

Not complete, wanted to see what shape the builds are in

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 introduces an experimental --flat mode for bootc install to-filesystem, which performs a traditional-style OS installation from a container image. The implementation is well-structured, adding new functions for each step of the flat installation process and integrating it into the existing installation flow. The changes also include a new unit test for BLS entry creation.

My review focuses on potential improvements in memory efficiency and code maintainability. I've suggested using streaming copies for kernel and initramfs files to reduce memory usage and pointed out an opportunity to refactor duplicated bootloader installation logic into a shared function.

@ericcurtin ericcurtin force-pushed the bootc-flat branch 4 times, most recently from 7d6dce9 to 71e1152 Compare March 2, 2026 13:54
@github-actions github-actions bot added the area/documentation Updates to the documentation label Mar 2, 2026
@ericcurtin ericcurtin force-pushed the bootc-flat branch 2 times, most recently from 49a5d13 to 04154c1 Compare March 2, 2026 15:24
@ericcurtin ericcurtin marked this pull request as ready for review March 2, 2026 15:25
@ericcurtin
Copy link
Contributor Author

This is admittedly quite basic, it's just copy stuff in the right place, but it's a start

@bootc-bot bootc-bot bot requested a review from gursewak1997 March 2, 2026 15:26
@ericcurtin
Copy link
Contributor Author

ericcurtin commented Mar 2, 2026

What I am thinking the next step here is:

For /usr, /bin, /lib, etc.: do a Rust-written equivalent of rsync -aHAX --delete --one-file-system instead of cp, so extraneous files are removed
For /etc: apply the same 3-way merge logic from finalize.rs
For /var, /home, /root: do nothing

@cgwalters
Copy link
Collaborator

cgwalters commented Mar 2, 2026

regular (non-bootc) Linux system

Request: Please don't use "regular" (or worse "normal") in that way, it implies other things are "irregular" (or worse "abnormal"). In this case I'd say "mutable" (or just non-bootc) as you did.


Anyways on the implementation side, I think it'd be really nice if we actually did create a composefs repo but then from there we did a reflink based copy out.

There are several huge advantages to that, among them we'd be reusing the selinux labeling support in composefs(-rs) for example, and the kernel installation flow.

Further it makes it way easier to then convert the image to immutable/bootc style later on. And anyone who doesn't want the extra metadata overhead can just rm -rf /sysroot/composefs or so.

I think we should not regenerate the initramfs client side by default.

@ericcurtin
Copy link
Contributor Author

regular (non-bootc) Linux system

Apologies, you've mentioned this before and I completely understand the logic.

Request: Please don't use "regular" (or worse "normal") in that way, it implies other things are "irregular" (or worse "abnormal"). In this case I'd say "mutable" (or just non-bootc) as you did.

Anyways on the implementation side, I think it'd be really nice if we actually did create a composefs repo but then from there we did a reflink based copy out.

There are several huge advantages to that, among them we'd be reusing the selinux labeling support in composefs(-rs) for example, and the kernel installation flow.

Further it makes it way easier to then convert the image to immutable/bootc style later on. And anyone who doesn't want the extra metadata overhead can just rm -rf /sysroot/composefs or so.

I think we should not regenerate the initramfs client side by default.

All fair points.

@ericcurtin ericcurtin changed the title Add --flat mode for to-filesystem installation install/flat: Use composefs pipeline for rootfs Mar 2, 2026
@ericcurtin ericcurtin force-pushed the bootc-flat branch 9 times, most recently from 5d01837 to 2a9712c Compare March 3, 2026 09:55
@ericcurtin ericcurtin force-pushed the bootc-flat branch 3 times, most recently from 10e3e87 to 949d5a9 Compare March 3, 2026 11:04
Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

I haven't even looked at install.rs changes yet and no promises on this one in the review queue in general, but I also don't want to block experimentation on it.

Speaking of even if we were to land this for sure it'd need to be an experimental feature (much like its close cousin in #1969 )

@ericcurtin ericcurtin force-pushed the bootc-flat branch 5 times, most recently from 1a7c3cf to 36eb457 Compare March 3, 2026 18:23
- Use composefs-rs for SELinux labeling and kernel installation
- Implement streaming copy for kernel/initramfs files
- Consolidate bootloader installation logic
- Add /usr overlay status tracking
- Various test and documentation updates

Note: blockdev.rs and ADOPTERS.md changes moved to separate PRs per review feedback

Assisted-by: Claude Code (Opus)
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
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 area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants