7179 Commits

Author SHA1 Message Date
Colin Walters
8df797d355
Merge pull request #3389 from jlebon/pr/drop-finalize-staged-path
boot: Drop ostree-finalize-staged.path
2025-03-10 15:57:54 -04:00
Jonathan Lebon
2b9912e9f9
boot: Drop ostree-finalize-staged.path
This effectively reverts ac1a919f ("boot: Add
ostree-finalize-staged.path").

A bug came in on the OCP side that demonstrates that the way things are
setup right now is racy. If a reboot is triggered quickly after staging
a deployment, the whole pipeline of:

- ostree-finalize-staged.path, which triggers
- ostree-finalize-staged.service, which triggers
- ostree-finalize-staged-hold.service,

may not fully have happened before systemd isolates to `reboot.target`
which will want to kill all pending jobs.

Just directly starting the systemd unit is less elegant but much more
explicit and gets rid of any possible race because it's directly part of
the staging operation.

Fixes: https://issues.redhat.com/browse/OCPBUGS-51150
2025-03-07 17:11:44 -05:00
Colin Walters
364e22f19c
Merge pull request #3385 from cgwalters/log-xattr-conflict
core: Fix bare-user xattr canonicalization
2025-02-25 16:42:36 -05:00
Colin Walters
37961d3d9e core: canonicalize bare-user xattrs
Previously we were erroring out if xattrs were provided in
non-canonical (e.g. unsorted) form all the way down to just
the bare-user path. But for archive repos and dirmeta we
canonicalized.

Canonicalize bare-user xattrs on both read and write consistently
instead of erroring.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-25 14:58:35 -05:00
Colin Walters
0c55f68006 tests/basic: Add lots of user. xattrs
This exercises our requirement for xattr sorting.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-25 14:58:35 -05:00
Colin Walters
b0c4712e0d commit: Add errprefix for bareuser metadata
To aid debugging.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-25 14:58:35 -05:00
Colin Walters
ab9a3b02a9 core: Print which xattrs are not sorted
I hit this in the rpm-ostree rechunker flow somehow
and with this change I now get:

`error: Generating commit from rootfs: Processing dir var: Writing content object: Incorrectly sorted xattr name (prev=user.Librepo.checksum.mtime, cur=security.selinux), index=2`

which is more useful, although I still need to figure out
and fix why that's happening (again?).

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-25 14:58:35 -05:00
Colin Walters
82b660b12d
Merge pull request #3382 from alyssais/private
libostree: add private dependencies to pkg-config
2025-02-14 08:34:42 -05:00
Colin Walters
1c0e754f19
Merge pull request #3383 from alyssais/libmount
libostree: remove unused libmount include
2025-02-14 08:30:49 -05:00
Alyssa Ross
8afde45f9a
libostree: remove unused libmount include
As far as I can tell, this hasn't been used since
9a526bba ("sysroot: Handle ro /boot but rw /sysroot").
2025-02-14 12:29:46 +01:00
Alyssa Ross
cb1d0ad0b9
libostree: add private dependencies to pkg-config
This makes it possible to use pkg-config to link against libostree as
a static library.  Unlike shared libraries, static libraries don't
encode their dependencies in the library file, so we have to
communicate them via pkg-config.
2025-02-14 12:26:11 +01:00
Jonathan Lebon
1aa381a25d
Merge pull request #3381 from cgwalters/set-log-cb
sepolicy: Add ostree_sepolicy_set_null_log
2025-02-10 17:09:54 -05:00
Colin Walters
68d70de6c6 sepolicy: Add ostree_sepolicy_set_null_log
Let's quiet the output of libselinux by default, all we
get is the pointless "regex version mismatch" warnings.
This is what e.g. systemd does.

This is exposed via the library; our binary opts in,
then we expect higher level tools like e.g. bootc to
do this too.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-10 15:24:52 -05:00
Colin Walters
303c2a23a2
Merge pull request #3377 from cgwalters/log-require-verity
prepare-root: Log when we're mounting with verity required
2025-02-03 13:17:54 -05:00
Colin Walters
5dce6456cc
Merge pull request #3379 from nikita-dubrovskii/pvimg
zipl: remove 'sdboot' image before generating new one
2025-02-03 12:40:37 -05:00
Colin Walters
6b4e79ce9e
Merge pull request #3378 from cgwalters/update-gir-follow
Update gir followup
2025-02-03 09:50:19 -05:00
Nikita Dubrovskii
0c25931b13 zipl: remove 'sdboot' image before generating new one 2025-02-03 13:31:17 +01:00
Colin Walters
1583090622 rust: Update to glib 0.20
Since we're releasing a new version of our crates,
let's update to the latest.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-01 13:49:32 -05:00
Colin Walters
b89f209a09 rust: Regenerate with correct Since
To ensure the recent kexec_load API has a feature gate.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-01 13:38:21 -05:00
Colin Walters
533c8b9281 lib: Add missing Since annotations to two recent APIs
On general principle, but specfiically this is needed
to ensure the Rust binding generator correctly handles
feature flags for them.
2025-02-01 13:36:07 -05:00
Colin Walters
968b0b14e2
Merge pull request #3376 from Mstrodl/feature/mstrodl/update-gir
Update GIR
2025-02-01 12:53:05 -05:00
Mary Strodl
f8a57baecf Cargo: bump MSRV, need c-string literals
Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-01 10:53:21 -05:00
Mary Strodl
75a2994329 rust-bindings/tests: Display no longer implemented, but Debug is
Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-01 10:53:21 -05:00
Mary Strodl
0c9cf4809c rust-bindings: Regenerate Bindings
Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-01 10:53:21 -05:00
Mary Strodl
3cb8d7932b rust-bindings: upgrade gir and dependencies
Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-01 10:53:21 -05:00
Colin Walters
863890804b prepare-root: Log when we're mounting with verity required
On general principle, but specifically as I wanted to cross-check
this when debugging something else.
2025-02-01 10:23:29 -05:00
Colin Walters
c0f8db17ef
Merge pull request #3375 from fossdd/musl
libotutil: Remove redundant import of prctl.h
2025-01-27 13:55:08 -05:00
fossdd
e82bb38adf
libotutil: Remove redundant import of prctl.h
sys/prctl.h already provides prctl.h and adding both imports fails on
musl libc:

	/usr/include/sys/prctl.h:88:8: error: redefinition of 'struct prctl_mm_map'
	   88 | struct prctl_mm_map {
	      |        ^~~~~~~~~~~~
	In file included from src/libotutil/ot-unix-utils.c:33:
	/usr/include/linux/prctl.h:134:8: note: originally defined here
	  134 | struct prctl_mm_map {
	      |        ^~~~~~~~~~~~
2025-01-27 17:49:39 +01:00
Colin Walters
24d47308e9
Merge pull request #3370 from igoropaniuk/contribute_updates
docs: update Dockerfile
2025-01-20 15:17:11 -05:00
Colin Walters
1ae8113c2a
Merge pull request #3371 from jmarrero/release-2025.1
Release 2025.1
2025-01-16 10:03:22 -05:00
Joseph Marrero Corchado
238192c64f configure: post-release version bump 2025-01-15 13:14:43 -05:00
Joseph Marrero Corchado
372c4444dd Release 2025.1 v2025.1 2025-01-15 13:11:04 -05:00
Igor Opaniuk
12f850a8d3 docs: update Dockerfile
Fix issues in Dockerfile:
1. Update Fedora image to the latest version 41, otherwise docker build
   fails with an error:

   Step 1/7 : FROM registry.fedoraproject.org/fedora:28
   manifest for registry.fedoraproject.org/fedora:28 not found: manifest unknown: manifest unknown

2. Force install python3-yaml package, as it's required for running some
   tests. For example, tests/test-remote-headers.sh will fail without
   it:

   V=$($CMD_PREFIX ostree --version | \
       python3 -c 'import sys, yaml; print(yaml.safe_load(sys.stdin)["libostree"]["Version"])')
   Traceback (most recent call last):
   File "<string>", line 1, in <module>
    import sys, yaml; print(yaml.safe_load(sys.stdin)["libostree"]["Version"])
    ^^^^^^^^^^^^^^^^
   ModuleNotFoundError: No module named 'yaml'

With these fixes `make check` executes successfully in a container:
============================================================================
Testsuite summary for libostree 2024.11
============================================================================
 TOTAL: 935
 PASS:  888
 SKIP:  47
 XFAIL: 0
 FAIL:  0
 XPASS: 0
 ERROR: 0

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
2025-01-15 17:16:03 +01:00
Jonathan Lebon
639db09ea0
Merge pull request #3366 from cgwalters/unconditional-cfs 2025-01-10 10:41:54 -05:00
Colin Walters
20ff0865c7 Always generate composefs blob, don't enable runtime by default
Followup to 9a0acd7249

Basically our composefs enablement flag has long had a tension between
trying to do two things:

- Enable generating the composefs blob (at deployment time)
- Enable at runtime in prepare-root

And we've hit issues in "ratcheting" enabling composefs
across upgrades because of this.

This change builds on the previous one, and now it's really
simple to talk about:

- If composefs is enabled at build time, we *always*
  generate a composefs blob at deplyment time
- Configuring the prepare-root config now mostly
  only affects the runtime state.

There is one detail though: in order to handle the
verity requirement at deploy time, we do still parse
the config then.

But for the basic "is composefs enabled at all at runtime"
that is now fully keyed off the config, not the build time
or (worse) whether the deployment happened to have a composefs
blob.

For users who want composefs on, they need to do so in the base
image configuration.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-01-10 08:04:50 -05:00
Jonathan Lebon
8049711e5c
Merge pull request #3367 from cgwalters/clang-format 2025-01-09 15:35:43 -05:00
Colin Walters
014c965578 tree-wide: Rerun clang-format, update ci
We have drift again here because we're using an old clang-format
in CI, and some things have landed that it didn't catch.

And update clang-format to ubuntu-24.04 so we are running
against something more modern.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-01-09 13:29:51 -05:00
Colin Walters
ce4e49e1f4
Merge pull request #3364 from ruihe774/geteuid
chore: Use geteuid() instead of getuid() to check privilege
2025-01-02 09:23:16 -05:00
Colin Walters
655e4671d8
Merge pull request #3362 from Mstrodl/feature/mstrodl/kexec2
bin/admin-upgrade: add kexec support
2025-01-02 09:20:41 -05:00
Mary Strodl
b04cb8f40f bin/admin-upgrade: add kexec support
Adds a new `--kexec` flag to `ostree admin upgrade` which will cause
the deployment to be loaded into kexec after the upgrade completes.
It is particularly useful in conjunction with the `--reboot` flag to
perform a reboot into the new deployment without waiting for the
(often slow) firmware initialization to take place. (And in my case,
allows me to avoid a normal reboot, which can be unreliable on my
hardware).

After an image has been loaded (using the `kexec_file_load` syscall),
the `systemctl-reboot` command (which is called when the existing
`-r` flag is included) will trigger a kexec on the loaded image
rather than a normal reboot. From `systemctl(1)`:

  If a new kernel has been loaded via kexec --load, a kexec will be
  performed instead of a reboot, unless "SYSTEMCTL_SKIP_AUTO_KEXEC=1"
  has been set. If a new root file system has been set up on
  "/run/nextroot/", a soft-reboot will be performed instead of a
  reboot, unless "SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT=1" has been set.

A good in-depth technical explanation of kexec can be found here:
https://web.archive.org/web/20090505132901/http://www.ibm.com/developerworks/linux/library/l-kexec.html

My implementation uses the `kexec_file_load` syscall rather than the
older `kexec_load` syscall, which allows the kernel to verify the
signatures of the new kernel. It is supported on Linux 3.17 and
newer. I assume this probably won't be an issue, but if it is, it's
not that hard to put a preprocessor directive around the kexec stuff
to disable it for older kernels. Even RHEL is new enough now to
not be an issue :)

Closes: #435
2024-12-23 13:59:37 -05:00
Misaki Kasumi
f9bf9ac560 chore: Check CAP_SYS_ADMIN in ot_util_process_privileged 2024-12-20 20:35:08 +08:00
Misaki Kasumi
1bd9aa6461 chore: Use geteuid() instead of getuid() to check privilege 2024-12-20 19:13:59 +08:00
Colin Walters
8aaea0c65d
Merge pull request #3361 from cgwalters/release
Release 2024.10
v2024.10
2024-12-19 17:10:40 -05:00
Colin Walters
45ddf3b798
Merge pull request #3351 from cgwalters/fix-transient-root-doc
man: Note semantics combining `root.transient` with `composefs.enabled`
2024-12-19 16:23:48 -05:00
Colin Walters
aca6f17ff8 Post-release version bump
Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-19 15:11:42 -05:00
Colin Walters
66f5a77ae6 Release 2024.10
Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-19 15:10:12 -05:00
Colin Walters
786b38c2cf man: Note semantics combining root.transient with composefs.enabled
It's all quite confusing having to reason about both the pre-composefs
ostree and the composefs version. But hopefully soon we more firmly
leave behind that first legacy.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-17 16:04:38 -05:00
Colin Walters
64a38aec8c
Merge pull request #3353 from jlebon/pr/composefs-maybe
libostree/deploy: enable composefs by default
2024-12-17 15:34:37 -05:00
Colin Walters
1c68410368
Merge pull request #3354 from ruihe774/cfs-verity
prepare-root: Add composefs.enabled=verity
2024-12-17 14:59:00 -05:00
Colin Walters
08395e2479
Merge pull request #3348 from qiuzhiqian/main
rofiles-fuse: when fuse execution fails, rofiles-fuse still returns exit code 0
2024-12-17 14:22:10 -05:00