Colin Walters [Tue, 19 Jun 2018 13:34:18 +0000 (09:34 -0400)]
Drop "ostree trivial-httpd" CLI, move to tests directory
See https://github.com/ostreedev/ostree/issues/1593
Basically this makes it easier for people packaging, as the trivial-httpd
is only for tests, and this way the binary will live with the tests.
Also at this point nothing should depend on `ostree trivial-httpd`.
Dan Nicholson [Thu, 29 Jun 2023 08:16:52 +0000 (02:16 -0600)]
Merge pull request #2911 from cgwalters/fix-generator-regression
Fix return value of generator on non-ostree systems
Colin Walters [Thu, 29 Jun 2023 06:38:00 +0000 (02:38 -0400)]
Merge pull request #2910 from cgwalters/more-ci-fixes
ci: Fix executability
Joseph Marrero Corchado [Wed, 28 Jun 2023 23:44:52 +0000 (19:44 -0400)]
Merge pull request #2907 from cgwalters/test-composefs
tests: Source libtest before exiting
Colin Walters [Tue, 27 Jun 2023 10:59:51 +0000 (06:59 -0400)]
test-composefs: Sync flow with other tests
I am not sure why this is failing on older Debian systems,
but I'm wildly guessing that something being done in `libtest.sh`
is setting up automake in a way that we need. This is done
in other tests.
Or maybe it's the missing `$CMD_PREFIX`? Let's see...
Colin Walters [Wed, 28 Jun 2023 15:45:15 +0000 (11:45 -0400)]
Fix return value of generator on non-ostree systems
Commit
aa72caffb540114a0e8635ab2990b9c8b0b8f9db
regressed the `ostree-system-generator` on non-ostree systems.
If there's no `ostree=` karg, we need to just exit 0.
Closes: https://github.com/ostreedev/ostree/issues/2909
Fixes: aa72caffb540114a0e8635ab2990b9c8b0b8f9db
Colin Walters [Wed, 28 Jun 2023 06:37:31 +0000 (02:37 -0400)]
ci: Fix executability
Colin Walters [Tue, 27 Jun 2023 21:16:18 +0000 (17:16 -0400)]
Merge pull request #2904 from cgwalters/prow-ci
ci/prow: Build tests before trying to install
Joseph Marrero Corchado [Tue, 27 Jun 2023 13:55:15 +0000 (09:55 -0400)]
Merge pull request #2906 from cgwalters/compiletest-static-prepareroot
ci: Add "it compiles" coverage for --with-static-compiler
Colin Walters [Tue, 27 Jun 2023 10:26:08 +0000 (06:26 -0400)]
ci: Add "it compiles" coverage for --with-static-compiler
Prep for further changes.
Colin Walters [Tue, 27 Jun 2023 09:27:23 +0000 (05:27 -0400)]
ci/prow: Build tests before trying to install
Our `install` target doesn't depend on `all` unlike the
rpm-ostree version; not doing so is arguably better, so let's
explicitly build before installing.
Colin Walters [Tue, 27 Jun 2023 06:50:49 +0000 (02:50 -0400)]
Merge pull request #2902 from ericcurtin/ostree-aboot-pass-options
bootloader: Pass "options" to aboot bootloader backend
Colin Walters [Tue, 27 Jun 2023 04:18:17 +0000 (00:18 -0400)]
Merge pull request #2901 from cgwalters/revert-fetcher-change
Revert "fetcher: Always open tmpfiles in repo location"
Colin Walters [Mon, 26 Jun 2023 09:17:45 +0000 (05:17 -0400)]
Revert "fetcher: Always open tmpfiles in repo location"
This reverts commit
f7f6f87c513c9f35bc24f35e909779c19cb49d3a.
This seems to have broken flatpak, so we'll revert and then
investigate.
Closes: https://github.com/ostreedev/ostree/issues/2900
Dan Nicholson [Mon, 26 Jun 2023 23:08:48 +0000 (17:08 -0600)]
Merge pull request #2903 from dbnicholson/composefs-digest-fix
prepare-root: Adjust to composefs mount struct changes
Dan Nicholson [Mon, 26 Jun 2023 15:47:00 +0000 (09:47 -0600)]
prepare-root: Adjust to composefs mount struct changes
This fixes a regression from the latest composefs submodule update in
1582edd1d4a6b26874d3897de8a5586f979a0715. In composefs commit
7560a4fd388481f479c0b3fc2e6d20c6321d9b74 the struct field was changed
from the generic `expected_digest` with the thought that there may be
other signatures or digests in the future.
Eric Curtin [Mon, 26 Jun 2023 10:44:32 +0000 (11:44 +0100)]
bootloader: Pass "options" to aboot bootloader backend
aboot-deploy must know where the next root filesystem to boot is to set
up a symlink /ostree/root.a or /ostree/root.b , this location is in the
ostree= part of these passed in options.
Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Colin Walters [Wed, 21 Jun 2023 12:06:52 +0000 (08:06 -0400)]
Merge pull request #2896 from akiernan/main
lib/deploy: Use off_t not __off_t
Alex Kiernan [Tue, 20 Jun 2023 18:24:04 +0000 (19:24 +0100)]
lib/deploy: Use off_t not __off_t
Not clear why this was __off_t which is the sole appearance in the code
base, but it breaks musl builds.
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Joseph Marrero Corchado [Tue, 20 Jun 2023 16:25:17 +0000 (12:25 -0400)]
Merge pull request #2895 from cgwalters/release
Release 2023.4
Joseph Marrero Corchado [Tue, 20 Jun 2023 16:22:49 +0000 (12:22 -0400)]
Merge pull request #2893 from cgwalters/update-prow-config
ci: Add some composefs testing
Colin Walters [Tue, 20 Jun 2023 15:01:57 +0000 (11:01 -0400)]
Merge pull request #2892 from ostreedev/dependabot/submodules/composefs-
08bdb03
build(deps): bump composefs from `
c9188cd` to `
08bdb03`
Colin Walters [Tue, 20 Jun 2023 13:39:43 +0000 (09:39 -0400)]
configure: post-release version bump
Colin Walters [Tue, 20 Jun 2023 13:39:04 +0000 (09:39 -0400)]
Release 2023.4
Colin Walters [Tue, 20 Jun 2023 11:44:38 +0000 (07:44 -0400)]
Merge pull request #2891 from cgwalters/commit-compute-composefs-digest
lib: Rework composefs metadata, drop custom signatures
Colin Walters [Mon, 19 Jun 2023 23:07:01 +0000 (19:07 -0400)]
ci: Sync prow config with rpm-ostree, enable composefs there
I want to gain testing over the composefs path; but without
yet changing the main Jenkins build. Because we have duplicate/overlapping
CI systems, we can take advantage of this by testing the composefs
flow via Prow.
Sync the Prow build scripts with what's in coreos/rpm-ostree
right now.
Then let's test the composefs flow a bit more e2e there.
Colin Walters [Mon, 19 Jun 2023 23:02:20 +0000 (19:02 -0400)]
tests: Add a sanity check for composefs
Prep for adding some coverage of this flow when booting with
composefs.
Colin Walters [Mon, 19 Jun 2023 21:29:08 +0000 (17:29 -0400)]
docs/composefs: Updates
- fix URL
- Document requirements
- Document kernel argument
- Adjust for recent changes
dependabot[bot] [Mon, 19 Jun 2023 12:59:34 +0000 (12:59 +0000)]
build(deps): bump composefs from `
c9188cd` to `
08bdb03`
Bumps [composefs](https://github.com/containers/composefs) from `
c9188cd` to `
08bdb03`.
- [Release notes](https://github.com/containers/composefs/releases)
- [Commits](https://github.com/containers/composefs/compare/
c9188cd1f80374d0785e90d2e4d31749b9f91395...
08bdb030fcff4f55ef63aa828b09b57a6cd4d234)
---
updated-dependencies:
- dependency-name: composefs
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
Colin Walters [Fri, 16 Jun 2023 19:35:50 +0000 (15:35 -0400)]
lib: Rework composefs metadata, drop custom signatures
We will be switching to handling signature verification of
the target ostree commit.
Colin Walters [Sat, 17 Jun 2023 15:30:49 +0000 (11:30 -0400)]
Merge pull request #2890 from cgwalters/composefs-err-frees
composefs: Avoid double free in error path
Colin Walters [Fri, 16 Jun 2023 18:52:53 +0000 (14:52 -0400)]
composefs: Avoid double unref
The interaction of `iter_loop` and autofree is way too subtle;
I happened to be reading this code and noticed we did the NULL
reset in one path but not another.
The real fix is Rust...
Joseph Marrero Corchado [Fri, 16 Jun 2023 18:26:01 +0000 (14:26 -0400)]
Merge pull request #2885 from cgwalters/doc-composefs
composefs: Add some basic docs
Colin Walters [Thu, 15 Jun 2023 21:35:45 +0000 (17:35 -0400)]
Merge pull request #2886 from daissi/wip/daissi/disable-http2
ostree-fetcher-curl: explicitly use HTTP1.1 when HTTP2 is disabled
Dan Nicholson [Thu, 15 Jun 2023 19:25:12 +0000 (13:25 -0600)]
Merge pull request #2888 from cgwalters/more-error-prefixing
Add more error prefixing when parsing commit objects
Colin Walters [Thu, 15 Jun 2023 18:26:12 +0000 (14:26 -0400)]
Add more error prefixing when parsing commit objects
I've got more debug information in the error case that motivated
https://github.com/ostreedev/ostree/pull/2884/commits/
bae4347abeaa2a66d213758f790058f42cb71fd1
"pull: Add error prefixing for corrupt checksums"
where the sole error is
`error: Invalid checksum of length 0 expected 32`
This must be coming from the pull code in the case where we've
already fetched the commit object.
- Add some error prefixing here in the core commit validation code
- Ensure that we do the validation immediately after loading, including
of the parent commit reference where I think this error must be coming
from
- Then the pull code can just safely call `ostree_commit_get_parent`
which already does the hex conversion etc.
Dylan Aïssi [Thu, 15 Jun 2023 12:29:47 +0000 (14:29 +0200)]
ostree-fetcher-curl: explicitly use HTTP1.1 when HTTP2 is disabled
The current logic to select the HTTP version to be use relies on
the fact that curl don't use by default HTTP2. This assumption seems wrong with
recent versions of curl.
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
Colin Walters [Wed, 14 Jun 2023 20:37:02 +0000 (16:37 -0400)]
composefs: Add some basic docs
Let's describe the state of things at a high level, independent
of the tracking issue which has a lot more detail (and hence noise).
This document keeps things at a high level and describes how to
enable things today.
Dan Nicholson [Wed, 14 Jun 2023 18:09:47 +0000 (12:09 -0600)]
Merge pull request #2880 from kraj/main
fix build with lld linker
Khem Raj [Mon, 12 Jun 2023 21:04:44 +0000 (14:04 -0700)]
libostree: Link with libgpg-error for gpg_strerror_r API
With
f461c02bb55bf2853a3b81ed5c8618040ab54e98 use of gpg_strerror_r
was added this symbol comes from libgpg-error however, therefore its
needed to add -lgpg-error to cmdline to resolve this symbol especially
with gold and lld linker. Fixes
aarch64-yoe-linux-ld.lld: error: undefined reference due to --no-allow-shlib-undefined: gpg_strerror_r
>>> referenced by ./.libs/libostree-1.so
Dan Nicholson [Wed, 14 Jun 2023 16:29:46 +0000 (10:29 -0600)]
Merge pull request #2884 from cgwalters/errprefix-pull-checksums
pull: Add error prefixing for corrupt checksums
Colin Walters [Wed, 14 Jun 2023 15:19:44 +0000 (11:19 -0400)]
pull: Add error prefixing for corrupt checksums
I got a bug report with the bare error
```
error: Invalid checksum of length 0 expected 32
```
And I'm pretty sure it's from here. Add error prefixing so we
know exactly which metadata object was corrupt.
Colin Walters [Wed, 14 Jun 2023 13:36:06 +0000 (09:36 -0400)]
Merge pull request #2881 from ostreedev/dependabot/submodules/composefs-
c9188cd
build(deps): bump composefs from `
af8e1a7` to `
c9188cd`
Dan Nicholson [Tue, 13 Jun 2023 22:36:32 +0000 (16:36 -0600)]
Merge pull request #2882 from cgwalters/more-test-concurrency
test-concurrency: Don't lower timeout
Colin Walters [Tue, 13 Jun 2023 20:17:16 +0000 (16:17 -0400)]
test-concurrency: Don't lower timeout
I think there's never been a real race condition here. Instead
the problem is:
- We have a timeout on the lock, after which we error out (30s)
- This test actually *lowers* the timeout
Looking through the failures for test-concurrency what I see
is
`error: Locking repo exclusive failed: Resource temporarily unavailable`
which is us hitting the timeout.
Hardcoded timeouts are just going to be subject to race conditions.
I understand not wanting to block forever in some cases, but any
arbitrary timeout is just going to get hit in real world conditions
too.
Anyways for now, stop shooting ourselves in the foot and at least
keep the timeout at the default.
Closes: https://github.com/ostreedev/ostree/issues/2038
Dan Nicholson [Tue, 13 Jun 2023 15:02:48 +0000 (09:02 -0600)]
Merge pull request #2865 from barthalion/increase-metadata-size
Increase the metadata size limit to 128MB
Bartłomiej Piotrowski [Fri, 26 May 2023 10:26:05 +0000 (12:26 +0200)]
Update big metadata size in test-pull-large-metadata
dependabot[bot] [Tue, 13 Jun 2023 12:58:56 +0000 (12:58 +0000)]
build(deps): bump composefs from `
af8e1a7` to `
c9188cd`
Bumps [composefs](https://github.com/containers/composefs) from `
af8e1a7` to `
c9188cd`.
- [Release notes](https://github.com/containers/composefs/releases)
- [Commits](https://github.com/containers/composefs/compare/
af8e1a7cf6864c27e2ceac44cc145bd78734df30...
c9188cd1f80374d0785e90d2e4d31749b9f91395)
---
updated-dependencies:
- dependency-name: composefs
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
Alexander Larsson [Sat, 10 Jun 2023 15:36:03 +0000 (17:36 +0200)]
Merge pull request #2879 from alexlarsson/composefs-new-signature-approach
composefs: Change how we do signatures
Alexander Larsson [Thu, 8 Jun 2023 09:51:29 +0000 (11:51 +0200)]
composefs: Change how we do signatures
Currently we generate a signature for the actual composefs image, and
then we apply that when we enable fsverity on the composefs
image. However, there are some issues with this.
First of all, such a signed fs-verity image file can only be read if
the corresponding puiblic keyring is loaded into the fs-verity
keyring. In a typical secure setup we will have a per-commit key that
is loaded from the initrd. Additionally, the keyring is often sealed
to avoid loading more keys later.
This means you can only ever mount (or even look at) composefs images
from the current boot. While this is not a huge issue it is something
of a pain for example when debugging things.
Secondly, and more problematic, during a deploy we can't enable
fs-verity on the newly created composefs file, because and at that
point you need to pass in the signature. Unfortunately this will fail
if the matching public key is not in the keyring, which will fail for
similar reasons as the first issue.
The current workaround is to *not* enable fs-verity during deploy, but
write the signature to a file. Then the first time the particular
commit is booted we apply the signature to the iamge. This works
around issue two, but not issue one. But it causes us to do a lot of
writes and computation during the first boot as we need to write the
fs-verity merkle tree to disk. It would be much better and robust if
the merkle tree could be written during the deployment of the update
(i.e. before boot).
The new apporach is to always deploy an unsigned, but fs-verity
enabled composefs image. Then we create separate files that contain
the expected digest, and a signature of that file. On the first boot
we sign the digest file, and on further boots we can just verify
that it is signed before using it.
This fixes issue 1, since all deploys are always readable, and it
makes the workaround for issue 2 much less problematic, as we only
need to change a much smaller file on the first boot.
Long term I would like to avoid the first-boot writing totally, and
I've been chatting with David Howells (kernel keyring maintainer) and
he proposed adding a new keyring syscall that verifies a PKCS#7
signature from userspace directly. This would be exactly what
fs-verity does, except we wouldn't have to write the digest to disk
during boot, we would just read the digest file and the signature file
each boot and ask the kernel to verify it.
Colin Walters [Fri, 9 Jun 2023 11:56:25 +0000 (07:56 -0400)]
Merge pull request #2877 from ericcurtin/ostree-aboot
Add ostree=aboot for signed Android Boot Images
Alexander Larsson [Thu, 8 Jun 2023 07:40:09 +0000 (09:40 +0200)]
Update submodule: composefs
We will need the new fsverity computation helpers.
Eric Curtin [Thu, 8 Jun 2023 13:10:16 +0000 (14:10 +0100)]
Fix read_proc_cmdline_key ("ot-composefs") memory leak
Make it an autofree_char rather than a char
Eric Curtin [Thu, 8 Jun 2023 11:40:28 +0000 (12:40 +0100)]
Add ostree=aboot for signed Android Boot Images
Some kernel images are delivered in a signed kernel + cmdline +
initramfs + dtb blob. When this is added to the commit server side, only
after this do you know what the cmdline is, this creates a recursion
issue. To avoid this, in the case where we have ostree=aboot karg
set, create a symlink after deploy to the correct ostree target in the
rootfs, as the cmdline can't be malleable and secured client-side at
the same time.
Colin Walters [Wed, 7 Jun 2023 17:34:56 +0000 (13:34 -0400)]
Merge pull request #2875 from cgwalters/tempf-always-repo
fetcher: Always open tmpfiles in repo location
Alexander Larsson [Wed, 7 Jun 2023 08:52:06 +0000 (10:52 +0200)]
Merge pull request #2872 from cgwalters/composefs-followups
Composefs followups
Colin Walters [Tue, 6 Jun 2023 21:09:30 +0000 (17:09 -0400)]
fetcher: Always open tmpfiles in repo location
In an installation environment (like a live ISO) we may
not have significant space outside of the target installation
repository.
There's no reason not to always open a linkable tempfile. In
the future we should fix the pull path to verify the checksum
and then just directly link in the object instead of copying.
Closes: https://github.com/ostreedev/ostree/issues/2571
Colin Walters [Tue, 6 Jun 2023 16:37:41 +0000 (12:37 -0400)]
Merge pull request #2874 from aospan/inode64-fix
commit: fix ostree deployment on 64-bit inode fs
Abylay Ospan [Tue, 6 Jun 2023 02:13:14 +0000 (02:13 +0000)]
commit: fix ostree deployment on 64-bit inode fs
This commit addresses a bug that was causing ostree deployment
to become corrupted on the large fs, when any package was installed using
'rpm-ostree install'.
In such instances, multiple files were assigned the same inode. For
example, the '/home' directory and a regular file 'pkg-get' were
assigned the same inode (
2147484070), making the deployment unusable.
A root cause analysis was performed, running the process under gdb,
which revealed a lossy conversion from guint64 to guint32, for example
6442451366 converted to
2147484070:
(gdb) p name
$10 = 0x7fe9224d2d70 "home"
(gdb) p inode
$73 =
6442451366
(gdb) s
device=66311, modifier=0x7fe914791840) at
src/libostree/ostree-repo-commit.c:1590
The conversion resulted in entirely independent files potentially
receiving the same inode.
The issue was discovered on PoC machine equipped with a large NVME
(3.4TB), but the bug can be easily reproduced using `cosa run -m 4000
--qemu-size +3TB', followed by installation of any package using
`rpm-ostree install`. The resulting deployment will be unusable due to
many files being "corrupted" by the aforementioned issue.
Colin Walters [Sat, 3 Jun 2023 13:12:09 +0000 (09:12 -0400)]
prepare-root: More logging in composefs, minor cleanup
- Hoist the `.ostree.cfs` to a shared constant
- Add more logging in general for extra visibility
Colin Walters [Fri, 2 Jun 2023 17:10:12 +0000 (13:10 -0400)]
prepare-root: Add another missing O_CLOEXEC
Colin Walters [Fri, 2 Jun 2023 14:59:34 +0000 (10:59 -0400)]
composefs: Factor out a shared helper for setting error
To keep the error messages consistent.
Colin Walters [Fri, 2 Jun 2023 13:28:19 +0000 (09:28 -0400)]
mount-util: Add missing O_CLOEXEC
Seen in review.
Colin Walters [Fri, 2 Jun 2023 13:26:04 +0000 (09:26 -0400)]
Merge pull request #2640 from alexlarsson/composefs
Add initial composefs integration
Colin Walters [Thu, 1 Jun 2023 14:34:13 +0000 (10:34 -0400)]
Merge pull request #2871 from dustymabe/dusty-fallocate-einval
lib/deploy: skip fallocate call when requested size is 0
Dusty Mabe [Thu, 1 Jun 2023 13:23:41 +0000 (09:23 -0400)]
lib/deploy: skip fallocate call when requested size is 0
If the requested size is 0 then of course we have enough room 🙂
This avoids the fallocate call returning an EINVAL.
Closes: #2869
Colin Walters [Thu, 1 Jun 2023 12:24:48 +0000 (08:24 -0400)]
Merge pull request #2870 from dustymabe/dusty-log-messages
lib/deploy: Disambiguate error messages for early prune space check
Dusty Mabe [Thu, 1 Jun 2023 04:00:28 +0000 (00:00 -0400)]
lib/deploy: Disambiguate error messages for early prune space check
Having the same error message in multiple places means it's not
clear which case failed. Let's make them unique.
Alexander Larsson [Wed, 31 May 2023 16:35:44 +0000 (18:35 +0200)]
composefs: When using signatures, delay application until first boot
We can't safely apply the fs-verity with signature until we have
booted with the new initrd, because the public key that matches the
signature is loaded from it. So, instead we save the .sig file next
to the compoosefs, and on the first boot we detect that it is there, and
the composefs file isn't fs-verity, so we apply it.
Things get a bit more complex due to having to temporarily make
/sysroot read-write for the fsverity operation too.
Alexander Larsson [Tue, 23 May 2023 14:37:16 +0000 (16:37 +0200)]
CI: Build with composefs on some versions
This enables --with-composefs on:
* Fedora Latest
* Debian Testing
* Ubuntu Latest
These all should have new enough version of dependencies.
Alexander Larsson [Tue, 23 May 2023 08:31:23 +0000 (10:31 +0200)]
Update submodule: composefs
Instead of using pkg-config, etc we just include composefs.
In the end the library is just 5 c source files, and it is set up
to be easy to use as a submodule.
For now, composefs support is disabled by default.
Alexander Larsson [Fri, 26 May 2023 10:53:57 +0000 (12:53 +0200)]
ostree-remount: Don't skip remount if root is composefs
When using composefs the root fs will always be read-only, but in this
case we should still continue remounting /sysroot. So, we record a
/run/ostree-composefs-root.stamp file in ostree-prepare-root if composefs
is used, and then react to it in ostree-remount.
Alexander Larsson [Tue, 16 May 2023 08:17:32 +0000 (10:17 +0200)]
sysroot: Ensure deployment detection works when using composefs
In the case of composefs, we cannot compare the devino of the rootfs
and the deploy dir, because the root is the composefs mount, not a
bind mount. Instead we check the devino of the etc subdir of the
deploy, because this is a bind mount even when using composefs.
Alexander Larsson [Thu, 30 Jun 2022 12:53:13 +0000 (14:53 +0200)]
prepare-root: Support using composefs as root filesystem
This changes ostree-prepare-root to use the .ostree.cfs image as a
composefs filesystem, instead of the checkout.
By default, composefs is used if support is built in and the .ostree.cfs
file exists in the deploy dir, otherwise we fall back to the old
method. However, if the ot-composefs kernel option is specified this
can be tweaked as per:
* off: Never use composefsz
* maybe: Use if possible
* on: Fail if not possible
* signed: Fail if the cfs image is not fs-verity signed with
a key in the keyring.
* digest=....: Fail if the cfs image does not match the specified
digest.
The final layout when composefs is active is:
/ ro overlayfs mount for composefs
/sysroot "real" root
/etc rw bind mount to $deploydir/etc
/var rw bind mount to $vardir
We also specify the $deploydir/.ostree-mnt directory as the (internal)
mountpoint for the erofs mount for composefs. This can be used to map
the root fs back to the deploy id/dir in use,
A further note: I didn't test the .usr-ovl-work overlayfs case, but a
comment mentions that you can't mount overlayfs on top of a readonly
mount. That seems incompatible with composefs. If this is needed we
have to merge that with the overlayfs that composefs itself sets up,
which is possible with the libcomposefs APIs.
Alexander Larsson [Thu, 18 May 2023 08:53:22 +0000 (10:53 +0200)]
switchroot: Make read_proc_cmdline_ostree() take a key argument
This changes it into read_proc_cmdline_key(), as this will later be
used to read additional keys.
Alexander Larsson [Mon, 29 May 2023 10:25:55 +0000 (12:25 +0200)]
composefs deploy: Store cfs signature in .ostree.cfs.sig file
In many cases, such as when using osbuild, we are not preparing the final
deployment but rather a rootfs tree that will eventually be copied to the
final location. In that case we don't want to apply the signature directly
but when the deployment is copied in place.
To make this situateion workable we also write the signature to a file
next to the composefs image file. Then whatever mechanism that does
the final copy can apply the signature.
Alexander Larsson [Thu, 30 Jun 2022 12:47:44 +0000 (14:47 +0200)]
deploy: Write a .ostree.cfs composefs image in the deploy dir
This can be used as a composefs source for the root fs instead of
the checkout by pointing the basedir to /ostree/repo/objects.
We only write the file is `composefs` is enabled.
We enable ensure_rootfs_dirs when building the image which adds the
required root dirs to the image. In particular, this includes /etc
which often isn't in ostree commits in use.
We also create an (empty) .ostree.mnt directory, where composefs
will mount the erofs image that will be used as overlayfs lowerdir
for the root overlayfs mount. This way we can find the deploy
dir from the root overlayfs mount options.
If the commit has composefs digests recorded we verify those with the
created file. It also applies the fs-verity signature if it is
recorded, unless this is disabled with the
ex-integrity.composefs-apply-sign=false option.
Alexander Larsson [Mon, 15 May 2023 13:18:16 +0000 (15:18 +0200)]
Commit: Add composefs digest and sig to the commit metadata
If `composefs-apply-sig` is enabled (default no) we add an
ostree.composefs digest to the commit metadata. This can be verified
on deploy.
This is a separate option from the generic `composefs` option which
controls whether composefs is used during deploy. It is separate
because we want to not have to force use of fs-verity, etc during the
build.
If the `composefs-certfile` and `composefs-keyfile` keys in the
ex-integrity group are set, then the commit metadata also gets a
ostree.composefs-sig containing the signature of the composefs file.
Alexander Larsson [Thu, 9 Jun 2022 15:15:29 +0000 (17:15 +0200)]
lib: Add (private) API for checking out commits into a composefs image
This supports checking out a commit into a tree which is then
converted into a composefs image containing fs-verity digests for all
the regular files, and payloads that are relative to a the
`repo/objects` directory of a bare ostree repo.
Some specal files are always created in the image. This ensures that
various directories (usr, etc, boot, var, sysroot) exists in the
created image, even if they were not in the source commit. These are
needed (as bindmount targets) if you want to boot from the image. In
the non-composefs case these are just created as needed in the checked
out deploydir, but we can't do that here.
This is all controlled by the new ex-integrity config section, which
has the following layout:
```
[ex-integrity]
fsverity=yes/no/maybe
composefs=yes/no/maybe
composefs-apply-sig=yes/no
composefs-add-metadata=yes/no
composefs-keyfiile=/a/path
composefs-certfile=/a/path
```
The `fsverity` key overrides the old `ex-fsverity` section if
specified. The default for all these is for the new behaviour to be
disabled. Additionally, enabling composefs implies fsverity defaults
to `maybe`, to avoid having to set both.
Alexander Larsson [Tue, 16 May 2023 14:31:34 +0000 (16:31 +0200)]
fsverity: Support passing a signature when enabling fs-verity
The composefs code will need this.
Alexander Larsson [Tue, 16 May 2023 14:01:33 +0000 (16:01 +0200)]
fsverity: Add _ostree_fsverity_sign helper
This code signs a fsverity digest (using openssl) such that the
resulting signature can be used with the FS_IOC_ENABLE_VERITY ioctl.
Alexander Larsson [Tue, 23 May 2023 07:26:26 +0000 (09:26 +0200)]
Add ot_keyfile_get_tristate_with_default() helper
This parses keys like yes/no/maybe. The introduced OtTristate type
is compatible with the existing _OstreeFeatureSupport type.
Colin Walters [Tue, 30 May 2023 13:15:40 +0000 (09:15 -0400)]
Merge pull request #2864 from cgwalters/prepare-root-prepare-composefs
prepare-root: Move sysroot.tmp creation earlier
Colin Walters [Tue, 30 May 2023 12:38:16 +0000 (08:38 -0400)]
Merge pull request #2866 from jlebon/pr/autoprune-tweaks
lib/deploy: Use `fallocate` for early prune space check
Jonathan Lebon [Sat, 27 May 2023 14:37:30 +0000 (10:37 -0400)]
lib/deploy: Use `fallocate` for early prune space check
The `f_bfree` member of the `statvfs` struct is documented as the
"number of free blocks". However, different filesystems have different
interpretations of this. E.g. on XFS, this is truly the number of blocks
free for allocating data. On ext4 however, it includes blocks that
are actually reserved by the filesystem and cannot be used for file
data. (Note this is separate from the distinction between `f_bfree` and
`f_bavail` which isn't relevant to us here since we're privileged.)
If a kernel and initrd is sized just right so that it's still within the
`f_bfree` limit but above what we can actually allocate, the early prune
code won't kick in since it'll think that there is enough space. So we
end up hitting `ENOSPC` when we actually copy the files in.
Rework the early prune code to instead use `fallocate` which guarantees
us that a file of a certain size can fit on the filesystem. `fallocate`
requires filesystem support, but all the filesystems we care about for
the bootfs support it (including even FAT).
(There's technically a TOCTOU race here that existed also with the
`statvfs` code where free space could change between when we check
and when we copy. Ideally we'd be able to pass down that fd to the
copying bits, but anyway in practice the bootfs is pretty much owned by
libostree and one doesn't expect concurrent writes during a finalization
operation.)
Jonathan Lebon [Sun, 28 May 2023 22:37:48 +0000 (18:37 -0400)]
lib/deploy: Rename variable for clarity
`size_to_remove` looks cryptic in contrast to
`new_new_bootcsum_dirs_total_size`. Rename it in the style of the latter
for easier reading.
Jonathan Lebon [Sat, 27 May 2023 14:35:12 +0000 (10:35 -0400)]
lib/deploy: Log case when auto-pruning is hopeless
For easier diagnostics.
Jonathan Lebon [Sat, 27 May 2023 14:33:39 +0000 (10:33 -0400)]
lib/deploy: Drop unused variable
Noticed this diagnostic in my editor with clangd hooked up.
Jonathan Lebon [Sat, 27 May 2023 14:27:55 +0000 (10:27 -0400)]
lib/deploy: Initialize var to pacify gcc static analysis
Classic case of analysis getting confused by variables initialized by
a function.
Bartłomiej Piotrowski [Fri, 26 May 2023 10:09:13 +0000 (12:09 +0200)]
Use a value based on OSTREE_MAX_METADATA_SIZE
Bartłomiej Piotrowski [Thu, 25 May 2023 09:43:05 +0000 (11:43 +0200)]
Increase the metadata size limit to 128MB
Flathub has hit the 10MB limit in 2022, and we had to drop less popular
CPU architectures from the main summary to subsummaries, effectively
cutting off users running too old Flatpak version. Despite that, the
main summary containing only x86_64 is already at 7MB. As this is
eventually going to happen to subsummaries as well, preemptively bump
the limit 12 times.
It takes between 2 and 3 years for a change like this to roll out across
Linux distributions so the best time for this was yesterday.
fixes #2715
Colin Walters [Tue, 23 May 2023 18:42:15 +0000 (14:42 -0400)]
prepare-root: Move sysroot.tmp creation earlier
Main motivation is prep for composefs in
https://github.com/ostreedev/ostree/pull/2640
In the interest of that, we add a `bool using_composefs` but
it's currently always `false`.
Co-authored-by: Alexander Larsson <alexl@redhat.com>
Colin Walters [Mon, 22 May 2023 17:37:10 +0000 (13:37 -0400)]
Merge pull request #2860 from cgwalters/xshell2
tests: A bit more xshell porting
Joseph Marrero Corchado [Thu, 18 May 2023 21:09:04 +0000 (17:09 -0400)]
Merge pull request #2859 from jmarrero/release-2023.3
Release 2023.3
Colin Walters [Thu, 18 May 2023 12:14:50 +0000 (08:14 -0400)]
tests: A bit more xshell porting
Part of https://github.com/ostreedev/ostree/issues/2857
Joseph Marrero [Wed, 17 May 2023 20:32:43 +0000 (16:32 -0400)]
configure: post-release version bump
Joseph Marrero [Wed, 17 May 2023 20:29:04 +0000 (16:29 -0400)]
Release 2023.3
Colin Walters [Wed, 10 May 2023 19:16:24 +0000 (15:16 -0400)]
Merge pull request #2856 from cgwalters/port-to-xshell
tests/inst: Add xshell and use it in one place
Colin Walters [Wed, 10 May 2023 13:21:45 +0000 (09:21 -0400)]
tests/inst: Add xshell and use it in one place
I've deprecated sh-inline; in the end I think it is better
to minimize the amount of bash code we have. xshell solves
the core convenience problem of taking local variables and mapping
them to command arguments.
A full port would be nontrivial; this just starts the ball
rolling.
Colin Walters [Wed, 3 May 2023 12:24:21 +0000 (08:24 -0400)]
Merge pull request #2565 from cgwalters/clang-format
Add .clang-format file + tree-wide: Run `clang-format`