1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 06:45:13 +01:00
Commit Graph

3658 Commits

Author SHA1 Message Date
Colin Walters
bda61be34a Merge pull request #1599 from Johan-Liebert1/composefs-native-refactor
Composefs native refactor
2025-09-09 09:30:08 -04:00
Pragyan Poudyal
adb73a9a6a composefs-native: Minor fixes
Fix typo in error message
Unhardcode transport while pulling a composefs repository on
switch

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-09 16:34:36 +05:30
Pragyan Poudyal
cf60f89be9 Gate composefs-native behind composefs-backend flag
Refactor to use `#[cfg(feature = "composefs-backend")]` to gate
composefs native features behind the flag.

Gate the following features
- `--composefs-native` and its corresponding cli args
- Installing/Switching/Upgrading/RollingBack of composefs native system
- Create separate install, rollback functions for ostree for a bit
  cleaner of a setup

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-09 14:41:45 +05:30
Pragyan Poudyal
6f51546d6d Refactor composefs-native related code
Move all composefs-native related stuff into `lib/src/bootc_composefs`.
This might help us to spot diff while merging into main, also should
hopefully create less conflicts

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-09 11:05:19 +05:30
Colin Walters
ab40a997e7 Merge pull request #1571 from Johan-Liebert1/grub-bls-fix
composefs-native/boot: Handle systemd-boot and grub
2025-09-08 08:38:13 -04:00
Johan-Liebert1
31934ae5af composefs-native/boot: Handle systemd-boot and grub
Fix Grub boot error caused by
https://github.com/bootc-dev/bootc/pull/1541. Introduce a `--bootloader`
cli option to `--composefs-native`. Depending upon the type of
bootloader passed in we write BLS configs respectively

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>

Add guard again tempdir drop

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-08 14:37:50 +05:30
Johan-Liebert1
023be10134 composefs/install: Copy /etc contents to state
For bind mounting /etc we copy the contents of the EROFS' /etc to the
deployment's state directory

Mounting the EORFS requires help from the initramfs crate, so we also
turn it into a library crate.

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
24bf57285e composefs/install/bls: Fix empty version in config
Fill `version` field in generated BLS config

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
John Eckersberg
b15b7b0258 Post-rebase fixups:
- Use `read_file` from `composefs::fs`
- Always define `mod parsers`
- Re-alphabetize/group module definitions

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-09-03 16:58:10 -04:00
Robert Sturla
42e44bbd00 composefs-backend: store boot assets in ESP during install
Signed-off-by: Robert Sturla <robertsturla@outlook.com>

install: create temporary directory for ESP bls mount

Plus additional review comments:
- Created constant for EFI/LINUX
- Switched from Task to Command
- Create efi_dir as Utf8PathBuf

Signed-off-by: Robert Sturla <robertsturla@outlook.com>
2025-09-03 16:58:10 -04:00
Colin Walters
6d5ead83ea status: Enhance composefs cmdline parsing to handle ?
The duplication between this and composefs-boot is high
and we need to squash it; an important step there
would probably be lowering the karg parsing.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-03 16:58:10 -04:00
Colin Walters
2ff7a13533 status: Use constant for composefs
Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-03 16:58:10 -04:00
Colin Walters
2afa715f74 install: Fix cargo fmt
Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-03 16:58:10 -04:00
Colin Walters
ffbc27376a install: Use read_file from composefs-boot
Just reducing code here.
2025-09-03 16:58:10 -04:00
Colin Walters
224f838f7c Drop duplicate bls_config 2025-09-03 16:58:10 -04:00
Pragyan Poudyal
ef3f885274 test: Add tests for reading boot entries
Add tests for functions `get_sorted_bls_boot_entries` and
`get_sorted_uki_boot_entries`

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Pragyan Poudyal
6d339755e8 refactor: Pass boot dir to boot entry readers
This allows for easier testing

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
d263a1f755 rollback/composefs: Print whether we are reverting the queued rollback
Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
eefddd2510 install/composefs/uki: Write only staged + booted menuentry on upgrade
Instaed of writing all present menuentries, only write the menuentry for
switch/upgrade and the menuentry for the currently booted deployment.

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
2c51b6a2d3 parser/bls: Add tests for bls parser
Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
52f2b5c805 composefs/state: Name state directory default
Instead of `/sysroot/state/os/fedora` use `/sysroot/state/os/default` as
the default state directory.

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
67590ce549 lib/composefs: Centralize constants
Centralize all constants in a separate file

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
c2ed79b8d4 parser/bls: impl Display for BLSConfig
Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
7e489ddd7c composefs/boot/bls: Handle duplicate VMLinuz + Initrd
If two deployments have the same VMLinuz + Initrd then, we can use the
same binaries for both the deployments.

Before writing the BLS entries to disk we calculate the SHA256Sum
of VMLinuz + Initrd combo, then test if any other deployment has the
same SHA256Sum for the binaries. Store the hash in the origin file under
`boot -> hash` for future lookups.

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
78e3fc876a composefs/state: Use atomic writes for origin and staged deployment files
Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
8820dadc72 composefs/rollback: Handle UKI rollback
We parse the grub menuentries, get the rollback deployment then perform
the rollback, which basically consists of writing a new .staged
menuentry file then atomically swapping the staged and the current
menuentry.

Rollback while there is a staged deployment is still to be handled.

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
9694943e0d parser/grub: Use String instead of &str
Returning a local reference to a `&str` is quite tricky with rust.
Update `title` and `chainloader`, the two dynamic fields in the grub
menuentry, to be `String` instead of `&str`

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Johan-Liebert1
d3a66c9ae1 composefs/status: Read UKI entries to check for queued rollback
Parse the Grub menuentry file, `boot/grub2/user.cfg` to get a list of
bootable UKIs and figure out if a rollback is currently queued.

Signed-off-by: Johan-Liebert1 <pragyanpoudyal41999@gmail.com>
2025-09-03 16:58:10 -04:00
Colin Walters
24d0e98994 Rework composefs_booted to use kernel cmdline
Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-03 16:58:10 -04:00
Pragyan Poudyal
260c20e106 WIP: composefs backend
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-03 16:58:08 -04:00
Colin Walters
310f9f59e6 Merge pull request #1581 from jeckersb/cfs-no-storage
cfs: only get sysroot storage when repo is not supplied
2025-09-03 15:55:48 -04:00
John Eckersberg
6bc63a12f0 cfs: only get sysroot storage when repo is not supplied
For image building, we want to be able to run this on a non-bootc host
or in a container.  There we'll manipulate the composefs repo in a
provided tempdir.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-09-03 14:57:39 -04:00
Colin Walters
6a060857b2 Merge pull request #1580 from cgwalters/unhide-soft
Un-hide soft-reboot
2025-09-03 13:04:58 -04:00
Colin Walters
849a634152 Un-hide soft-reboot
We debugged https://github.com/ostreedev/ostree/issues/3503 and
it's basically a systemd/Anaconda bug. So we can consider
soft reboots an available feature from our end (as systemd
does), but certainly one that will require integration testing on
the OS/distro side.

If you're building a system and you don't want to enable
soft reboots, just `rm /usr/lib/systemd/system/soft-reboot.target`
or so should do the trick.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-03 11:22:34 -04:00
John Eckersberg
fbd06e858b Merge pull request #1579 from cgwalters/srb-main
Deduplicate main error printing
2025-09-02 19:37:18 -04:00
Colin Walters
4fb177c33e Deduplicate main error printing
As part of the tracing-subscriber CVE I did a quick audit
for usages of `tracing::error!` and I noticed when
we updated the `main()` function in the primary
crate we missed also doing the same for system-reinstall-bootc.

Move the handling of that to utils.

xref: https://bugzilla.redhat.com/show_bug.cgi?id=2392017
Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-02 18:37:43 -04:00
John Eckersberg
5be02611c8 Merge pull request #1577 from jeckersb/storage-relative-path
Makefile: Create storage symlink as relative
2025-09-02 17:15:04 -04:00
John Eckersberg
5d49775ca3 Makefile: Create storage symlink as relative
Resolves: #1575
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-09-02 16:30:12 -04:00
bootc-actions-token[bot]
df2da1adaf fix(deps): update auto merged updates (#1566)
Signed-off-by: Platform Engineering Bot <platform-engineering@redhat.com>
Co-authored-by: bootc-actions-token[bot] <225049296+bootc-actions-token[bot]@users.noreply.github.com>
2025-08-30 18:00:50 +00:00
Colin Walters
64fcb08000 Merge pull request #1522 from gursewak1997/bootc-1479
Add systemd structured logging for bootc state changes
2025-08-29 16:15:04 -04:00
gursewak1997
bf74ecbcc3 Add systemd structured logging for bootc state changes 2025-08-29 12:33:18 -07:00
John Eckersberg
6bb4c71331 Merge pull request #1555 from jeckersb/untest-require_value
kernel_cmdline: remove `cfg(test)` for `require_value_*` methods
2025-08-29 12:44:36 -04:00
John Eckersberg
04860d513a kernel_cmdline: remove cfg(test) for require_value_* methods
This appears to have been accidentally added somewhere along the way,
and I would like to use these in composefs-boot.

Also fixes duplicate docstring copy/paste error on
`require_value_of_utf8`.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-08-29 11:09:17 -04:00
Colin Walters
1c552d8ccd Merge pull request #1561 from Johan-Liebert1/composefs-initramfs-lib
initramfs: Convert to library
2025-08-29 07:29:32 -04:00
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
Pragyan Poudyal
7434b0fb0c Merge pull request #1556 from Johan-Liebert1/composefs-initramfs-error-handling
initramfs: Better error handling
2025-08-29 11:13:51 +05:30
Colin Walters
70c80c675c Merge pull request #1557 from Johan-Liebert1/bump-composefs
Bump composefs-rs
2025-08-28 08:54:13 -04:00
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
fbf25c4dad Bump composefs-rs 2025-08-28 15:11:31 +05:30