Commit Graph

4959 Commits

Author SHA1 Message Date
Jonathan Lebon 5ea85ba5ac configure.ac: Add more details on how to do a release
Closes: #1928
Approved by: cgwalters
2019-09-25 21:05:32 +00:00
Jonathan Lebon 9d39e7d91e Release 2019.4
Tiny release. Just want to get out the important bugfixes instead of
backporting patches (notably the gpg-agent stuff and
`ostree-finalize-staged.service` ordering).

Closes: #1927
Approved by: cgwalters
2019-09-25 13:43:28 +00:00
Jonathan Lebon c6c640f3ae Post-release version bump
Closes: #1927
Approved by: cgwalters
2019-09-25 13:43:28 +00:00
Jonathan Lebon 88182635ab boot/finalize-staged: Run after systemd-journal-flush.service
In Fedora 31, `systemd-journal-flush.service` uses a new
`--smart-relinquish-var` switch which fixes the
`umount: /var: target is busy` bug by telling journald to stop logging
to `/var` and back to `/run` again during shutdown.

This interacted with `ostree-finalize-staged.service` in a tricky way:
since we weren't strongly ordered against it, when we happened to
finalize after `/var` is relinquished, we never persisted the output
from that service to disk. This then threw off `rpm-ostree status` when
trying to find the completion message to know that finalization went
well.

Just fix this by adding an explicit `After=` on that unit. That way we
shut down *before* `systemd-journal-flush.service` (the `/var`
relinquish bit happens in its `ExecStop=`).

For more info, see:
3ff7a50d66
1e187d2dd5
https://bugzilla.redhat.com/show_bug.cgi?id=1751272

Closes: #1926
Approved by: cgwalters
2019-09-24 21:39:10 +00:00
Philip Withnall 94fcba96e0 lib/repo-pull: Add more debugging on pull failure
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1925
Approved by: cgwalters
2019-09-24 13:36:59 +00:00
Simon McVittie 47d1e60cf3 Upload to unstable
- d/gbp.conf: Reset packaging branch to debian/master
2019-09-19 17:50:52 +01:00
Benjamin Gilbert 653fc6a125 prepare-root: remember to remove /sysroot.tmp
Without this, rerunning ostree-prepare-root will fail in mkdir()
because /sysroot.tmp already exists, which complicates debugging from
the dracut emergency shell.

Closes: #1919
Approved by: cgwalters
2019-09-13 12:40:57 +00:00
Colin Walters ca701f69c2 fsck: Fix version in docs, tweak error text
I think this error message is clearer.

Closes: #1918
Approved by: jlebon
2019-09-09 15:18:50 +00:00
Jason Wessel bdbce9d042 fsck: Add test for --delete corruption, fix repair, and partial commit checks
The ostree fsck test is aimed to check that it will still fail an fsck
if the repository has been repaired by fsck.  It also checks that a
pull operation corrects the error and ostree fsck will exit with zero.

The test was modeled after the following script:

rm -rf ./f1
mkdir -p ./f1
./ostree --repo=./f1 init --mode=archive-z2
mkdir -p ./trial
echo test > ./trial/test
./ostree --repo=./f1 commit --tree=dir=./trial --skip-if-unchanged --branch=exp1 --subject="test Commit"

rm -rf ./f2
mkdir -p ./f2
./ostree --repo=./f2 init
./ostree --repo=./f2 pull-local  ./f1

echo whoops > `find ./f2 |grep objects |grep \\.file `
./ostree fsck --repo=./f2 ; echo Exit: $?
./ostree fsck --delete --repo=./f2 ; echo Exit: $?
./ostree fsck --repo=./f2 ; echo Exit: $?
./ostree --repo=./f2 pull-local  ./f1
./ostree fsck --repo=./f2 ; echo Exit: $?

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

fsck: Update test so that it will pass on fs without xattrs

The fsck test does not require xattrs to prove that it works.  It is
simple enough to change it to use an archvie instead of a bare type
repository.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

Closes: #1910
Approved by: cgwalters
2019-09-09 13:40:36 +00:00
Jason Wessel b709c3c67b fsck: Implement a partial commit reason bitmask
After the corruption has been fixed with "ostree fsck -a --delete", a
second run of the "ostree fsck" command will print X partial commits
not verified and exit with a zero.

The zero exit code makes it hard to detect if a repair operation needs
to be run.  When ever fsck creates a partial commit it should add a
reason for the partial commit to the state file found in
state/<hash>.commitpartial.  This will allow a future execution of the
fsck to still return an error indicating that the repository is still
in the damaged state, awaiting repair.

Additional reason codes could be added in the future for why a partial
commit exists.

Text from: https://github.com/ostreedev/ostree/pull/1880
====
cgwalters commented:

To restate, the core issue is that it's valid to have partial commits
for reasons other than fsck pruned bad objects, and libostree doesn't
have a way to distinguish.

Another option perhaps is to write e.g. fsck-partial into the
statefile state/<hash>.commitpartial which would mean "partial, and
expected to exist but was pruned by fsck" and fsck would continue to
error out until the commit was re-pulled. Right now the partial stamp
file is empty, so it'd be fully compatible to write a rationale into
it.
====

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

Closes: #1910
Approved by: cgwalters
2019-09-09 13:40:36 +00:00
Dan Nicholson e49060c207 lib/gpg: Use g_spawn_sync to kill gpg-agent
For reasons I don't understand, GSubprocess doesn't play nice with KDE's
plasmashell. I assume this has something to do with the GSubprocess
using the glib worker thread while plasmashell uses the glib main
loop. Instead, just use g_spawn_sync to fork and wait in the current
thread.

Fixes: #1913

Closes: #1917
Approved by: cgwalters
2019-09-07 18:42:22 +00:00
Dan Nicholson d14472a7f0 lib/gpg: Don't kill gpg-agent on newer gnupg
GnuPG 2.1.17 contains a bug fix so that `gpg-agent` is killed when the
entire GPG home directory is deleted[1]. If the host's GnuPG is new
enough, then we don't need to bother calling `gpg-connect-agent` to kill
the agent since it will be cleaned up on its own.

Get the GnuPG version from the GPGME OpenPGP engine info and parse it to
see if it matches this criteria.

1. https://dev.gnupg.org/T2756

Closes: #1915
Approved by: cgwalters
2019-09-06 18:04:05 +00:00
Dan Nicholson 522d31b2d4 lib/gpg: Only show gpg-connect-agent stderr on failures
When listing GPG keys, the temporary GPG homedir will be constructed by
simply copying the remote's trusted keys to the pubring.gpg file. In
that case, no GPG operations spawning gpg-agent will be run. When
gpg-connect-agent is run to cleanup the homedir, it will helpfully print
on stderr that it's starting gpg-agent like so:

gpg-connect-agent: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: connection to agent established

Send gpg-connect-agent's stderr to a pipe and only send it to the
application's stderr if an error was encountered.

Fixes: #1907

Closes: #1908
Approved by: cgwalters
2019-09-02 21:55:14 +00:00
Javier Martinez Canillas d42f970ed3 lib/bootconfig-parser: Always include deployment index in BLS title
If there are different deployments for the same commit version, the BLS
snippets will have the same title fields (but different version fields):

$ grep title *
ostree-1-testos.conf:title TestOS 42 20190902.0 (ostree)
ostree-2-testos.conf:title TestOS 42 20190902.0 (ostree)
ostree-3-testos.conf:title TestOS 42 20190902.0 (ostree)

But bootloaders could expect the title field to be unique for BLS files.
For example, the zipl bootloader used in the s390x architecture uses the
field to name the boot sections that are created from the BLS snippets.

So two BLS snippets having the same title would lead to zipl failing to
create the IPL boot sections because they would have duplicated names:

$ zipl
Using config file '/etc/zipl.conf'
Using BLS config file '/boot/loader/entries/ostree-3-testos.conf'
Using BLS config file '/boot/loader/entries/ostree-2-testos.conf'
Using BLS config file '/boot/loader/entries/ostree-1-testos.conf'
Error: Config file '/etc/zipl.conf': Line 0: section name 'TestOS 42 20190902.0 (ostree)' already specified

Avoid this by always including the deployment index along with the commit
version in the title field, so this will be unique even if there are BLS
files for deployments that use the same commit version:

$ grep title *
ostree-1-testos.conf:title TestOS 42 20190902.0 (ostree:2)
ostree-2-testos.conf:title TestOS 42 20190902.0 (ostree:1)
ostree-3-testos.conf:title TestOS 42 20190902.0 (ostree:0)

$ zipl
Using config file '/etc/zipl.conf'
Using BLS config file '/boot/loader/entries/ostree-3-testos.conf'
Using BLS config file '/boot/loader/entries/ostree-2-testos.conf'
Using BLS config file '/boot/loader/entries/ostree-1-testos.conf'
Building bootmap in '/boot'
Building menu 'zipl-automatic-menu'
Adding #1: IPL section 'TestOS 42 20190902.0 (ostree:0)' (default)
Adding #2: IPL section 'TestOS 42 20190902.0 (ostree:1)'
Adding #3: IPL section 'TestOS 42 20190902.0 (ostree:2)'
Preparing boot device: dasda (0120).
Done.

Closes: #1911
Approved by: cgwalters
2019-09-02 21:08:58 +00:00
Simon McVittie e9595adf08 Release to experimental 2019-08-31 19:06:47 +01:00
Javier Martinez Canillas 2ca2b88f51 lib/bootconfig-parser: Write BLS fragment fields in a deterministic order
Currently the BLS fragments fields write is non-determinisitc. The order
of the fields will depend on how the iterator of the options GHashTable
iterates over the key/value pairs.

But some bootloaders expect the fields to be written in a certain order.
For example the zipl bootloader (used in the s390x architecture) fails to
parse BLS files if the first field is not the 'title' field, since that's
used to name the zipl boot sections that are created from the BLS files.

Write the fields in a deterministic order, following what is used in the
example file of the BootLoaderspec document:

https://systemd.io/BOOT_LOADER_SPECIFICATION

Related: https://github.com/ostreedev/ostree/issues/1888

Closes: #1904
Approved by: cgwalters
2019-08-29 12:58:43 +00:00
Javier Martinez Canillas f82f825fed lib/bootconfig-parser: Remove support to preserve comments in BLS files
OSTree has some logic to preserve comment lines in the BLS fragments, but
the BLS fragments are always created on new deployments so the comments
are never carried.

Also, OSTree never writes BLS fragments with comments so these will only
be present in BLS files that were modified outside of OSTree. Something
that should be avoided in general.

Finally, there is a bug in the logic that causes BLS files to have lines
with only a newline character.

The ostree_bootconfig_parser_parse_at() function reads the bootconfig file
using glnx_fd_readall_utf8() but this function NUL terminates the returned
string with the file contents.

So when the string is later split using '\n' as delimiter, the last token
is set to '\0' and a wrong GVariant will be added to the lines GPtrArray
in the OstreeBootconfigParser struct.

This will lead to bootconfig files that contains lines with only a newline
character, since the key in the GVariant would be set to NUL and won't be
present in the options GHashTable of the OstreeBootconfigParser struct.

So let's just remove that logic since is never used and makes BLS files to
have wrong empty lines.

Before this patch:

$ tail -n 4 /boot/loader/entries/ostree-1-testos.conf | hexdump -C
00000000  74 69 74 6c 65 20 54 65  73 74 4f 53 20 34 32 20  |title TestOS 42 |
00000010  32 30 31 39 30 38 32 34  2e 30 20 28 6f 73 74 72  |20190824.0 (ostr|
00000020  65 65 29 0a 0a 0a 0a                              |ee)....|
00000027

After this patch:

$ tail -n 4 /boot/loader/entries/ostree-1-testos.conf | hexdump -C
00000000  76 65 72 73 69 6f 6e 20  31 0a 6f 70 74 69 6f 6e  |version 1.option|
00000010  73 20 72 6f 6f 74 3d 4c  41 42 45 4c 3d 4d 4f 4f  |s root=LABEL=MOO|
00000020  20 71 75 69 65 74 20 6f  73 74 72 65 65 3d 2f 6f  | quiet ostree=/o|
00000030  73 74 72 65 65 2f 62 6f  6f 74 2e 31 2f 74 65 73  |stree/boot.1/tes|
00000040  74 6f 73 2f 61 65 34 36  34 39 36 38 30 64 33 65  |tos/ae4649680d3e|
00000050  38 33 62 32 34 65 34 37  66 38 64 66 31 30 38 31  |83b24e47f8df1081|
00000060  38 62 66 36 39 38 39 64  36 34 37 61 62 32 38 38  |8bf6989d647ab288|
00000070  64 31 63 30 39 38 30 36  65 34 61 33 36 61 34 65  |d1c09806e4a36a4e|
00000080  62 62 66 36 2f 30 0a 6c  69 6e 75 78 20 2f 6f 73  |bbf6/0.linux /os|
00000090  74 72 65 65 2f 74 65 73  74 6f 73 2d 61 65 34 36  |tree/testos-ae46|
000000a0  34 39 36 38 30 64 33 65  38 33 62 32 34 65 34 37  |49680d3e83b24e47|
000000b0  66 38 64 66 31 30 38 31  38 62 66 36 39 38 39 64  |f8df10818bf6989d|
000000c0  36 34 37 61 62 32 38 38  64 31 63 30 39 38 30 36  |647ab288d1c09806|
000000d0  65 34 61 33 36 61 34 65  62 62 66 36 2f 76 6d 6c  |e4a36a4ebbf6/vml|
000000e0  69 6e 75 7a 2d 33 2e 36  2e 30 0a 74 69 74 6c 65  |inuz-3.6.0.title|
000000f0  20 54 65 73 74 4f 53 20  34 32 20 32 30 31 39 30  | TestOS 42 20190|
00000100  38 32 34 2e 30 20 28 6f  73 74 72 65 65 29 0a     |824.0 (ostree).|
0000010f

Closes: #1904
Approved by: cgwalters
2019-08-29 12:58:43 +00:00
Colin Walters d85366d52a ci: Add prow/ subdirectory with Dockerfile
I'd like to add OpenShift's prow to this repository.  Let's start
by adding a Dockerfile - it doesn't really do anything besides build.

However...I've lately been thinking about e.g. shipping the ostree tests
as an image, and then e.g. we could test FCOS by running that container
(which would orchestrate the *host's* ostree).

Anyways, not doing that right now but this is a start.

Also this cherry picks the fix from rpm-ostree CI for the sad
Fedora release package brokenness.

Closes: #1906
Approved by: cgwalters
2019-08-29 05:43:11 +00:00
Simon McVittie 79d8e3f4cc lintian: Do not warn about ostree-remount.service being in local-fs.target
This part of the boot integration is genuinely part of an earlier phase
of boot than sysinit.target.
2019-08-28 09:25:53 +01:00
Simon McVittie 40cd716c78 d/copyright: Update 2019-08-28 09:19:53 +01:00
Simon McVittie 5ede7fb5e8 improve Markdown syntax 2019-08-28 00:00:07 +01:00
Simon McVittie 8957dff11f Update changelog 2019-08-27 23:56:13 +01:00
Simon McVittie 6bbd856924 modified-deb-ostree-builder: Copy host system's /etc/resolv.conf
This is necessary when installing extra packages with non-trivial
dependencies.
2019-08-27 23:54:48 +01:00
Simon McVittie fb398974cc Make example scripts executable 2019-08-27 23:54:11 +01:00
Simon McVittie 7fb5ae2204 Add instructions for testing ostree-boot
Co-authored-by: Felix Krull <f_krull@gmx.de>
2019-08-27 20:24:57 +01:00
Simon McVittie 784abb792c d/ostree-boot.postinst: Trigger an update of the initramfs
Otherwise the dracut initramfs won't be rebuilt to include ostree-boot.
2019-08-27 20:24:57 +01:00
Simon McVittie 0f5871104a Update changelog 2019-08-27 20:24:57 +01:00
Simon McVittie e786f314fc Merge branch 'ostree-boot' into 'debian/experimental'
Add ostree-boot package (#824650)

See merge request debian/ostree!1
2019-08-27 19:24:37 +00:00
Felix Krull 6262b20f15 ostree-boot: weaken dracut Depends to Recommends
The systemd parts of the package could also be used for integration
with e.g. initramfs-tools.
2019-08-27 19:21:13 +02:00
Felix Krull 9572f7e4f2 Enable ostree-boot package 2019-08-27 19:21:13 +02:00
Colin Walters 93999d337e sysroot: Add a clearer error if /boot/loader isn't found
I've seen people confused by this error in the case where
`/boot` isn't mounted or the BLS fragments were deleted, etc.
If you understand ostree deeply it's clear but, let's do
better here and a direct error message for the case where
we can't find `/boot/loader` which is the majority of these.

The other case could happen if e.g. just the BLS fragment
for the booted deployment was deleted; let's reword that
one a bit too.

Closes: #1905
Approved by: rfairley
2019-08-26 20:30:31 +00:00
Simon McVittie db6fae8c0c Switch packaging branch to debian/experimental 2019-08-23 11:37:01 +01:00
Simon McVittie 6e099593fc Release to unstable 2019-08-23 11:28:43 +01:00
Simon McVittie 5534691528 Skip `gpg-connect-agent` when cleaning up temporary GPG home directories
It appears this is sometimes done when it wasn't needed, causing
gpg-connect-agent to wait for an agent to start so that it can tell it
to stop, which results in a lot of noise on stderr when running `flatpak
update`. Debian 10 has GPG 2.2, and according to the commit message of
the commit I'm reverting here, this cleanup should be unnecessary with
GPG >= 2.2.
2019-08-23 11:26:52 +01:00
Simon McVittie 8b3715e0aa d/copyright: Update 2019-08-23 09:54:36 +01:00
Simon McVittie 88ab22ebba d/libostree-1-1.symbols: Add new ABI 2019-08-23 09:54:31 +01:00
Simon McVittie e9284a22a7 New upstream release
Refresh patch series
2019-08-23 08:39:10 +01:00
Simon McVittie b7b7382205 Update upstream source from tag 'upstream/2019.3'
Update to upstream version '2019.3'
with Debian dir 0b01789769
2019-08-23 08:37:57 +01:00
Simon McVittie 1b51e1d9d0 New upstream version 2019.3 2019-08-23 08:37:51 +01:00
Colin Walters 71e1e9d18e Post-release version bump
Closes: #1902
Approved by: rfairley
2019-08-22 18:37:38 +00:00
Colin Walters b15ed42111 Release 2019.3
It's been a while, and we need the new kargs API for rpm-ostree.

Closes: #1902
Approved by: rfairley
2019-08-22 18:37:38 +00:00
Daniel Drake 99d56215e6 lib/deploy: handle FIFREEZE ENOSYS failure
When running under qemu, unimplemented ioctls such as FIFREEZE
return ENOSYS, and this causes the deployment to fail.

Catch this and handle it like EOPNOTSUPP.

I'm not sure if qemu's behaviour is fully correct here (or if it should
return EOPNOTSUPP) but it's trivial to handle regardless.

Closes: #1901
Approved by: cgwalters
2019-08-21 12:38:05 +00:00
Jonathan Lebon 0c48769de3 bin: Better handle --
We would stop passing through `--` and args after it to the underlying
command in `ostree_run`. This made it impossible to use `--` to tell the
parser that following args starting with `-` really are positional.

AFAICT, that logic for `--` here came from a time when we parse options
manually in a big loop, in which case breaking out made sense (see
97558276e4).

There's an extra step here, which is that glib by default leaves the
`--` in the list of args, so we need to take care to remove it from the
list after parsing.

Closes: #1898

Closes: #1899
Approved by: rfairley
2019-08-14 12:31:10 +00:00
Colin Walters ab73d9f525 admin/init-fs: Add a --modern switch
This skips creating the default stuff in the physical sysroot.
I don't recall why I did that to be honest; it originated with
the first commit of this file.  It might not have ever been
necessary.

In any case, it's not necessary now with Fedora CoreOS, so
prune it and let's have a clean `/`.

Keep the old behavior by default though to avoid breaking anyone.

Closes: #1894
Approved by: ajeddeloh
2019-08-08 20:02:11 +00:00
Colin Walters 729254503c README.md: Rework "projects using" section
Update this to mention the 3 Fedora derivatives, RHEL CoreOS etc.

Create 3 sections:

 - OS/Distributions
 - build tools
 - rpm-ostree/flatpak

Closes: #1895
Approved by: dustymabe
2019-08-07 13:19:09 +00:00
Denis Pynkin 4c8b0ac255 tests/test-repo-finder-mount: skip some tests if GPG is not supported
`ostree_repo_resolve_keyring_for_collection()` function fail the tests
if there is no GPG support.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>

Closes: #1889
Approved by: cgwalters
2019-08-01 02:06:47 +00:00
Denis Pynkin 3767d87107 tests/gpg: fix GPG-dependent shell tests if no GPG support
Skip tests or run them without GPG-related functionality if GPGME
wasn't enabled in a build time.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>

Closes: #1889
Approved by: cgwalters
2019-08-01 02:06:47 +00:00
Denis Pynkin 453ce83379 tests/gpg: fix the check of GPG support
Shell function `has_gpgme` shouldn't exit if GPG support is not detected
since it stop any test with error.

Added function `skip_without_gpgme` to skip the whole test if it is
useless without GPG support

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>

Closes: #1889
Approved by: cgwalters
2019-08-01 02:06:47 +00:00
Denis Pynkin 8322e77a88 gpg: add dummy public interface
Add dummy stubs for GPG public functions to be compiled instead of
original code in case if support of GPG is disabled.
Need that to keep API backward compatibility.

Based on original code from file `ostree-gpg-verify-result.c`.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>

Closes: #1889
Approved by: cgwalters
2019-08-01 02:06:47 +00:00
Denis Pynkin 56020b7160 lib: rename common sign/verification functions and variables
Some gpg-named functions/variables should be used for any signature
system, so remove "gpg_" prefix from them to avoid confusion.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>

Closes: #1889
Approved by: cgwalters
2019-08-01 02:06:47 +00:00