1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 15:45:53 +01:00

14 Commits

Author SHA1 Message Date
Daniele Guarascio
13d5db68aa Update workspace to Rust edition 2024
Migrate all crates from edition 2021 to 2024. This includes
updating Cargo.toml files and fixing code compatibility issues.

The MSRV is bumped to 1.85.0 to support edition 2024.

Note: global_init() requires #[allow(unsafe_code)] for
std::env::set_var which is now unsafe in edition 2024.
This is safe because the function is called early in main()
before any threads are spawned.

Closes: #1414

Signed-off-by: Daniele Guarascio <guarascio.daniele@gmail.com>
2026-01-12 17:38:26 +01:00
Pragyan Poudyal
387e9d3114 initramfs: Allow passing target for mounting
`target` field in Args was not being used. Use it if it is passed in the
args. Also helps us mount the new root at `/run/nextroot`

Also, use Cmdline struct instead of String to represent the kernel
command line

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-22 16:06:52 +05:30
Pragyan Poudyal
f846a95473 composefs/usr: Fix /usr permissions on overlay mount
The upper,work directories being created for `/usr` transient mount
always had the mode `0o700` hence only being accessible to root

Update `bootc_initramfs_setup::ensure_dir` to accept an optional
`mode` argument

Fixes: https://github.com/bootc-dev/bootc/issues/1833

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-09 06:49:51 -05:00
Colin Walters
fc09d06e73 build-sys: Always install initramfs module
Now that we've cut over to always building + installing via
an (RPM) package in our build system, we need to always install
the dracut module.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 09:41:55 -05:00
Colin Walters
e0475cd60e initramfs: Mount /sysroot readonly for composefs by default
This implements readonly mounting of /sysroot for composefs systems,
matching the behavior that ostree systems already have. Previously,
composefs left /sysroot mounted read-write, which was inconsistent
and meant the readonly tests had to be skipped for composefs.

The implementation uses a direct `libc::syscall` wrapper for
`mount_setattr` since rustix doesn't yet provide this API. The
`MOUNT_ATTR_RDONLY` flag is applied to three mount
points during initramfs setup:
- The composefs rootfs image mount (becomes `/` after switch-root)
- The test root filesystem mount (used in testing scenarios)
- The sysroot clone mount (becomes `/sysroot` in the booted system)

With this change, the readonly /sysroot tests in test-status.nu
now run for both ostree and composefs systems without conditional
checks.

Assisted-by: Claude Code (Sonnet 4.5)
Co-authored-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-18 23:51:36 -05:00
Colin Walters
02c57b3e30 Adjust all code to use ComposefsRepository alias
This ensures we're SHA-512 across the board.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-10-16 14:48:21 -04:00
Pragyan Poudyal
c05588c5a4 composefs-backend: Implement bootc usr-overlay
Similar to ostree, mount a transient overlayfs on /usr

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-25 14:01:21 -04:00
Colin Walters
088c60646d ci: Also validate the composefs-backend feature
I was hitting a compliation error which *looks*
like it was actaully an incremental compilation bug?
Or it might have been rust-analyzer and local builds
fighting over enabled features.

Anyways, this ensures that we're gating on the composefs
backend compiling.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-15 14:57:31 -04:00
Pragyan Poudyal
8ac9eae698 Add a composefs backend
This adds a new off-by default feature to enable
a new composefs-native backend for bootc. This
is all still a live work in progress, but
we're landing this first tranche of work to help
avoid continual issues with rebasing.

Thanks to everyone who worked on it!

xref https://github.com/bootc-dev/bootc/issues/1190

Co-authored-by: John Eckersberg <jeckersb@redhat.com>
Co-authored-by: Robert Sturla <robertsturla@outlook.com>
Co-authored-by: Colin Walters <walters@verbum.org>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-15 18:19:46 +05:30
Johan-Liebert1
b636b43c47 initramfs: Convert to library
Create a lib.rs as we'd like to utilize these functions elsewhere in the
codebase

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-08-29 15:52:30 +05:30
Johan-Liebert1
5cbc0be7a6 initramfs: Bind mount /etc
This is prep work for eventual integration with composefs-native backend

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-08-28 17:53:57 +05:30
Johan-Liebert1
50722fa3d3 initramfs: Better error handling
Add error contexts to functions. Create wrappers around intrenal
functions with error context added

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-08-28 17:53:31 +05:30
Johan-Liebert1
0ef1eca803 Move composefs setup root to bootc initramfs
Move the composefs-setup-root code from composefs-rs to bootc-initramfs
crate

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-08-26 19:00:59 +05:30
Colin Walters
f61ba60bbc Add initramfs infrastructure
This adds scaffolding to install a stub binary which can
optionally be added into the initramfs;
prep for us doing real work during setup as we aim
to move to the native composefs backend.

The binary is *built* but is only installed by a
new `Makefile` target, so existing build system
users won't pick it up. Our development-only
`Dockerfile` gains a build option to use it
(and also ensures the initramfs is regenerated).

However previously we also discussed moving the fstab
logic into the initramfs:
https://github.com/bootc-dev/bootc/pull/1113

I might try doing that once this lands.

One notable thing is that even this trivial nearly-no-op
binary is still 4MB which I think is mostly due
to linking in a whole copy of prebuilt rust `std`.
In theory we could try going to `#[no_std]` but I
don't think it'll be viable once we start doing more here.
Probably most practical thing re size is `-Z build-std` + LTO.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-08-08 09:30:32 -04:00