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

1636 Commits

Author SHA1 Message Date
John Eckersberg
596b7409a0 Release 1.1.7
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-04-14 15:42:00 -04:00
Allison Karlitskaya
7eadcb6ed1 various: adapt to new composefs-rs fsverity API
Bump our composefs-rs version and adjust to the API changes there.

Also, add "BSL-1.0" (Boost Software Licence, OSI/FSF approved) to our
allowed licence lists: it's used by xxhash-rust.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
2025-04-12 11:29:48 +02:00
Colin Walters
0886b20cdc Merge pull request #1264 from ckyrouac/redeploy-bug-fix
Redeploy bug fix
2025-04-11 09:49:58 -04:00
ckyrouac
dbae495cde install: Allow install with existing non-booted stateroot dirs
This modifies the existing check for an extant stateroot dir to check if
the pending stateroot is the same as the booted deployment. Also only
run init_osname if there is not an existing stateroot dir.

fixes #1246

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-11 09:12:06 -04:00
Colin Walters
750515053a Merge pull request #1256 from ckyrouac/run-fetch-check
install: Deprecate skip-fetch-check, replace with run-fetch-check
2025-04-10 20:23:58 -04:00
ckyrouac
6648d6c7da imgstore: Fallback to container root sepolicy
Prior to this, get_ensure_imgstore would fail when run from a non-bootc
system. Instead, in an attempt to make this function idempotent, let's
fallback to the container root sepolicy instead of failing. This should
only happen when running cleanup() during a to-existing install (i.e.
there is not yet a bootc system).

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-10 13:08:25 -04:00
ckyrouac
44ce2cf2c2 install: Deprecate skip-fetch-check, replace with run-fetch-check
This deprecates skip-fetch-check in favor of the inverse,
run-fetch-check. Updates docs and tests to reflect the change.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-08 14:51:58 -04:00
Colin Walters
67283ac868 lints: Add recursive lint traversal infrastructure
Right now the `utf8` lint does a tree walk. I want
to add more, but it'd be good to avoid walking
the whole filesystem multiple times.

In paticular I wanted to add a check for `ostree.usermeta`
should never be present.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-04-08 13:23:29 -04:00
ckyrouac
c7492aa9c5 install: Verify there is sufficient disk space prior to pulling image
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-03 16:14:53 -04:00
ckyrouac
1f06630b1e deploy: Split pull function into two stages
In preparation for reading the image size of the pulled image from it's
digest, this splits out the prepare logic into a separate function. This
will allow callers to call prepare(), run some logic based on the digest
values, then optionally pull the image.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-03 16:14:53 -04:00
Colin Walters
a88fad581f lsm: Add more comments about the SELinux reexec
Came up in chat around why the admin was seeing `invalid_bootcinstall_testlabel_t`
in the logs.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-04-03 13:35:41 -04:00
Colin Walters
f01fbaeaa6 Merge pull request #1239 from cgwalters/status-arch
spec, status: Add architecture
2025-04-03 10:38:05 -04:00
Colin Walters
efb64612d0 Update to use walk from cap-std-ext
We have a few code paths which are doing a recursive filesystem
walk and it's much easier with an API like this, especially
when one wants to keep track of the full relative path.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-04-01 18:57:42 +00:00
Colin Walters
8d97dddb14 Update to rustix 1.0
No major changes required; we get to drop one `unsafe` call
which is nice!

Looks like the ecosystem overall will need a fair bit of porting
before we can drop the 0.38 version though.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-30 16:57:50 +00:00
Colin Walters
dd71d07adb spec, status: Add architecture
The argument here is twofold:

- We used to show it with ostree refs because ostree doesn't have manifest lists,
  and people may have gotten used to seeing it in e.g. bug reports
- Highlight that the digest of the image is always
  the digest of the per-arch image; we currently peel and discard manifest
  lists, which may not be obvious.

Closes: https://github.com/bootc-dev/bootc/issues/1238
Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-29 12:05:05 +00:00
Colin Walters
abf0d764ad install: Avoid context-per-recursion
Got a report over private chat of
```
ERROR Installing to filesystem: Removing boot directory content: Removing entries (noxdev): Removing entries (noxdev): Removing entries (noxdev): Read-only file system (os error 30)
```

That's ugly, we don't want a context per recursive directory entry.
Only add a context at the toplevel invokers.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-26 11:55:19 -04:00
Colin Walters
a0ff737651 Merge pull request #1106 from cgwalters/depend-updated-bootupd
bootloader: Always pass full path to bootupd
2025-03-24 10:10:41 -04:00
Colin Walters
2da6f88b85 lsm, imgstorage: Rework relabeling
The previous work here wasn't quite right in a few ways.
Our LSM/SELinux code is a bit complex and under-tested.

Here we:

First, refactor some of the labeling bits so we have a clean
"relabel this file" API.

For the bootc-owned containers-storage we don't want
"recursive create dir and relabel" in the general case - we
need to handle upgrades, where there are definitely
non-directories too.

Hence rework the API to just be a clean recursive
relabeling pass, don't attempt to create anything
on our own.

The install path hence changes to let podman create
the dirs first, then we relabel.

While we're here:

- Rework the recursive traversal to operate on shared
  single `&mut` path buffers to avoid a heap alloc per directory.
- Add a `bootc internals relabel` CLI verb that
  makes it easy to test this code both interactively
  and in integration testing.
- Add a test case

Closes: https://github.com/bootc-dev/bootc/issues/1219

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-22 15:01:06 -04:00
Colin Walters
0391fb4e2d lsm: Add some more comments
No functional changes.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-22 08:55:14 -04:00
Colin Walters
da468f5463 Merge pull request #935 from cgwalters/install-config-verity
Install with fsverity enabled + required
2025-03-21 15:48:19 -04:00
Colin Walters
da32b29a55 Merge pull request #1173 from jmarrero/etc-man
man/bootc-rollback: add information about /etc
2025-03-19 15:03:28 -04:00
John Eckersberg
0fa13e2e57 man/bootc-rollback: add information about /etc
Adds the docs from
https://gitlab.com/fedora/bootc/docs/-/merge_requests/90 to the man page.

Co-authored-by: Joseph Marrero Corchado <jmarrero@redhat.com>

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
Signed-off-by: Joseph Marrero Corchado <jmarrero@redhat.com>
2025-03-19 12:15:57 -04:00
Robert Sturla
ce3bb65e5d tests(status): add tests for --booted
Signed-off-by: Robert Sturla <robertsturla@outlook.com>
2025-03-19 01:46:21 +00:00
Colin Walters
06fc0d35cc Merge pull request #1211 from rsturla/bootc-status-booted-only
fix(status): enable --booted option to only show the current deployment
2025-03-18 20:35:34 -04:00
Robert Sturla
1418f0b98d fix(status): enable --booted option to only show the current deployment
The existing code didn't take into account the --booted options, so always
showed the staged, current and rollback deployments.  This correctly
wires through the --booted option to only show that deployment.

Stubs have been left in the code should we wish to enable options to show
only the rollback or staged options (--rollback / --staged).

No docs changes were required since the flag is already present.

Closes #465

Signed-off-by: Robert Sturla <robertsturla@outlook.com>
2025-03-18 23:40:45 +00:00
Colin Walters
769b0fb294 bootloader: Always pass full path to bootupd
This will depend on https://github.com/coreos/bootupd/pull/839

And cleans up our bootloader code; move the bootloader
partition definitions back to `install/baseline`. Conceptually
now it's just the `to-disk` flow and bootupd that
know about bootloader partition GUIDs which is how I think
it should be - the bootc core is agnostic to bootloaders.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-18 17:21:39 -04:00
Chris Kyrouac
5792a4cd9b Merge pull request #1198 from ckyrouac/storage-selinux-fix
imgstorage: Set selinux labels for imgstorage
2025-03-18 11:17:28 -04:00
ckyrouac
4b2ade55fa imgstorage: Set selinux labels for imgstorage
Running some containers (e.g. mssql) requires the imgstorage labels to
be identical to the /var/lib/containers/storage. So, this code
recursively sets the labels for the bootc storage directory to mimic
/var/lib/containers/storage. This operation is done once, then a
.bootc_labeled file is created to signify the directory was labeled.
This operation could be done anytime the storage is
accessed, i.e. on installation, upgrade, or running a `bootc image`
command.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-03-18 10:08:27 -04:00
Colin Walters
1958fe8b1b Merge pull request #1202 from rsturla/rollback-apply
feat(rollback): add `--apply` flag
2025-03-18 09:16:23 -04:00
Colin Walters
d63c1b1f72 Merge pull request #1200 from cgwalters/check-api-dirs
lint: Add an api-base-directories lint
2025-03-17 08:51:10 -04:00
Colin Walters
ff952c3c3d install: Honor composefs.enabled=verity
Key off the ostree prepare-root config to require fsverity
on all objects.

As part of this:

- Add a dependency on composefs-rs just for the fsverity querying
  APIs, and as prep for further integration.
- Add `bootc internals fsck`, which verifies the expected
  fsverity state.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-16 10:25:16 -04:00
Robert Sturla
b241b44eb7 feat(rollback): add --apply flag
Adds an --apply flag to the `bootc rollback` command to implement
automated restarts.

Have confirmed this works by building the bootc binary and running
`bootc rollback --apply` on my host.  This restarted the machine
into the new (rollback) image.

Closes #1029

Signed-off-by: Robert Sturla <robertsturla@outlook.com>
2025-03-14 01:27:42 +00:00
Colin Walters
e0a48c7661 lint: Add an api-base-directories lint
Saw in the wild that someone accidentally did an
`rm -rf /var`, and that only fails pretty late in the process.

Add a lint that hard requires the "API filesystem" directory
mount points, plus `/var` - that one is a requirement for
ostree right now.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-13 19:50:52 -04:00
Colin Walters
554c621dd0 Merge pull request #1193 from omertuc/nocleanostree
install: Do not clean boot directories on ostree systems
2025-03-13 09:56:36 -04:00
Colin Walters
154a808b34 Merge pull request #1178 from cgwalters/add-fsck
internals: Add new (experimental) `bootc internals fsck`
2025-03-13 09:13:29 -04:00
Omer Tuchfeld
c737dfd4e0 install: Do not clean boot directories on ostree systems
On ostree systems, the boot directory already has our desired format, we
should only remove the bootupd-state.json file to avoid bootupctl
complaining about it already existing.

The motivation is that this will preserve the boot entry for the
original deployment, allowing the user to boot into it if they want to.

This also makes sure `ostree admin status` continues working - since if
we're in a booted ostree system but `ostree` can't find its physically
(through boot entries) it complains.
2025-03-12 18:26:39 +01:00
Colin Walters
14bf78699b Merge pull request #1185 from cgwalters/timestamp-no-nanos
status: Drop nanoseconds from time
2025-03-11 09:57:05 -04:00
Colin Walters
7145132ea2 internals: Add new bootc internals fsck
Split this out of the fsverity PR.

We obviously want a `fsck` command. This starts by doing
just two checks:

- A verification of `etc/resolv.conf`; this tests
  98995f662b
- Just run `ostree fsck`

But obvious things we should be adding here are:

- Verifying kargs
- Verifying LBIs

etc.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-10 13:46:18 -04:00
Colin Walters
aae859f98e status: Drop nanoseconds from time
This is just irrelevant noise; nanoseconds never matter for container
builds. Motivated by just making this look visually nicer.

In the future I'd like to look at rendering this how e.g. systemd
does it also including a "; 1 day ago" humantime suffix.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-10 13:38:16 -04:00
John Eckersberg
8ac427dade Update links to new docs site
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-03-10 09:40:26 -04:00
Colin Walters
6f1bb750e6 Release 1.1.6
A fair numebr of fixes and smaller features here.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-03 08:27:10 -05:00
Colin Walters
112e36d759 install: Add a generic install finalize
Basically I want to get Anaconda to run this, then we
can perform arbitrary fixups on whatever it did
between the install and reboot without changing Anaconda's
code.

This also applies to user `%post` scripts for example;
maybe those break the bootloader entries in /boot;
we have the opportunity to catch such things here.

Or we may choose to start forcibly relabeling the target
`/etc`.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-01 13:13:29 -05:00
Colin Walters
4559d05461 lints: Add a set_root_type helper
We have two patterns to initialize a lint:

- Bare struct init
- A helper function

This changes to just one path: A helper function, plus setters
for the optional fields.

Prep for adding a new lint option, which would otherwise
require changes to everything using the bare struct init.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-26 16:50:38 -05:00
Colin Walters
00860d7006 Merge pull request #1132 from jeckersb/kargs-no-env
kargs: do not set ARCH envvar in tests
2025-02-21 13:54:33 -05:00
Colin Walters
406bfe3a46 lint: Split composefs into separate warning lint
We do want to support using bootc without composefs for now.

Closes: https://github.com/containers/bootc/issues/1135

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-21 08:23:15 -05:00
Colin Walters
b305a054eb lint: Add missing format!
This got missed when converting the errors.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-21 08:14:05 -05:00
John Eckersberg
0ca888f8af kargs: do not set ARCH envvar in tests
std::env::set_var is unsafe in 2024 edition, and upon looking into
that this use in the kargs test came up.  We don't need to set the
environment variable here, in fact I don't think this ever worked in
the first place.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-02-20 14:35:14 -05:00
Colin Walters
bf10e34ff4 lints: use PathQuotedDisplay for tmpfiles
This is more readable.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-14 10:49:23 -05:00
Colin Walters
41546ab808 lint: Add a sysusers lint
This is not exhaustive yet, but catches things that invoke
`useradd` (whether a dpkg/rpm `%post` or just a plain `RUN useradd` in a container)
that don't have a sysusers.d entry.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-14 10:49:23 -05:00
Colin Walters
f222c1ee6b Merge pull request #1110 from cgwalters/copy-to-storage-init-c-storage
storage: Ensure global c/storage is initialized via podman
2025-02-13 11:50:12 -05:00