]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
12 months agoMerge pull request #27861 from poettering/find-esp-tweaks
Lennart Poettering [Wed, 31 May 2023 13:42:05 +0000 (15:42 +0200)] 
Merge pull request #27861 from poettering/find-esp-tweaks

minor tweaks to find-esp.c

12 months agoMerge pull request #27806 from DaanDeMeyer/fix-mkosi-check
Daan De Meyer [Wed, 31 May 2023 13:26:05 +0000 (15:26 +0200)] 
Merge pull request #27806 from DaanDeMeyer/fix-mkosi-check

mkosi: Use proper check to detect whether we're in a VM

12 months agoMerge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units
Daan De Meyer [Wed, 31 May 2023 12:48:42 +0000 (14:48 +0200)] 
Merge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units

Don't GC unit if it is in cgroup_empty_queue

12 months agoMerge pull request #26969 from DaanDeMeyer/xopenat-label
Daan De Meyer [Wed, 31 May 2023 12:35:50 +0000 (14:35 +0200)] 
Merge pull request #26969 from DaanDeMeyer/xopenat-label

fs-util: Add labelling support to xopenat()

12 months agomkosi: Check for failures by mounting again 27806/head
Daan De Meyer [Wed, 31 May 2023 11:03:18 +0000 (13:03 +0200)] 
mkosi: Check for failures by mounting again

We rely on vsock to communicate the exit status back to us from the
VM but vsock in Github Actions is broken so let's switch back to
mounting for now.

12 months agomkosi: Don't fail on systemd-vconsole-setup.service failure for now
Daan De Meyer [Wed, 31 May 2023 12:21:49 +0000 (14:21 +0200)] 
mkosi: Don't fail on systemd-vconsole-setup.service failure for now

Let's make CI green again and dig into this failure later

12 months agomkosi: Disable cmdline addon test for now
Daan De Meyer [Wed, 31 May 2023 11:24:10 +0000 (13:24 +0200)] 
mkosi: Disable cmdline addon test for now

This fails but we didn't notice until now because error reporting
from the mkosi VM was broken. Let's disable it for now to get CI
green again.

12 months agomkosi: Use proper check to detect whether we're in a VM
Daan De Meyer [Fri, 26 May 2023 15:38:23 +0000 (17:38 +0200)] 
mkosi: Use proper check to detect whether we're in a VM

12 months agomkosi: Blacklist vmw_vmci to avoid issues with vsock in Github Actions
Daan De Meyer [Tue, 30 May 2023 12:48:43 +0000 (14:48 +0200)] 
mkosi: Blacklist vmw_vmci to avoid issues with vsock in Github Actions

If this module is loaded, sending readiness notifications from the
VM will fail with "no route to host" so let's blacklist the module
to prevent that from happening.

12 months agomkosi: Enforce usage of vsock with qemu in CI
Daan De Meyer [Sat, 27 May 2023 09:12:22 +0000 (11:12 +0200)] 
mkosi: Enforce usage of vsock with qemu in CI

12 months agomkosi: Update to latest
Daan De Meyer [Sat, 27 May 2023 09:12:11 +0000 (11:12 +0200)] 
mkosi: Update to latest

12 months agosd-daemon: Add debug logging
Daan De Meyer [Wed, 31 May 2023 08:22:57 +0000 (10:22 +0200)] 
sd-daemon: Add debug logging

12 months agosd-daemon: Introduce pid_notify_with_fds_internal()
Daan De Meyer [Wed, 31 May 2023 08:08:47 +0000 (10:08 +0200)] 
sd-daemon: Introduce pid_notify_with_fds_internal()

No change in behavior, just refactoring

12 months agosysv-generator-test: Bump log level to info
Daan De Meyer [Wed, 31 May 2023 12:18:35 +0000 (14:18 +0200)] 
sysv-generator-test: Bump log level to info

Otherwise, non-fatal debug error logs might interfere with the test.

12 months agoMerge pull request #27860 from poettering/loopback-no-prefix-route
Lennart Poettering [Wed, 31 May 2023 12:03:04 +0000 (14:03 +0200)] 
Merge pull request #27860 from poettering/loopback-no-prefix-route

loopback-setup: only create a single loopback route when configuring 'lo'

12 months agofs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label files/dirs 26969/head
Daan De Meyer [Sun, 26 Mar 2023 17:48:57 +0000 (19:48 +0200)] 
fs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label files/dirs

12 months agolabel: Introduce LabelOps to do pre/post labelling operations
Daan De Meyer [Sun, 26 Mar 2023 16:20:41 +0000 (18:20 +0200)] 
label: Introduce LabelOps to do pre/post labelling operations

By default, label_ops is initialized with a NULL pointer which translates
to noop labelling operations. In mac_selinux_init() and the new mac_smack_init(),
we initialize label_ops with a MAC specific LabelOps pointer.

We also introduce mac_init() to initialize any configured MACs and replace all
usages of mac_selinux_init() with mac_init().

12 months agoMerge pull request #27848 from keszybz/man-page-fixes
Luca Boccassi [Wed, 31 May 2023 10:13:51 +0000 (11:13 +0100)] 
Merge pull request #27848 from keszybz/man-page-fixes

Man page fixes

12 months agoMerge pull request #27858 from mrc0mmand/followups
Luca Boccassi [Wed, 31 May 2023 10:09:53 +0000 (11:09 +0100)] 
Merge pull request #27858 from mrc0mmand/followups

Use structured initialization in two more places

12 months agoMerge pull request #27853 from keszybz/various-bits-and-pieces-included-to-reuse...
Luca Boccassi [Wed, 31 May 2023 10:08:36 +0000 (11:08 +0100)] 
Merge pull request #27853 from keszybz/various-bits-and-pieces-included-to-reuse-the-ci-run

Various bits and pieces included to reuse the ci run

12 months agoMerge pull request #27840 from mrc0mmand/gcc-13
Luca Boccassi [Wed, 31 May 2023 10:07:22 +0000 (11:07 +0100)] 
Merge pull request #27840 from mrc0mmand/gcc-13

ci: add gcc-13, drop gcc-12

12 months agoMerge pull request #27519 from yuwata/journalctl-fixes
Luca Boccassi [Wed, 31 May 2023 10:05:54 +0000 (11:05 +0100)] 
Merge pull request #27519 from yuwata/journalctl-fixes

journalctl: several fixes and cleanups for --follow

12 months agoMerge pull request #27835 from keszybz/test-58-repart-modernization
Luca Boccassi [Wed, 31 May 2023 10:00:18 +0000 (11:00 +0100)] 
Merge pull request #27835 from keszybz/test-58-repart-modernization

Cleanup/simplifications for TEST-58-repart

12 months agotest-fstab-generator: fix test on systemd with systemd-boot
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 20:53:43 +0000 (22:53 +0200)] 
test-fstab-generator: fix test on systemd with systemd-boot

(… or other boot loaders implementing the Boot Loader Interface.)

Fixes #27857.

12 months agotest-loopback: run test in network + user namespace 27860/head
Lennart Poettering [Wed, 31 May 2023 07:41:26 +0000 (09:41 +0200)] 
test-loopback: run test in network + user namespace

This way it can actually do useful testing even when unprivileged.

12 months agoloopback-setup: clean up logging
Lennart Poettering [Wed, 31 May 2023 07:57:33 +0000 (09:57 +0200)] 
loopback-setup: clean up logging

All users of loopback_setup() ignore the return values (with the notable
exception of the test cases). Hence let's adjust the log messaging to
always log at LOG_WARNING level at most, and suffix messages with ",
ignoring", to make clear these failures are ignored.

12 months agoloopback-setup: set IFA_F_NOPREFIXROUTE when configuring 'lo' ipv6 address
Lennart Poettering [Wed, 31 May 2023 07:42:45 +0000 (09:42 +0200)] 
loopback-setup: set IFA_F_NOPREFIXROUTE when configuring 'lo' ipv6 address

Otherwise the kernel will set up two routes to ::1, one in the "main",
and one in the "local" routing table.

Fixes: #25819
12 months agofind-esp: drop some redundant 'else' 27861/head
Lennart Poettering [Wed, 31 May 2023 07:37:24 +0000 (09:37 +0200)] 
find-esp: drop some redundant 'else'

12 months agofind-esp: change "unprivileged_mode" parameter to be tristate
Lennart Poettering [Wed, 31 May 2023 07:32:52 +0000 (09:32 +0200)] 
find-esp: change "unprivileged_mode" parameter to be tristate

Previously, unprivileged mode for find_esp_and_warn() and
find_xbootldr_and_warn() could be enabled or disabled. With this change
it can also be set to negative in which case the functions will enable
it automatically if found to be executing without privileges.

This just moves te geteuid() check we often do for the param inside of
the functions.

At the same time internally in the functions we also pass around the
VerifyESPFlags field across the various functions instead of booleans.

Both changes are just refactoring. No changes in behaviour.

12 months agotmpfiles: use same credstore perms everywhere
Lennart Poettering [Tue, 30 May 2023 13:13:38 +0000 (15:13 +0200)] 
tmpfiles: use same credstore perms everywhere

In b6033b706028a64e9affb79050ced1ad9a4f5b43 support was added to create
{/etc|/run}/credstore{|.encrypted} via tmpfiles.d with perms 0000. These
perms are so restrictive that not even root can access them unless it
has CAP_DAC_OVERRIDE capability. This is creates the dirs at boot time

In 24039e1207c169b18adf5234ad300ea3ba1b671e support was added to create
/etc/credstore with perm 0700 from meson.build at build time.

This patch makes unifies the two parts:

1. creates both /etc/credstore *and* /etc/credstore.encrypted in both
   places (the build system still won't create them in /run/, since
   that's pointless since not shipped, and the runtime won't create the
   dirs below /usr/lib/, since that's not generically writable anyway).

2. Both at runtime and at build time we'll create the dirs with mode
   0700. This is easier for packaging tools to handle since they
   generally react pretty negatively on dirs they can't enumerate.

12 months agosd-network: use structured initialization 27858/head
Frantisek Sumsal [Tue, 30 May 2023 19:29:54 +0000 (21:29 +0200)] 
sd-network: use structured initialization

And squash one unnecessary assignment.

12 months agojournal-remote: use structured initialization
Frantisek Sumsal [Tue, 30 May 2023 19:18:08 +0000 (21:18 +0200)] 
journal-remote: use structured initialization

12 months agocore,shared: add a couple of asserts 27840/head
Frantisek Sumsal [Tue, 30 May 2023 10:40:19 +0000 (12:40 +0200)] 
core,shared: add a couple of asserts

To appease the LTO overlords:

In file included from ../../../../src/basic/macro.h:446,
                 from ../../../../src/shared/blockdev-util.h:8,
                 from ../../../../src/shared/creds-util.c:11:
../../../../src/shared/creds-util.c: In function 'get_credential_host_secret':
../../../../src/shared/creds-util.c:379:52: error: '%s' directive argument is null [-Werror=format-overflow=]
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/basic/log.h:214:86: note: in definition of macro 'log_full_errno_zerook'
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../../../../src/basic/log.h:250:41: note: in expansion of macro 'log_full_errno'
  250 | #define log_debug_errno(error, ...)     log_full_errno(LOG_DEBUG,   error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../../../../src/shared/creds-util.c:379:33: note: in expansion of macro 'log_debug_errno'
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                 ^~~~~~~~~~~~~~~
../../../../src/shared/creds-util.c:379:74: note: format string is defined here
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                                                          ^~
cc1: some warnings being treated as errors

../../../../src/core/transaction.c: In function 'transaction_verify_order_one':
../../../../src/core/transaction.c:338:38: error: '%s' directive argument is null [-Werror=format-overflow=]
  338 |                 sprintf(ans + size, "%s%s", unit_log_field, *unit_id);
      |                                      ^~
cc1: some warnings being treated as errors

12 months agoci: add gcc-13, drop gcc-12
Frantisek Sumsal [Tue, 30 May 2023 07:07:39 +0000 (09:07 +0200)] 
ci: add gcc-13, drop gcc-12

12 months agotest-dlopen: allow loading of multiple libraries 27853/head
Zbigniew Jędrzejewski-Szmek [Tue, 18 Apr 2023 09:37:52 +0000 (11:37 +0200)] 
test-dlopen: allow loading of multiple libraries

This is useful for debugging, for example if we want to test multiple different
dlls being loaded in the same namespace.

12 months agoshared/loop-util: add comment
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 13:56:45 +0000 (15:56 +0200)] 
shared/loop-util: add comment

Requested in https://github.com/systemd/systemd/commit/afbe20b7d4ed4c3aebbd1b3de00b9b7385dd0ae8#r115653459.

12 months agotests: drop unnecessary redirection of stderr
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 10:28:34 +0000 (12:28 +0200)] 
tests: drop unnecessary redirection of stderr

command -v doesn't print anything to stderr, let's use the canonical
form with just >/dev/null.

12 months agodissect: use pager for --help
Zbigniew Jędrzejewski-Szmek [Tue, 23 May 2023 19:26:57 +0000 (21:26 +0200)] 
dissect: use pager for --help

This output is already too long to fit on an normal terminal, and the
interesting parts are towards the top.

12 months agobasic/user-util: attach pointer symbol to return type, not function
Zbigniew Jędrzejewski-Szmek [Tue, 23 May 2023 11:46:59 +0000 (13:46 +0200)] 
basic/user-util: attach pointer symbol to return type, not function

Surrounding code was predominantly using this style already, let's make things
consistent.

12 months agolabel: Rename to label-util.h
Daan De Meyer [Sun, 26 Mar 2023 16:01:07 +0000 (18:01 +0200)] 
label: Rename to label-util.h

12 months agotest-udev: Skip running in container
Daan De Meyer [Sat, 27 May 2023 10:21:19 +0000 (12:21 +0200)] 
test-udev: Skip running in container

Containers generally don't have permission to mknod() which is
required by test-udev so let's skip the test as well if we detect
we're running in a container.

12 months agooom: Make sure temporary test file is in /tmp
Daan De Meyer [Sat, 27 May 2023 09:43:10 +0000 (11:43 +0200)] 
oom: Make sure temporary test file is in /tmp

12 months agokmod-setup: Load virtio-vsock kernel module early
Daan De Meyer [Sat, 27 May 2023 09:32:39 +0000 (11:32 +0200)] 
kmod-setup: Load virtio-vsock kernel module early

We might want to send sd-notify over vsock very early on so let's
make sure we load the relevant kernel module as early as possible.

12 months agorepart: Allow target directory excludes
Daan De Meyer [Mon, 22 May 2023 21:17:49 +0000 (23:17 +0200)] 
repart: Allow target directory excludes

Currently, ExcludeFiles= supports excluding directories on the host
from being copied. Let's extend this to also support preventing files
from being copied into specific directories in the partition by adding
a new option ExcludeFilesTarget=. An example where this is useful is
when setting up btrfs subvolumes in the top level that are intended to
be mounted into specific locations, so /usr would be stored in @usr,
/home in @home, .... To accomplish this, we need to copy /usr to @usr
and prevent any files from being copied into /usr in the partition,
which with this commit, we'd be able to do as follows:

```
[Partition]
CopyFiles=/usr:@usr
ExcludeFilesTarget=/usr
```

12 months agoshared/loop-util: use longer delay when waiting for loop device
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 22:20:30 +0000 (00:20 +0200)] 
shared/loop-util: use longer delay when waiting for loop device

The kernel may be syncing a file system or doing something else that requires
more time. So make the delay a bit longer, but provide some feedback and also
grow the delay exponentially (though with a long exponent). If the kernel is
doing something else, no need to repeat so often. With 38 attempts, we get a
total of slightly above 5000 ms.

I wrote this when I thought that the the delay is not long enough. It turned
out that we were blocking the file system on the loop device, so waiting longer
wasn't helpful. But I think it's nicer to do it this way anyway.

12 months agoman: extend description of .target a bit 27848/head
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 11:35:18 +0000 (13:35 +0200)] 
man: extend description of .target a bit

The man page is reference documentation, so we shouldn't write too much
duplicate things here, but we can make the text a bit more approachable. This
rewords and extends the documentation as requested and suggested in #24231 and
adds some hints for the user.

Closes #24231.

12 months agoman/systemd-gpt-auto-generator: mention that swap may be on luks too
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 09:28:48 +0000 (11:28 +0200)] 
man/systemd-gpt-auto-generator: mention that swap may be on luks too

Fixes #25972.

12 months agoman/systemctl: say that kexec loads the kernel, mention --force
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 09:12:26 +0000 (11:12 +0200)] 
man/systemctl: say that kexec loads the kernel, mention --force

Fixes #24588.
Fixes #15029.

12 months agoman/repart: document partition creation order
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 08:43:29 +0000 (10:43 +0200)] 
man/repart: document partition creation order

Fixes #22974.

The text is reworded a bit too. In particular, it's "partitions" that are not
reordered, not "partition table slots". If we were reordering things, we'd move
the partitions between slots. The slots themselves are not moveable.

12 months agoMerge pull request #27842 from keszybz/man-page-links
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 11:40:45 +0000 (13:40 +0200)] 
Merge pull request #27842 from keszybz/man-page-links

Man page formatting and links and such

12 months agoFix failing test 27766/head
Richard Phibel [Mon, 29 May 2023 22:45:09 +0000 (00:45 +0200)] 
Fix failing test

In test-execute, only the unit was started, not the slice. Because of
that the slice cgroup was pruned even if it was still needed. From what
I can tell, this is because, in the test, we don't have all the
mechanics that starts the slice for a service. To fix the issue the
slice is started manually.

12 months agomeson: use -Werror=strict-flex-arrays
Frantisek Sumsal [Tue, 30 May 2023 08:30:15 +0000 (10:30 +0200)] 
meson: use -Werror=strict-flex-arrays

12 months agoboot: make Event a standard-conforming flexible array
Frantisek Sumsal [Tue, 30 May 2023 08:21:26 +0000 (10:21 +0200)] 
boot: make Event a standard-conforming flexible array

12 months agoman: mention that udevadm verify also checks for udev rules style issues
Dmitry V. Levin [Mon, 29 May 2023 08:00:00 +0000 (08:00 +0000)] 
man: mention that udevadm verify also checks for udev rules style issues

Starting with commit acc1954a0394, udevadm verify also checks token
delimiters, which are not necessarily a matter of udev rules syntax,
but rather a question of style and readability.  Mention that in the
documentation to avoid confusion.

Suggested-by: Martin Wilck <mwilck@suse.com>
Complements: acc1954a0394 ("udev-rules: check token delimiters")

12 months agoman/analyze: drop paths from output examples 27842/head
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 08:06:05 +0000 (10:06 +0200)] 
man/analyze: drop paths from output examples

They are not useful for the user but make the examples
wider than necessary.

12 months agoman/analyze: reword description of malloc and fix link
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 08:04:02 +0000 (10:04 +0200)] 
man/analyze: reword description of malloc and fix link

12 months agoTEST-58: remove whitespace between redirection operator and its argument 27835/head
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 18:54:44 +0000 (20:54 +0200)] 
TEST-58: remove whitespace between redirection operator and its argument

12 months agoTEST-58: add echo calls to print what is happening
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 18:54:20 +0000 (20:54 +0200)] 
TEST-58: add echo calls to print what is happening

This makes it easier to identify the relevant test in the logs when
something fails.

12 months agoTEST-58: create config files as root
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 18:52:33 +0000 (20:52 +0200)] 
TEST-58: create config files as root

There is really no reason to go out of our way to create the config files as
the unprivileged user. And in the logs, the runas calls are quite verbose,
distracting from the interesting stuff. Also add .defs/.imgs/.root to the
temporary paths to make them easier to distinguish in the logs.

12 months agotest/README: fix advice for testsuite debugging
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 21:18:55 +0000 (23:18 +0200)] 
test/README: fix advice for testsuite debugging

KERNEL_APPEND="systemd.unit=multi-user.target" is not very useful, because the
machine will still shut down as soon as the tests succeeds or fails. But
INTERACTIVE_DEBUG=1 works great, so let's simplify the instructions and
recommend that.

12 months agoSupport no-journal for dm-integrity devices.
Russell Harmon [Mon, 29 May 2023 01:51:36 +0000 (18:51 -0700)] 
Support no-journal for dm-integrity devices.

As documented in integritysetup.8, dm-integrity devices support running
without a journal whatsoever. This change allows the
CRYPT_ACTIVATE_NO_JOURNAL flag (the same as is used with `integritysetup
--integrity-no-journal`) to be passed in during dmsetup by specifying
the `no-journal` option in integritytab.5.

12 months agoMerge pull request #27687 from keszybz/boot-efi-choices
Mike Yuan [Tue, 30 May 2023 07:21:42 +0000 (15:21 +0800)] 
Merge pull request #27687 from keszybz/boot-efi-choices

gpt-auto-generator: rework/simplify logic for picking /efi or /boot

12 months agobpf: test with GCC BPF compiler on opensuse
James Hilliard [Mon, 29 May 2023 21:45:13 +0000 (15:45 -0600)] 
bpf: test with GCC BPF compiler on opensuse

12 months agohome: move the assert back to the intended place
Frantisek Sumsal [Mon, 29 May 2023 18:28:34 +0000 (20:28 +0200)] 
home: move the assert back to the intended place

98d81cf974 moved the assertion at the beginning of home_dispatch_acquire(),
which is however before we even check for any ongoing operation, hence we
might hit it even in legitimate cases.

Let's move it back to after we check for any possibly ongoing operation, to
make it once again a safety check.

Follow-up to 98d81cf974.
Resolves: #22443 and #24036

12 months agobpf: stabilize GCC BPF support
James Hilliard [Mon, 29 May 2023 21:01:34 +0000 (15:01 -0600)] 
bpf: stabilize GCC BPF support

Now that we have a GCC release which should support our bpf programs
lets set the minimum version and stabilize it.

12 months agodissect: implement the same logic as gpt-auto-generator 27687/head
Zbigniew Jędrzejewski-Szmek [Wed, 24 May 2023 14:55:16 +0000 (16:55 +0200)] 
dissect: implement the same logic as gpt-auto-generator

gpt-auto-generator does three checks: 1. whether the directory doesn't have
files, 2. whether it's not in fstab, and 3. whether it is not a mount point.
For dissect logic, 3. is not relevant, and it ignores 2.
But the check whether files exists was done only partially: it was done
for /efi, but not for /boot.

Two changes are made:
- the check whether /boot is empty is now done.
- for ESP, /boot is used in preference to /efi, if not used for XBOOTLDR.

With those changes, the logic in dissect matches what gpt-auto-generator does.
There are the two intentional differences described in the first paragraph,

12 months agogpt-auto-generator: rework/simplify logic for picking /efi or /boot
Zbigniew Jędrzejewski-Szmek [Wed, 5 Apr 2023 15:10:16 +0000 (17:10 +0200)] 
gpt-auto-generator: rework/simplify logic for picking /efi or /boot

I started looking into https://github.com/uapi-group/specifications/issues/35.

BLS says:
> Otherwise [no existing XBOOTLDR partition], if on GPT and an ESP is found and
> it is large enough (let’s say at least 1G) it should be used as $BOOT and
> used as primary location to place boot loader menu resources in.

> It is recommended to mount $BOOT to /boot/, and the ESP to /efi/.

DPS says:
> The ESP used for the current boot is automatically mounted to /efi/ (or
> /boot/ as fallback), unless a different partition is mounted there (possibly
> via /etc/fstab, or because the Extended Boot Loader Partition — see below —
> exists) or the directory is non-empty on the root disk.

I don't think we want to mount the same partition in two places.
If the same partition is not mounted in two places, then the two specs are
contradictory.

The code in gpt-auto-generator implemented the logic from the DPS. It is
modified to implement the logic from BLS.

Effectively:
- if both /boot and /efi are available:
  - if both XBOOTLDR and ESP exist:
    ESP on /efi, XBOOTLDR on /boot
  - if only ESP exists:
    ESP on /boot
  - if only XBOOTLDR exists:
    XBOOTLDR on /boot
- if only /boot is available:
  - if XBOOTLDR exists:
    XBOOTLDR on /boot
  - if only ESP exists:
    ESP on /boot
- if only /efi is available:
  - if ESP exists:
    ESP on /efi

"Available" means that it the mount point is not mounted over and does not
contain files. If the directory doesn't exist, it is also "available" and will
be created later when the mount or automount unit is started.

Thus, the generator attempts to match the partitions and mount points to the
extent possible. In all cases, /boot is the primary place to install kernels.
ESP can be found on /boot or /efi, depending on the situation.

If this patch is merged, I'll submit fixes for BLS and DPS to describe the
same logic.

12 months agocore: Handle cgroup pruning in on_cgroup_empty_event
Richard Phibel [Thu, 25 May 2023 17:49:11 +0000 (19:49 +0200)] 
core: Handle cgroup pruning in on_cgroup_empty_event

This change removes the pruning of cgroups for FAILED/INACTIVE units
from per-unit-type handlers and moves it in on_cgroup_empty_event.

12 months agocore: Don't GC unit if it is in cgroup_empty_queue
Richard Phibel [Tue, 23 May 2023 14:09:40 +0000 (16:09 +0200)] 
core: Don't GC unit if it is in cgroup_empty_queue

The gc_unit_queue is dispatched before the cgroup_empty_queue.  Because
of this, when we enter in on_cgroup_empty_event, the unit in
cgroup_empty_queue may already have been freed and we don't clean up the
corresponding cgroup. With this change, we prevent the unit from being
garbage collected if it is in the cgroup_empty_queue.

12 months agoman/tmpfiles: add more man page citerefs
Zbigniew Jędrzejewski-Szmek [Wed, 17 May 2023 16:31:25 +0000 (18:31 +0200)] 
man/tmpfiles: add more man page citerefs

This was supposed to be part of 8fb350049bb7a7305589f201df9d37482e544f24, but
I forgot to save the file.

12 months agoresolvectl: drop extra colon
David Tardon [Sun, 28 May 2023 20:30:48 +0000 (22:30 +0200)] 
resolvectl: drop extra colon

12 months agobasic/syscall: update syscall list
Yu Watanabe [Sun, 28 May 2023 15:05:38 +0000 (00:05 +0900)] 
basic/syscall: update syscall list

Only notable change is that memfd_secret is now defined on s390(x).

12 months agogpt/DPS: add more aliases for python's machine
Luca Boccassi [Fri, 26 May 2023 19:45:29 +0000 (20:45 +0100)] 
gpt/DPS: add more aliases for python's machine

In mkosi we set the default architecture to platform.machine() which
is again slightly incompatible for a few architectures, so add more
aliases, so that repart works by default with these names.

12 months agojournalctl: fix --follow with non-matching filter 27519/head
Yu Watanabe [Sun, 28 May 2023 05:28:32 +0000 (14:28 +0900)] 
journalctl: fix --follow with non-matching filter

When there is no matching entry stored in journal, then initial call of
`sd_journal_previous()` following `sd_journal_seek_tail()` returns
zero, and does not move the read pointer.
In the main loop, on every journal event, we call `sd_journal_next()`,
even though the current location is tail, and it takes no effect.

In such a case, we need to call `sd_journal_previous()` instead of
`sd_journal_next()`.

12 months agosd-journal: introduce sd_journal_step_one()
Yu Watanabe [Sun, 28 May 2023 05:20:27 +0000 (14:20 +0900)] 
sd-journal: introduce sd_journal_step_one()

After the commit 7a4ee861615101ddd2f95056cf30e69e41da86ce,
sd_journal_next() following sd_journal_seek_tail() takes no-op,
and we need to call sd_journal_previous(). This may be useful in
some cases, e.g. to fix the issue explained in the previous commit.

12 months agotest: add testcase for 'journalctl --follow --cursor-file='
Yu Watanabe [Fri, 26 May 2023 21:12:09 +0000 (06:12 +0900)] 
test: add testcase for 'journalctl --follow --cursor-file='

Also, add a FIXME comment to illustrate the issue uncovered after by
7a4ee861615101ddd2f95056cf30e69e41da86ce.

12 months agojournalctl: also update cursor with --follow
Yu Watanabe [Thu, 4 May 2023 00:36:27 +0000 (09:36 +0900)] 
journalctl: also update cursor with --follow

Fixes #26746.

12 months agojournalctl: replace ppoll() loop with sd_event_loop()
Yu Watanabe [Wed, 3 May 2023 23:38:53 +0000 (08:38 +0900)] 
journalctl: replace ppoll() loop with sd_event_loop()

No functional change, just refactoring.

12 months agojournalctl: split out show()
Yu Watanabe [Wed, 3 May 2023 23:13:59 +0000 (08:13 +0900)] 
journalctl: split out show()

No functional changes, just refactoring.

12 months agojournalctl: split out update_cursor()
Yu Watanabe [Thu, 4 May 2023 00:29:25 +0000 (09:29 +0900)] 
journalctl: split out update_cursor()

No functional change, just refactoring.

12 months agojournalctl: split out action_list_fields()
Yu Watanabe [Wed, 3 May 2023 21:51:40 +0000 (06:51 +0900)] 
journalctl: split out action_list_fields()

No functional change, just refactoring.

12 months agojournalctl: fix --no-tail handling
Yu Watanabe [Thu, 4 May 2023 01:09:37 +0000 (10:09 +0900)] 
journalctl: fix --no-tail handling

Fixes a bug introduced by 62f21ec91ad8e7e24079962f4df066b0094fe68d.

12 months agojournalctl: use correct variable to check if --since is specified
Yu Watanabe [Thu, 4 May 2023 00:42:42 +0000 (09:42 +0900)] 
journalctl: use correct variable to check if --since is specified

12 months agojournalctl: always initialize global variables
Yu Watanabe [Thu, 4 May 2023 00:39:50 +0000 (09:39 +0900)] 
journalctl: always initialize global variables

That's not necessary, as they are initialized with zero, but for safety
and readability.

12 months agopo: add a false positive to POTFILES.skip
Piotr Drąg [Sat, 27 May 2023 16:11:35 +0000 (18:11 +0200)] 
po: add a false positive to POTFILES.skip

Scripts used to detect files that should be in POTFILES.in, like
intltool-update -m used on https://l10n.gnome.org/module/systemd/,
falsely detect this file as containing translations. Avoid this
behavior by putting the file in POTFILES.skip.

12 months agotree-wide: Downgrade a few more noisy log messages to trace
Daan De Meyer [Sat, 27 May 2023 08:36:30 +0000 (10:36 +0200)] 
tree-wide: Downgrade a few more noisy log messages to trace

12 months agoboot/measure: replace TPM PolicyPCR session with calculation
Dan Streetman [Fri, 5 May 2023 23:48:14 +0000 (19:48 -0400)] 
boot/measure: replace TPM PolicyPCR session with calculation

Instead of using a trial policy with a TPM to calculate the measurement hash,
this uses a function to calculate the hash with no TPM needed.

12 months agoMerge pull request #27721 from yuwata/journalctl-cleanup
Yu Watanabe [Fri, 26 May 2023 22:59:22 +0000 (07:59 +0900)] 
Merge pull request #27721 from yuwata/journalctl-cleanup

journalctl: split get_boots() into three

12 months agoAdd DHCPServer information to JSON output.
Rene Hollander [Sun, 30 Apr 2023 11:31:28 +0000 (13:31 +0200)] 
Add DHCPServer information to JSON output.

Adds a new JSON object called DHCPServer for each interface that has a
DHCPServer configured. It has the following attributes:
- PoolSize and PoolOffset from the configuration
- List of offered leases
- List of static leases from the configuration

12 months agoRevert "test: add test case for systemd-update-utmp vs daemon-reexec"
Frantisek Sumsal [Fri, 26 May 2023 19:41:43 +0000 (21:41 +0200)] 
Revert "test: add test case for systemd-update-utmp vs daemon-reexec"

Temporarily revert the test case for #27167, as the additional
daemon-reexecs exacerbate #27287, making CIs fail quite often.
As the #27167 is also covered by TEST-01-BASIC itself, since we do
daemon-reexec there anyway, we shouldn't lose any coverage, but it
should make CIs more stable until #27287 is figured out.

Resolves (or more like works around): #27807

This reverts commit d689f70a2c18666bbf6500df7a53962a8f3e91a4.

12 months agoMerge pull request #27517 from ddstreet/tpm2_calculate_policy
Daan De Meyer [Fri, 26 May 2023 21:08:15 +0000 (23:08 +0200)] 
Merge pull request #27517 from ddstreet/tpm2_calculate_policy

Tpm2 calculate policy

12 months agojournalctl: split get_boots() into three 27721/head
Yu Watanabe [Fri, 26 May 2023 18:57:39 +0000 (03:57 +0900)] 
journalctl: split get_boots() into three

Previously, get_boots() used for three ways; finding boot entry by
boot ID, finding boot entry by offset, listing up all boot IDs.

Let's split it into three for each usecase.

No functional change, just refactoring.

12 months agologs-show: introduce add_match_boot_id() helper function
Yu Watanabe [Sun, 21 May 2023 14:06:28 +0000 (23:06 +0900)] 
logs-show: introduce add_match_boot_id() helper function

12 months agoMerge pull request #27787 from keszybz/firstboot-synchronous-restart
Mike Yuan [Fri, 26 May 2023 18:30:45 +0000 (02:30 +0800)] 
Merge pull request #27787 from keszybz/firstboot-synchronous-restart

firstboot: make restart of vconsole-setup synchronuous

12 months agoMerge pull request #27786 from YHNdnzj/format-timestamp-monotonic
Yu Watanabe [Fri, 26 May 2023 18:05:34 +0000 (03:05 +0900)] 
Merge pull request #27786 from YHNdnzj/format-timestamp-monotonic

time-util,format-table: add relative_monotonic variant for timestamp

12 months agoMerge pull request #27803 from mrc0mmand/even-more-nalloc-shenanigans
Yu Watanabe [Fri, 26 May 2023 17:58:32 +0000 (02:58 +0900)] 
Merge pull request #27803 from mrc0mmand/even-more-nalloc-shenanigans

A couple more fixes for potential OOM-related issues

12 months agogpt/DPS: alias amd64 to x86-64 and aarch64 to arm64
Luca Boccassi [Fri, 26 May 2023 14:44:42 +0000 (15:44 +0100)] 
gpt/DPS: alias amd64 to x86-64 and aarch64 to arm64

The DSP and our implementation mixes Debian terminology with CPU
terminology. It uses arm64 which is a Debian thing instead of
aarch64, but x86-64 which is a CPU thing instead of amd64.
Add some convenience and transparent aliasing, so that we don't
need to maintain architecture-specific and tool-specific translation
layers in mkosi among other places, while at the same time the DDIs
still look the same (ie: the partlabel does not change depending on
which alias is used, the canonical label is used on disk).

12 months agotest-gpt: verify that alias entries are identical to the primary ones
Lennart Poettering [Fri, 26 May 2023 14:55:29 +0000 (16:55 +0200)] 
test-gpt: verify that alias entries are identical to the primary ones

Given we allow aliases we better check for consistency of alias entries
and the primary one.

12 months agotpm2: add tpm2_calculate_sealing_policy() 27517/head
Dan Streetman [Thu, 15 Dec 2022 17:56:35 +0000 (12:56 -0500)] 
tpm2: add tpm2_calculate_sealing_policy()

This adds a function to fully calculate the authPolicy needed to seal a secret,
and updates tpm2_seal() to use the new function instead of a trial policy.

12 months agotpm2: use tpm2_policy_authorize()
Dan Streetman [Thu, 9 Feb 2023 15:04:58 +0000 (10:04 -0500)] 
tpm2: use tpm2_policy_authorize()

This updates the function to build the sealing policy to use the dedicated
function to perform PolicyAuthorize.

This is separate from the previous commit to make each commit easier to read.