Skip to content

Conversation

@allisonkarlitskaya
Copy link
Collaborator

Split into a few separate crates:

  • composefs
  • composefs-oci
  • composefs-boot
  • cfsctl
  • composefs-setup-root

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 we might want to do it anyway, for two reasons:

  • I have a couple of experimental pieces of work (like a fuse filesystem implementation and an HTTP downloader) that I'd like to commit somewhere, but don't want to add to the main composefs crate, mostly for dependency reasons. Features could help there..

  • I've wanted to do xtask stuff for a long time, but it requires workspaces...

This is something like the transformation required to make it work. Maybe let's start discussing it.

@allisonkarlitskaya
Copy link
Collaborator Author

I think I'm starting to sour a little on this idea already. We could be using something like Just or just straight-up make or shellscripts to get us the xtask thing and features would get us the rest...

@cgwalters
Copy link
Collaborator

I think splitting things up into separate crates is often a good idea anyways, there's clearly a "core composefs" and "boot stuff" at least.

I don't have a really strong opinion though.

@allisonkarlitskaya
Copy link
Collaborator Author

Seems we're both kinda stuck in the same "meh" place on this one :)

Copy link
Contributor

@shawn111 shawn111 left a comment

Choose a reason for hiding this comment

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

@allisonkarlitskaya just add two small cargo comments

@allisonkarlitskaya allisonkarlitskaya force-pushed the crates branch 3 times, most recently from 25a7709 to be8021d Compare May 12, 2025 16:46
@allisonkarlitskaya allisonkarlitskaya marked this pull request as ready for review May 12, 2025 16:48
@allisonkarlitskaya allisonkarlitskaya changed the title WIP: Cargo.toml: switch to a workspace Cargo.toml: switch to a workspace May 12, 2025
@allisonkarlitskaya allisonkarlitskaya force-pushed the crates branch 6 times, most recently from 1d29ead to 75adc8b Compare May 14, 2025 15:56
@allisonkarlitskaya
Copy link
Collaborator Author

The same error, three times, even when it looks completely unrelated to the PR, and even when it's rawhide, but when it works on main (cf #124) and I've never seen anything like it before? hmmmmm

qemu-img create -q -f qcow2 -b /home/runner/work/composefs-rs/composefs-rs/examples/bls/rawhide-bls-efi.qcow2 -F qcow2 /var/tmp/bots-run/cockpit-qczwawbd.qcow2
+ ! test -f /run/nologin && cat /proc/sys/kernel/random/boot_id
+ ! touch /a
touch: cannot touch '/a': Read-only file system
+ ls /sysroot
Traceback (most recent call last):
  File "/home/runner/work/composefs-rs/composefs-rs/examples/test/run-tests", line 62, in <module>
    main()
    ~~~~^^
  File "/home/runner/work/composefs-rs/composefs-rs/examples/test/run-tests", line 51, in main
    case(machine)
    ~~~~^^^^^^^^^
  File "/home/runner/work/composefs-rs/composefs-rs/examples/test/run-tests", line 14, in test_basic
    assert m.execute('ls /sysroot') == 'composefs\nlost+found\nstate\n'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
client_loop: send disconnect: Broken pipe
Error: Process completed with exit code 1.

@allisonkarlitskaya
Copy link
Collaborator Author

OK. After a lot of fighting, I got this reproduced locally. The issue is caused by the crate separation commit (works before, fails after) and the result is that /sysroot in the booted system is now a second copy of the composefs. The reason it only fails on rawhide is because that's the only case that doesn't have pre-6.15 enabled. Looking into this.

@allisonkarlitskaya
Copy link
Collaborator Author

It's getting clearer: pre-6.15 is the default flags for the composefs crate. cargo build -F has no impact on the binaries we build because they include the composefs crate with the default features. That means that rawhide is getting the pre-6.15 version of the mount code, even if it doesn't want it. That conflicts with our explicitly different handling of the mounts in composefs-setup-root, which also has the feature.

Pretty sure the fix is to declare that we take no-default-features on the composefs crate and wire it through...

@allisonkarlitskaya allisonkarlitskaya force-pushed the crates branch 2 times, most recently from a60b584 to 8d0ce1c Compare May 15, 2025 02:21
Newer versions of dracut throw thousands of errors when trying to copy
files into the initramfs in some container setups, and in some cases of
symlinks can fail to include files entirely.  This has led to a
long-lingering problem that makes it difficult to build images locally
(despite them working in CI).

Here's the workaround: DRACUT_NO_XATTR=1.  Thanks to Dick Marinus for
that.

See https://discussion.fedoraproject.org/t/146603/3

This lets us finally increase our Fedora version in the examples to 42.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
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 <allison.karlitskaya@redhat.com>
Recent changes in the 6.15-rc kernel series have broken
composefs-setup-root when running without using the newest features of
the mount API (ie: with the pre-6.15 feature left enabled, which is the
default).

Add a case to the examples for testing that.  Once it gets working again
it would be useful to make sure it continues to work.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
We need to add a couple of exceptions in order to make ioctls.
Hopefully we can remove those and set this to forbid, but for now it's a
pretty strong statement going forward.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
This is the suggested config from samply.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
Copy the config from bootc.  This results in an impressive (> 50%)
amount of savings.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
@allisonkarlitskaya
Copy link
Collaborator Author

Ok, so the pre-6.15 on rawhide thing looks like a legit kernel regression. We're lucky we caught it: I added a commit here to introduce a test variant that will test it in the future (but it's currently disabled in CI).

I wrote to fsdevel: https://lore.kernel.org/linux-fsdevel/CAOYeF9WQhFDe+BGW=Dp5fK8oRy5AgZ6zokVyTj1Wp4EUiYgt4w@mail.gmail.com/

Copy link
Member

@travier travier left a comment

Choose a reason for hiding this comment

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

LGTM from a quick look.

@allisonkarlitskaya allisonkarlitskaya merged commit 8fbacae into containers:main May 15, 2025
12 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.

4 participants