]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoveritysetup: remove double escaping of data device + hash device spec 27889/head
Lennart Poettering [Thu, 1 Jun 2023 17:15:10 +0000 (19:15 +0200)] 
veritysetup: remove double escaping of data device + hash device spec

generator_write_veritysetup_service_section() already escapes the
parameters internally, doing so in the caller means double escaping,
which is a bug. Fix it.

2 years agoveritysetup: minor renaming of functions
Lennart Poettering [Thu, 1 Jun 2023 16:54:33 +0000 (18:54 +0200)] 
veritysetup: minor renaming of functions

create_device() and create_disk() so far did very similar things, but
the name didn't give a hint what the difference was.

Hence let's rename them to create_special_device() and
create_veritytab_device() to make this more understandabe, as one
creates /proc/cmdline specified roothash=/usrhash= devices, and the
other one devices for items listed in /etc/veritytab.

No code changes besides renaming.

2 years ago{crypt|verity}setup: mention volume name in some error messages
Lennart Poettering [Thu, 1 Jun 2023 13:31:25 +0000 (15:31 +0200)] 
{crypt|verity}setup: mention volume name in some error messages

2 years ago{crypt|verity}setup: replace dep on systemd-tmpfiles-setup-dev.service by modprobe...
Lennart Poettering [Thu, 1 Jun 2023 13:00:27 +0000 (15:00 +0200)] 
{crypt|verity}setup: replace dep on systemd-tmpfiles-setup-dev.service by modprobe@loop.service

Both should have the same effect: the /dev/loop-control devices should
become available. systemd-tmpfiles-setup-dev.service creates the device
node "dry" based on modalias data, while modprobe@loop.service creates
it fully, because the module backing it is loaded properly. This should
shorten the deps chain a bit, simplify things and allows us to focus on
the stuff we actually need (i.e. the loopback infra) instead of all
entrypoints anyone might possibly need (i.e. the device nodes)

2 years agoveritysetup-generator: only generate one set of deps on systemd-tmpfiles-setup-dev...
Lennart Poettering [Thu, 1 Jun 2023 12:55:26 +0000 (14:55 +0200)] 
veritysetup-generator: only generate one set of deps on systemd-tmpfiles-setup-dev.service

If both the data and the hash device are a regular file we might create
two sets of deps on s-t-s-d.s, which is of course redundant. Shorten the
code to only generate this once.

No change in behaviour.

2 years agoveritysetup-generator: imply x-initrd.attach for "usr" and "root" volumes
Lennart Poettering [Thu, 1 Jun 2023 12:50:15 +0000 (14:50 +0200)] 
veritysetup-generator: imply x-initrd.attach for "usr" and "root" volumes

Similar to the previous commit, just vor Verity rather than LUKS.

2 years agocryptsetup-generator: imply x-initrd.attach for "usr" and "root" volumes
Lennart Poettering [Thu, 1 Jun 2023 12:40:38 +0000 (14:40 +0200)] 
cryptsetup-generator: imply x-initrd.attach for "usr" and "root" volumes

Let's imply "x-initrd.attach" for "usr" and "root" volumes, so that
we do not attempt to umount them anymore during shutdown.

The names of these volumes have been mandated by the Discoverable
Partition Spec:

https://uapi-group.org/specifications/specs/discoverable_partitions_specification/#suggested-mode-of-operation

Hence it appears reasonably safe to special case these volume names.

Note that a similar logic is implemented in fstab-generator and in fact
PID 1 to treat the root mount and /usr/ mount specially too, to avoid
trying to umount it at shutdown. (This is what fstab_is_extrinsic()
checks).

This should ensure that if /usr/ or / is for some reason a LUKS medium
we won't try to detach it during runtime, which likely fails, since we
run off it.

Note this also moves an ordering dep towards umount.target under the
x-initrd.attach check, becasue that's where the crucial conflicts dep is
placed too.

2 years agounits: don't stop blockdev@.target unit at shutdown
Lennart Poettering [Thu, 1 Jun 2023 16:31:17 +0000 (18:31 +0200)] 
units: don't stop blockdev@.target unit at shutdown

We want that cryptsetup/veritysetup devices can stick around until the
very end, as well as the users of them which might depend on
blockdev@.target for the devices. Hence leave the targets around till
the very end.

Note that their runtime is managed via StopWhenUnneeded= anyway, hence
unless their are volumes that actually survive still the very end they
target units will still be stopped.

2 years agounits: set DefaultDependencies=no for veritysetup slice
Lennart Poettering [Thu, 1 Jun 2023 16:28:08 +0000 (18:28 +0200)] 
units: set DefaultDependencies=no for veritysetup slice

This mimics what we already have for cryptsetup services: the slice they
are placed in (they have their own slice since that's what we do by
default for instantiated services) shouldn't conflict with
shutdown.target, so that veritysetup services can stay around until the
very end (which is what we want for the root and usr verity volumes).

It's literally just a copy of the same unit we already have for
cryptsetup, just with an updated description string.

2 years agoveritysetup-generator: use generic veritysetup writers at one more place
Lennart Poettering [Thu, 1 Jun 2023 15:20:59 +0000 (17:20 +0200)] 
veritysetup-generator: use generic veritysetup writers at one more place

Let's use the common generator_write_veritysetup_unit_section(),
ggenerator_write_veritysetup_service_section(), generator_add_symlink()
implementation we already have at one more place.

This mostly generates the same unit, but for the first time hooks up
blockdev@dev-mapper-*.device for the device, which means things like
growfs on usr+root volumes will actually work now. (I mean, growfs
won#t, because verity devices are immutable after all, but things *like*
it that want to run between the device popping up and being mounted.)

2 years agocryptsetup: fix whitespace issue
Lennart Poettering [Thu, 1 Jun 2023 16:49:16 +0000 (18:49 +0200)] 
cryptsetup: fix whitespace issue

2 years agofstab-util: drop redundant check
Lennart Poettering [Thu, 1 Jun 2023 12:48:55 +0000 (14:48 +0200)] 
fstab-util: drop redundant check

fstab_test_option() checks this as first thing anyway, hence let's drop
the redundant check.

2 years agosd-journal: fix assignment of tail entry offset
Yu Watanabe [Tue, 16 May 2023 21:02:00 +0000 (06:02 +0900)] 
sd-journal: fix assignment of tail entry offset

Fixes a bug introduced by 206f0f397edf1144c63a158fb30f496c3e89f256.

2 years agobuild(deps): bump github/codeql-action from 2.2.9 to 2.3.5
dependabot[bot] [Thu, 1 Jun 2023 09:57:12 +0000 (09:57 +0000)] 
build(deps): bump github/codeql-action from 2.2.9 to 2.3.5

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.9 to 2.3.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/04df1262e6247151b5ac09cd2c303ac36ad3f62b...0225834cc549ee0ca93cb085b92954821a145866)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agobuild(deps): bump meson from 1.1.0 to 1.1.1 in /.github/workflows
dependabot[bot] [Thu, 1 Jun 2023 09:57:18 +0000 (09:57 +0000)] 
build(deps): bump meson from 1.1.0 to 1.1.1 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.1.0...1.1.1)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agotest: make TEST-04 stable once again
Frantisek Sumsal [Thu, 1 Jun 2023 07:07:28 +0000 (09:07 +0200)] 
test: make TEST-04 stable once again

Wait a bit if necessary for the cursor file to appear.

Follow-up fb35feae97.

2 years agoMerge pull request #27874 from keszybz/test-bus-server-shortening
Yu Watanabe [Thu, 1 Jun 2023 12:10:55 +0000 (21:10 +0900)] 
Merge pull request #27874 from keszybz/test-bus-server-shortening

Simplify the code in test-bus-server

2 years agotest-sizeof: let's be a tiny bit more careful when using glibc internal types
Lennart Poettering [Thu, 1 Jun 2023 08:46:47 +0000 (10:46 +0200)] 
test-sizeof: let's be a tiny bit more careful when using glibc internal types

One can argue that internal glibc types (i.e. those starting with __)
are not really part of the glibc API, hence let's at least ifdef them.

2 years agobuild(deps): bump redhat-plumbers-in-action/advanced-issue-labeler
dependabot[bot] [Thu, 1 Jun 2023 09:57:18 +0000 (09:57 +0000)] 
build(deps): bump redhat-plumbers-in-action/advanced-issue-labeler

Bumps [redhat-plumbers-in-action/advanced-issue-labeler](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/compare/25a1e41826424cdf577c71b58c852df4347f13b8...71bcf99aef4b9ea844db9a43755e8ac02c8e661e)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/advanced-issue-labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agobuild(deps): bump actions/labeler from 4.0.3 to 4.0.4
dependabot[bot] [Thu, 1 Jun 2023 09:57:05 +0000 (09:57 +0000)] 
build(deps): bump actions/labeler from 4.0.3 to 4.0.4

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.3 to 4.0.4.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/ba790c862c380240c6d5e7427be5ace9a05c754b...0776a679364a9a16110aac8d0f40f5e11009e327)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agobuild(deps): bump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Thu, 1 Jun 2023 09:57:07 +0000 (09:57 +0000)] 
build(deps): bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 4.0.2 to 4.2.2.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/d24099b9f39ddee81dea31eb0e135e0a623cb2b8...ac4483d8c6713bd2011037f44fe626989468af74)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoMerge pull request #27856 from arianvp/fix-bootctl-status
Zbigniew Jędrzejewski-Szmek [Thu, 1 Jun 2023 08:25:30 +0000 (10:25 +0200)] 
Merge pull request #27856 from arianvp/fix-bootctl-status

bootctl: Print version number of detected binaries again

2 years agotest-bus-server: simplify return value handling 27874/head
Zbigniew Jędrzejewski-Szmek [Wed, 31 May 2023 15:22:23 +0000 (17:22 +0200)] 
test-bus-server: simplify return value handling

Follow-up for f7794e423ae79325bdbf7b3637b7cb7a1a57e62e.

2 years agovarious: remove typo/unusual spelling
Zbigniew Jędrzejewski-Szmek [Wed, 31 May 2023 15:17:26 +0000 (17:17 +0200)] 
various: remove typo/unusual spelling

Wikitionary says that "noone" is known, but not preferred by a large margin.
(It's also an obsolete spelling of "noon".)

2 years agoMerge pull request #27796 from yuwata/memstream-util
Yu Watanabe [Thu, 1 Jun 2023 03:07:17 +0000 (12:07 +0900)] 
Merge pull request #27796 from yuwata/memstream-util

util: introduce memstream-util

2 years agonetworkd/dhcpserver: Save and expose the client hostname sent when requesting a DHCP...
Rene Hollander [Sat, 27 May 2023 11:33:37 +0000 (13:33 +0200)] 
networkd/dhcpserver: Save and expose the client hostname sent when requesting a DHCP lease.

DHCP clients often send their own hostname in option 12. It can be useful
to store it with the lease so it can be shown to a human to easily identify
which lease belongs to which device.

RFC: https://www.rfc-editor.org/rfc/rfc2132#section-3.14

2 years agotree-wide: use memstream-util 27796/head
Yu Watanabe [Fri, 26 May 2023 06:40:12 +0000 (15:40 +0900)] 
tree-wide: use memstream-util

2 years agoutil: introduce memstream-util
Yu Watanabe [Fri, 26 May 2023 06:22:03 +0000 (15:22 +0900)] 
util: introduce memstream-util

There is many pitfalls in using memstream.
Let's introduce a wrapper to make us safely use it.

2 years agocalendarspec: rename arguments
Yu Watanabe [Sun, 28 May 2023 14:03:26 +0000 (23:03 +0900)] 
calendarspec: rename arguments

2 years agoelf-util: rename stack_context_destroy() -> stack_context_done()
Yu Watanabe [Sun, 28 May 2023 13:56:02 +0000 (22:56 +0900)] 
elf-util: rename stack_context_destroy() -> stack_context_done()

2 years agosd-bus: rename introspect_free() -> introspect_done
Yu Watanabe [Sun, 28 May 2023 13:53:23 +0000 (22:53 +0900)] 
sd-bus: rename introspect_free() -> introspect_done

2 years agotree-wide: use _cleanup_set_free_ and friends
Yu Watanabe [Sun, 28 May 2023 13:33:44 +0000 (22:33 +0900)] 
tree-wide: use _cleanup_set_free_ and friends

Instead of _cleanup_(set_freep) or so.

2 years agooomd: drop unused key
Yu Watanabe [Sun, 28 May 2023 12:43:45 +0000 (21:43 +0900)] 
oomd: drop unused key

2 years agocore/cgroup: fix setting SocketBindAllow=/SocketBindDeny= through DBus
Yu Watanabe [Sun, 28 May 2023 06:46:14 +0000 (15:46 +0900)] 
core/cgroup: fix setting SocketBindAllow=/SocketBindDeny= through DBus

2 years agocore/transaction: drop job that has unfulfilled required (Requires, BindsTo) dependencies
Michal Sekletar [Tue, 30 May 2023 13:47:16 +0000 (15:47 +0200)] 
core/transaction: drop job that has unfulfilled required (Requires, BindsTo) dependencies

Resolves: #11338

2 years agoman: vconsole.conf: replace the hardcoded keymap with build-time default
Mike Yuan [Wed, 31 May 2023 13:10:46 +0000 (21:10 +0800)] 
man: vconsole.conf: replace the hardcoded keymap with build-time default

Follow-up for #26089

2 years agotest: skip the test early if we're built without systemd-homed
Frantisek Sumsal [Wed, 31 May 2023 13:40:33 +0000 (15:40 +0200)] 
test: skip the test early if we're built without systemd-homed

We check for homed stuff in the test itself, but this is way too late,
since we already started a unit that Requires=systemd-homed.service
(testsuite-46.service). For now this doesn't matter, but with #27852
the offending transaction is dropped from the job queue, making the test
fail.

Spotted in #27852 in Ubuntu CI.

2 years agoMerge pull request #27826 from yuwata/network-link-ready-without-ndisc-when-has-stati...
Yu Watanabe [Wed, 31 May 2023 21:29:55 +0000 (06:29 +0900)] 
Merge pull request #27826 from yuwata/network-link-ready-without-ndisc-when-has-static-address

network: do not request dynamic addressing protocols finished when at…

2 years agoMerge pull request #27628 from ddstreet/tpm2_header_cleanup
Daan De Meyer [Wed, 31 May 2023 21:06:14 +0000 (23:06 +0200)] 
Merge pull request #27628 from ddstreet/tpm2_header_cleanup

Tpm2 header cleanup

2 years agoMerge pull request #27844 from DaanDeMeyer/repart-arch
Daan De Meyer [Wed, 31 May 2023 21:00:19 +0000 (23:00 +0200)] 
Merge pull request #27844 from DaanDeMeyer/repart-arch

repart: Add --architecture option

2 years agowait-online: request that at least one managed online interface exists
Yu Watanabe [Mon, 29 May 2023 03:37:44 +0000 (12:37 +0900)] 
wait-online: request that at least one managed online interface exists

Fixes a regression caused by ab3aed4a0349bbaa26f53340770c1b59b463e05d.

I thought the commit does not cause any severe regression. However,
drivers for network interfaces may be loaded later. So, we should wait
if no network interface is found.

Fixes #27822.

2 years agohwdb: add support for Elgato Stream Deck mini (gen 2)
Times-Z [Wed, 31 May 2023 16:44:09 +0000 (18:44 +0200)] 
hwdb: add support for Elgato Stream Deck mini (gen 2)

2 years agounits: pull in local-fs-pre.target from systemd-tmpfiles-setup-dev.service
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 16:44:46 +0000 (18:44 +0200)] 
units: pull in local-fs-pre.target from systemd-tmpfiles-setup-dev.service

local-fs-pre.target is a passive unit, which means that it is supposed to be
pulled in by everything that is ordered before it. We had
Before=local-fs-pre.target, so add Wants= too.

I don't expect this to change anything. Instead, just make things follow the
docs so it's easier to reason about the dependency set.

2 years 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

2 years 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

2 years agotpm2: sort tpm2 symbol list 27628/head
Dan Streetman [Thu, 16 Feb 2023 23:10:55 +0000 (18:10 -0500)] 
tpm2: sort tpm2 symbol list

Only cosmetic, no functional change.

2 years agotpm2: remove all extern tpm2-tss symbols
Dan Streetman [Fri, 5 May 2023 23:49:49 +0000 (19:49 -0400)] 
tpm2: remove all extern tpm2-tss symbols

These library syms should be restricted to use only in tpm2-util.c,
and all other code should use simpler functions exported in tpm2-util.h.

Also move the Esys_Freep() cleanup function into tpm-util.c, and make
tpm2-tss symbols static.

2 years agotpm: remove external calls to dlopen_tpm2()
Dan Streetman [Fri, 5 May 2023 23:53:32 +0000 (19:53 -0400)] 
tpm: remove external calls to dlopen_tpm2()

The calls outside tpm2-util.c are redundant, as tpm2_context_new()
is always called immediately after, which then calls dlopen_tpm2().

2 years 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

2 years 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()

2 years agobootctl: also print efi files not owned by systemd in status 27856/head
Arian van Putten [Wed, 31 May 2023 11:27:13 +0000 (13:27 +0200)] 
bootctl: also print efi files not owned by systemd in status

We should not skip over unknown entries in EFI/BOOT/ but
also print them out in status so people are aware that they are there.

2 years 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.

2 years 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

2 years 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.

2 years 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

2 years 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.

2 years 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

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

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

2 years 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

2 years 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.

2 years 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'

2 years agorepart: Add --architecture option 27844/head
Daan De Meyer [Tue, 30 May 2023 08:11:23 +0000 (10:11 +0200)] 
repart: Add --architecture option

This option allows overriding the architecture that's used for the
architecture specific partition types. This is useful to allow
reusing the same repart configuration to produce the same image for
different architectures.

2 years agogpt: Add gpt_partition_type_override_architecture()
Daan De Meyer [Wed, 31 May 2023 11:44:00 +0000 (13:44 +0200)] 
gpt: Add gpt_partition_type_override_architecture()

Let's add a function that allows changing the architecture of a given
partition type.

2 years agogpt: Use FOREACH_ARRAY
Daan De Meyer [Wed, 31 May 2023 11:32:23 +0000 (13:32 +0200)] 
gpt: Use FOREACH_ARRAY

2 years 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

2 years 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().

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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
2 years 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'

2 years 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.

2 years 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.

2 years 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.

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

2 years agobootctl: Print version number of detected binaries
Arian van Putten [Tue, 30 May 2023 17:12:36 +0000 (19:12 +0200)] 
bootctl: Print version number of detected binaries

In 9b9f6aa41204c995b7a3b3e99c50e92b0a8b3dde (#27069)
we changed get_file_version to return 0 instead of 1 on success.
However we did not update the printing of the version number to
handle this change so we would never print the version number.

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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.

2 years 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

2 years 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.

2 years agogpt: Fix copy paste error
Daan De Meyer [Tue, 30 May 2023 11:30:08 +0000 (13:30 +0200)] 
gpt: Fix copy paste error

2 years 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
```

2 years 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.

2 years 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.

2 years 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.

2 years 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.