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

3891 Commits

Author SHA1 Message Date
Colin Walters
e99410d9a4 build-sys: Inject hvc0 by default
In order to debug failures more reliably we really always want a virtual
console.

It turns out the Fedora kernel configs for a while have done
9a0d7ce2af
which means hvc0 is available from very early boot.

I am probably going to argue to do this in all Fedora derivatives by
default soon but let's start here.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 15:12:43 -05:00
Colin Walters
9a8bf1b5e4 install: Detect bootloader from target image instead of host
Fixes a regression where bootupd detection was happening before the
container was deployed, causing bootc to incorrectly check the host
system instead of the target container image. This led to false negatives
when the container had bootupd but the host didn't.

The fix moves bootloader detection into a new PostFetchState that's
created after the deployment is available, ensuring we check the actual
target filesystem.

Fixes: #1778

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 14:19:03 -05:00
Colin Walters
9142b88a54 docs: Add a man page for bootc-root-setup
On general principle.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 11:24:07 -05:00
Colin Walters
4c2377bc42 docs: Add a packaging-and-integration guide
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 11:06:31 -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
d68245d319 Dockerfile: Use rpmbuild
We were bit before by just doing a `COPY` of our binaries overtop of
the base image because that doens't remove old files.

Replace the pre-build approach with rpmbuild, and then change to
do an rpm-based upgrade so that we fix that problem.

Note that we still preserve incremental rebuilds by overriding
some of the RPM build process.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 09:41:55 -05:00
Colin Walters
509a2c3954 build-sys: Drop some dead code
- The ci/Dockerfile.fcos has been unused for some time and
  testing with FCOS derivatives is already done outside of CI
  here
- Drop the bits which reference git in the Makefile, a new rule
  I'm trying to impose here is that nothing in the build system
  should rely on git (or at least not rely on being built
  from a git repository)

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 09:41:55 -05:00
Colin Walters
3f783a71be Justfile: Drop --jobs=4
See the comment for more info.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 09:41:55 -05:00
Colin Walters
e048789824 Justfile: Remove unused args for integration test image
Squashes a podman build warning; variant and base only apply to the
base image.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 09:41:55 -05:00
Colin Walters
2a9273a11f xtask: Drop some dead code
This was used at one point for composefs testing, but no longer.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-19 09:41:55 -05:00
Colin Walters
ddb2ed3b83 Justfile: Stop using --label flag to fix layer caching
This broke caching with podman 5.6; it's fixed as of https://github.com/containers/buildah/commit/fb6ce9d
but it's easy enough for us to just use the `LABEL` instruction anyways.

Assisted-by: Claude Code (Sonnet 4.5)
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
Huijing Hei
e24660f65e blockdev: find esp based on MBR or GPT
See https://github.com/bootc-dev/bootc/pull/1736#issuecomment-3497579510

Signed-off-by: Huijing Hei <hhei@redhat.com>
2025-11-18 21:29:17 -05:00
Eric Curtin
7e81f9ced7 Move docker .tar.gz handling to unencapsulate.rs
To handle this is a different location

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
2025-11-18 12:36:30 -05:00
Eric Curtin
086fa3bbd3 --transport docker-daemon support
So we can do things like:

sudo bootc switch --transport docker-daemon localhost/bootc:latest

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
2025-11-18 12:36:30 -05:00
Colin Walters
a998bfc3f1 install: Fix DPS support
This fixes bootc's use of the Discoverable Partition Specification (DPS)
to properly support systemd-gpt-auto-generator. Previously, bootc was
incorrectly setting filesystem UUIDs to the DPS partition type UUID value,
which caused UUID collisions and prevented proper DPS functionality.

It's still a TODO on our side to support systemd-repart in this flow.

Note we go back to using random filesystem UUIDs with this, but
per above we should likely reinitialize them on boot via repart.

Note we remove root= parameter from kernel cmdline for composefs sealed images,
allowing systemd-gpt-auto-generator to auto-discover the root partition
and we test this.

Fixes: #1771

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-18 11:02:22 -05:00
Colin Walters
63d09b6a7e install: Expand on root_mount_spec option
Came up in chat.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-17 09:38:28 -05:00
John Eckersberg
71dc8e52d3 xtask: Fix deprecation warnings with rand 0.9
The rand crate was bumped from 0.8 -> 0.9 in 7804be96

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-14 10:42:26 -05:00
gursewak1997
0e27000141 Fix lint to check /etc/tmpfiles.d
The bootc container lint command now reads tmpfiles.d configuration files
from both /usr/lib/tmpfiles.d and /etc/tmpfiles.d, with /etc entries
taking precedence (matching systemd's behavior).

Fixes #1732

Signed-off-by: gursewak1997 <gursmangat@gmail.com>
2025-11-14 07:27:28 -05:00
bootc-bot[bot]
7804be9656 fix(deps): update rust (#1740)
Signed-off-by: bootc-bot[bot] <225049296+bootc-bot[bot]@users.noreply.github.com>
Co-authored-by: bootc-bot[bot] <225049296+bootc-bot[bot]@users.noreply.github.com>
2025-11-14 13:34:37 +08:00
Ben Pilgrim
a0cdb06a00 Add '--remove-destination' option to cp command (#1764)
Signed-off-by: Ben Pilgrim <ben@pilgrim.me.uk>
2025-11-14 01:58:00 +00:00
John Eckersberg
809b18b52f kernel_cmdline: Manually impl semantically-correct equivalence for Cmdline
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-13 15:46:24 -05:00
John Eckersberg
35e64a42cd kernel_cmdline: impl PartialOrd/Ord/PartialEq/Eq for Parameter/ParameterKey
We need to be able to check equality on Cmdline by comparing sorted
parameters.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-13 15:46:24 -05:00
John Eckersberg
0334639d1d Use Cmdline for kargs fields in InstallConfigOpts and RootSetup
Plus all of the various places this trickles down.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-13 15:46:24 -05:00
John Eckersberg
c1e4a7adea kernel_cmdline: Standardize Deref/AsRef impls across types
Implement generic AsRef in terms of Deref as suggested in:

https://doc.rust-lang.org/std/convert/trait.AsRef.html#generic-implementations

I'm not 100% sold on this since in some case (like the change to the
tests here) you have to end up doing `&*` coercion to get the right
type, but this at least makes everything consistent.

Would be a bit nicer when/if str_as_str[1] stabilizes, at least for
the most common UTF-8 case.

[1] https://github.com/rust-lang/rust/issues/130366

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-13 15:46:24 -05:00
John Eckersberg
de988f0d9c install: Hoist InstallResetOpts kargs parsing up into clap
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-13 15:46:24 -05:00
John Eckersberg
b01ffa82e0 kernel_cmdline: Add some more derives for Cmdline
Prep so we can parse these directly via clap

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-13 15:46:24 -05:00
Colin Walters
051a881cd9 Justfile: Remove some unused targets
These are dead code.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-13 13:24:02 -05:00
Colin Walters
c9ee430573 Justfile: Add a label for locally built images and cleanup helper
To make it easeier to clean things up.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-13 13:24:02 -05:00
Colin Walters
84e48ae782 cli: Hide config-diff and delete-deployment
These were added without docs or tests and
only apply right now to the composefs backend. Hide them until
they meet the above quality bars.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-13 13:23:41 -05:00
Xiaofeng Wang
9185005025 test: Fix factory reset Access denied error on CS10
Sometimes systemd daemons are still running old binaries and
response "Access denied" when send reboot request

Force a full sync before reboot and Allow more delay for
bootc to settle

Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-11-13 10:53:13 -05:00
Colin Walters
c0b9cde666 store: Preserve /sysroot readonly for read-only operations
PR #1718 introduced a regression where /sysroot was left writable after
running `bootc status`. This occurred because BootedStorage::new()
unconditionally calls set_mount_namespace_in_use(), which tells ostree
it can safely remount /sysroot as writable. When sysroot.load() is called
without actually being in a mount namespace, it leaves the global /sysroot
writable.

Fix by introducing an Environment enum that detects the runtime environment
(ostree, composefs, container, or other) early in the execution flow. Callers
now detect the environment and call prepare_for_write() if needed before
constructing BootedStorage. This ensures a single call to prepare_for_write()
per execution path and eliminates the previous layering violation where storage
code called into CLI code.

The Environment abstraction also makes it clearer when mount namespace
setup is required and provides a foundation for future environment-specific
behavior.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-13 09:08:03 -05:00
John Eckersberg
d6a269fd62 kernel_cmdline: Simplify Display impl for utf8::Parameter
Really we want to just return the original slice that the Parameter
was created from.  This also aligns with how Cmdline and ParameterKey
impl Display.

Where this really matters the most is to ensure we retain the quoting
that the parameter was created with, so I added a test just to sanity
check that.  Before this change the test would fail because "foo"
would be stripped of its quotes and just rendered as foo unquoted.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-12 13:40:29 -05:00
John Eckersberg
5c962c1196 kernel_cmdline: Implement Deref for Cmdline
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-12 13:40:29 -05:00
Micah Abbott
71dcf84334 docs: fix symlink command
Closes: #1731

Signed-off-by: Micah Abbott <miabbott@redhat.com>
2025-11-12 10:36:33 -05:00
Colin Walters
67343474dd build-sys: Reinstall fedora-bootc-destructive-cleanup script
When commit cd8fa591 moved unit enablement to a systemd generator, it also
removed the installation of the fedora-bootc-destructive-cleanup script from
the Makefile. This was unintentional - while the symlink enablement should
be handled by the generator, the script itself still needs to be installed.

The trap is that because we weren't accurately removing old files
from the build, the old version was still there...until the new upstream
release.

Fix this in two ways:

First, continue to install the script on Fedora-like systems as before, but leave unit
enablement to the generator as intended.

Second, change how we remove prior state to clean out all files from
the RPM. (I did look at changing out the build system so we build
an RPM in this case which would be cleaner, but it's a large change)

Fixes: https://github.com/bootc-dev/bootc/issues/1748
Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-11 14:20:57 -05:00
John Eckersberg
1f0a3129e9 Fix deprecation warning for rustix::thread::Capability
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-10 15:37:30 -05:00
John Eckersberg
7f100886a9 Modify upgrade test to check quoted kargs
This covers the issue reported in https://github.com/ostreedev/ostree/issues/3544

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-10 13:12:40 -05:00
John Eckersberg
95dc8a648e bootc_kargs: Use kernel_cmdline for parsing
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-10 13:12:40 -05:00
John Eckersberg
c1ae4237dc kernel_cmdline: Add CmdlineOwned alias for Cmdline<'static>
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-10 13:12:40 -05:00
John Eckersberg
43061f0c28 kernel_cmdline: Add remove_exact method
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-10 13:12:40 -05:00
Colin Walters
cc843bc98b ci: Push built images to ghcr.io
It'll be really handy to have reference images which are tracking git main
of bootc for all the streams.

(TODO: switch these to be multi-arch at least for amd64, or
 maybe we should use Konflux to do this)

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-10 07:05:22 -05:00
Colin Walters
13f68d2f20 ci: Add a required-checks context
This copies the approach taken in bcvk, so when we change
our CI jobs I don't need to go and manually edit the GH configuration.

(A followup step here is to have automation to cut over all repositories
 to do things this way)

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-09 22:35:39 -05:00
Colin Walters
d596a3246d rust: cargo update
Renovate is currently failing because of the composefs-rs git
submodule (trying to debug that) so we're behind. At least this
one gets rid of multiple copies of rustix and an old toml version.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-07 15:52:47 -05:00
Colin Walters
6d655af91a cfs: Hard error on external kargs with UKIs
I thought about this with the cloud-init disablement for now
with bcvk. It already works to just not enable `cloud-init.target`
which we were already doing.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-07 15:05:07 -05:00
Colin Walters
c2a10aef4e composefs-boot: Retain SHA512 type
Motivated by increased type safety.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-07 15:05:07 -05:00
John Eckersberg
87bcbd9ae9 kernel_cmdline: Fix parsing/equivalence of "outside" quoted args
Primary motivation here is that these two should be equivalent:

foo="quoted value"
"foo=quoted value"

This also adds tests for a few more oddball cases that weren't covered
before but clarify the expected kernel behavior.

Closes: #1737
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-11-07 14:22:20 -05:00
Colin Walters
3181bb58e7 tests: Fix examples-build to work on non-fsverity hosts
I'm changing the default fs for Fedora in our CI to be xfs arbitrarily.
This code SHOULD work on non-fsverity hosts, and the other
code path in `tests/build-sealed` does.

Also, the remainder of the stuff was dead code so just drop it.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-06 19:32:42 -05:00
Colin Walters
f8ce015254 Rework GHA testing: Use bcvk, cover composefs with tmt
Part 1: Use bcvk

For local tests, right now testcloud+tmt doesn't support UEFI, see
https://github.com/teemtee/tmt/issues/4203

This is a blocker for us doing more testing with UKIs.

In this patch we switch to provisioning VMs with bcvk, which
fixes this - but beyond that a really compelling thing about
this is that bcvk is *also* designed to be ergonomic and efficient
beyond just being a test runner, with things like virtiofs
mounting of host container storage, etc.

In other words, bcvk is the preferred way to run local virt
with bootc, and this makes our TMT tests use it.

Now a major downside of this though is we're effectively
implementing a new "provisioner" for tmt (bypassing the
existing `virtual`). In the more medium term I think we
want to add `bcvk` as a provisioner option to tmt.

Anyways for now, this works by discovers test plans via `tmt plan ls`,
spawning a separate VM per test, and then using uses tmt's connect
provisioner to run tests targeting these externally provisioned
systems.

Part 2: Rework the Justfile and Dockerfile

This adds `base` and `variant` arguments which are propagated through
the system, and we have a new `variant` for sealed composefs.

The readonly tests now pass with composefs.

Drop the continuous repo tests...as while we could keep
that it's actually a whole *other* entry in this matrix.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-06 19:32:42 -05:00
Colin Walters
c832f6d0fc tmt: Document soft-reboot limitation and fix tests
TMT does not support systemd soft-reboots - it only detects reboots
by checking if /proc/stat btime changes, which doesn't happen during
soft-reboots. This caused test-custom-selinux-policy to hang when
running with bcvk (which allows actual soft-reboots), while it
accidentally passed with testcloud (which forced full VM reboots).

Add bug-soft-reboot.md documenting this limitation and update both
test files to reference it. Also remove --soft-reboot=auto from
test-custom-selinux-policy since we can't test it with TMT anyway.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-06 19:32:42 -05:00