Skip to content

Conversation

@cgwalters
Copy link
Collaborator


This exposes the current functionality of the cfsctl binary.
It's not a crate right now, and it's not a lot of code, so we just
fork it.

I did take the effort to use git subtree merge to do the import.
For the record, here's how I did it:

  • In composefs-rs: git subtree split --prefix=crates/cfsctl
  • In bootc: git subtree add --prefix=crates/lib/cfsctl ../../containers/composefs-rs/

In cfsctl I also:

  • Adjusted it to accept the bootc-configured composefs repo
    (which note is right now hardcoded to sha512, not sha256)
  • Dropped the http stuff since I don't think it really makes
    sense vs OCI

Signed-off-by: Colin Walters [email protected]

allisonkarlitskaya and others added 8 commits May 15, 2025 13:56
Split into a few separate crates:
  - libraries:
    - composefs
    - composefs-oci
    - composefs-boot
  - binaries:
    - cfsctl
    - composefs-setup-root
    - erofs-debug

Move our lint config (which only forbids missing debug impls) to the
workspace level and have all crates inherit from that.

Add a new workflow for testing that we can `cargo package` everything.
We need a nightly cargo in order to do this with workspaces containing
inter-dependent crates: rust-lang/cargo#13947

Make 'oci' an optional feature of cfsctl, but enable it by default.
Adjust our rawhide bls example (which included --no-default-features) to
*not* disable that.

This is not a huge improvement in terms of compile speed, and it has
some drawbacks (like 'cargo run' no longer defaulting to cfsctl) but it
seems like the right step at this point.  I want to start to add some
more experimental code without making it part of the main crate.

Signed-off-by: Allison Karlitskaya <[email protected]>
Grub needs absolute paths to initrd and vmlinuz if we do not have
`/boot` in a boot partition, which we do not in bootc.

Add param `boot_subdir` which acts like a subdirectory in the boot
directory in case the boot partition is mounted in another directory.

Signed-off-by: Pragyan Poudyal <[email protected]>
It turns out that the information contained in splitstreams to assist
with garbage collection (ie: the list of things that we mustn't discard)
is exactly the required information for downloading (ie: the list of
things that we must acquire).

Use this fact to add support for fetching repository content from HTTP
servers.  We only download the objects that are actually required, so
incremental pulls are very fast.

This works with just about any HTTP server, so you can do something like

  python -m http.server -d ~/.var/lib/composefs

and download from that.  With a fast enough web server on localhost,
pulling a complete image into an empty repository takes about as long as
pulling an `oci:` directory via skopeo with `cfsctl oci pull`.

In practice, this is intended to be used with a webserver which supports
static compression and pre-compressed objects stored on the server.  In
particular, zstd support is enabled in the `reqwest` crate for this
reason, and it's working with something like:

  find repo/objects/ -type f -name '*[0-9a-f]' -exec zstd -19 -v '{}' +
  static-web-server -p 8888 --compression-static -d repo

There's also an included s3-uploader.py in the examples/ directory which
will upload a repository to an S3 bucket, with zstd compression.

Signed-off-by: Allison Karlitskaya <[email protected]>
Change the Repository::mount() API to return the mounted filesystem as
an fd rather than taking the mountpoint as an argument.  Create a new
mount_at() API to replace the old one, replacing the canicalize() and
mount_at() calls that used to be in mount_composefs_at(), which we
remove.

Update the various users.

Making this change lets us simplify the logic in composefs-setup-root:
it no longer has to manually open the image in order to perform the
fsmount operation: it can use the new API on the repository.

This allows us to make Repository::open_image() private, so do that too.

Co-authored-by: Sanne Raymaekers <[email protected]>
Signed-off-by: Allison Karlitskaya <[email protected]>
Allows cfsctl operations with fs-verity disabled.

Signed-off-by: Sanne Raymaekers <[email protected]>
Supports writing `composefs=?<root-id>`.

Signed-off-by: Sanne Raymaekers <[email protected]>
Signed-off-by: Pragyan Poudyal <[email protected]>
…28c985b06'

git-subtree-dir: crates/lib/cfsctl
git-subtree-mainline: 07faf7d
git-subtree-split: b46b1f7
@cgwalters cgwalters requested a review from jeckersb August 1, 2025 18:05
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 effectively integrates cfsctl functionality as an internal bootc command. The changes are well-structured, and the integration of the forked code is clean. I've found a critical issue that could lead to a panic and a suggestion to improve code clarity and align it with modern Rust idioms. Great work on integrating this!

@cgwalters cgwalters enabled auto-merge August 1, 2025 18:09
This exposes the current functionality of the cfsctl binary.
It's not a crate right now, and it's not a lot of code, so we just
fork it.

I did take the effort to use `git subtree merge` to do the import.
For the record, here's how I did it:

- In composefs-rs: git subtree split --prefix=crates/cfsctl
- In bootc: git subtree add --prefix=crates/lib/cfsctl ../../containers/composefs-rs/ <git sha1 from above>

In cfsctl I also:

- Adjusted it to accept the bootc-configured composefs repo
  (which note is right now hardcoded to sha512, not sha256)
- Dropped the http stuff since I don't think it really makes
  sense vs OCI

Signed-off-by: Colin Walters <[email protected]>
Copy link
Collaborator

@jeckersb jeckersb left a comment

Choose a reason for hiding this comment

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

Went over this with @cgwalters on a call 👍

@cgwalters cgwalters merged commit 92409e9 into bootc-dev:main Aug 1, 2025
25 of 27 checks passed
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.

5 participants