Skip to content

cli/cfsctl: Use proxy from composefs-rs#2023

Merged
cgwalters merged 3 commits intobootc-dev:mainfrom
Johan-Liebert1:cfs-dedup
Mar 2, 2026
Merged

cli/cfsctl: Use proxy from composefs-rs#2023
cgwalters merged 3 commits intobootc-dev:mainfrom
Johan-Liebert1:cfs-dedup

Conversation

@Johan-Liebert1
Copy link
Collaborator

  • Bump composefs-rs
    Also, update the git URL to point to
    https://github.com/composefs/composefs-rs

  • cli/cfsctl: Use proxy from composefs-rs
    Now that we have cfsctl as a library, we simply use that to proxy all of
    our bootc internal cfs commands. Cleans up the codebase a bit, DRYs
    it and keeps things in sync

@bootc-bot bootc-bot bot requested a review from henrywang February 25, 2026 16:17
cgwalters
cgwalters previously approved these changes Feb 25, 2026
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.

Nice!

@cgwalters cgwalters enabled auto-merge (rebase) February 25, 2026 16:19
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

The pull request successfully migrates the cfsctl functionality into an external composefs-rs library, which is a positive step towards code modularity and adherence to DRY principles. The dependency updates across Cargo.lock, Cargo.toml, and deny.toml are consistent with this change. The removal of the internal cfsctl.rs module and the corresponding updates in cli.rs and lib.rs correctly reflect the new architecture.

@Johan-Liebert1
Copy link
Collaborator Author

Ok wow

error: Installing to disk: Setting up composefs boot: Failed to mount composefs image: Mounting image '3ba387b6e47dacf983937fd9e3824cef20ebdce824199215dfa803fbe9a6e6b7379539fad23444667aeba209739b395a51345ba1f57dfc17e50a81da7fbf0074': Creating filesystem mount: Invalid argument (os error 22)

@Johan-Liebert1
Copy link
Collaborator Author

Looks like an issue with creating loop device

write(2, "[crates/composefs/src/mountcompa"..., 69[crates/composefs/src/mountcompat.rs:138:5] "make_erofs_mountable" = ) = 69
write(2, "\"", 1")                       = 1
write(2, "make_erofs_mountable", 20make_erofs_mountable)    = 20
write(2, "\"", 1")                       = 1
write(2, "\n", 1
)                       = 1
openat(AT_FDCWD, "/dev/loop-control", O_RDWR|O_CLOEXEC) = 12
ioctl(12, LOOP_CTL_GET_FREE)            = 1
openat(AT_FDCWD, "/dev/loop1", O_RDWR|O_CLOEXEC) = 13
ioctl(13, _IOC(_IOC_WRITE, 0x4c, 0xa, 0x130), 0x7ffe9710f9a8) = -1 EINVAL (Invalid argument)

Precisely the issue seems to be here https://github.com/composefs/composefs-rs/blob/022c9c62216615af471acaa78f486203a53f06e3/crates/composefs-ioctls/src/loop_device.rs#L154

Using raw ioctl fixes the issue

        if libc::ioctl(loop_dev.as_raw_fd(), 0x4C0A, &config) < 0 {
            println!("IOCTL RAW FAILED");
        }

which is really weird to me as I don't see any difference between the outputs for both produced by strace

@Johan-Liebert1
Copy link
Collaborator Author

We regressed with this commit composefs/composefs-rs@984ce03

But I don't see the issue immediately

@Johan-Liebert1
Copy link
Collaborator Author

Okay issues seems to be that _IOC(_IOC_WRITE, 0x4c, 0xa, 0x130) resolves to 0x41304c0a and not 0x4c0a which is what LOOP_CONFIGURE should be

@Johan-Liebert1
Copy link
Collaborator Author

Fix here composefs/composefs-rs#240
Replaces the _IO macros with hardcoded opcodes

cgwalters
cgwalters previously approved these changes Feb 26, 2026
Also, update the git URL to point to
https://github.com/composefs/composefs-rs

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
Now that we have cfsctl as a library, we simply use that to proxy all of
our `bootc internal cfs` commands. Cleans up the codebase a bit, DRYs
it and keeps things in sync

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
/// This lazily opens the composefs repository, creating the directory if needed
/// and bootstrapping verity settings from the ostree configuration.
pub(crate) fn get_ensure_composefs(&self) -> Result<Arc<ComposefsRepository>> {
pub(crate) fn get_ensure_composefs(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this PR is trying to solve the same problem ("ro sysroot") in two different ways.

The simplest and IMO best way is what you've already done in the test code below: change the cfsctl invocation to operate on something in /var/tmp.

Changing this core storage code is I believe unnecessary and conceptually wrong because this particular module is really about the bootc-owned storage only.

Copy link
Collaborator Author

@Johan-Liebert1 Johan-Liebert1 Mar 2, 2026

Choose a reason for hiding this comment

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

Yes, in hindsight this makes sense. Reverted the change in get_ensure_composefs

The `bootc internals cfs` test was running into an issue where pulling
an image into a composefs repository at `/sysroot/composefs` was failing
due to /sysroot being mounted ro. We did remount it rw in an earlier
cmd, but that was in a separate mount ns which did not carry over to the
next commands

Instead of globally remounting /sysroot as rw, we now simply create a
new repository at /var/tmp/sysroot/composefs and perform all operations
there.

Also, pass in `--insecure` to `bootc internals cfs ...` as in
the ostree case we're testing in xfs which does not support fs-verity

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@cgwalters
Copy link
Collaborator

BTW once this lands we should also be able to bump the bootc commit in composefs-rs and restore the revdep check.

@cgwalters cgwalters merged commit 37a0427 into bootc-dev:main Mar 2, 2026
33 of 46 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.

2 participants