]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoupdate TODO 23653/head
Antonio Alvarez Feijoo [Fri, 19 Aug 2022 07:02:17 +0000 (09:02 +0200)] 
update TODO

3 years agocryptsetup: improve password prompt text
Antonio Alvarez Feijoo [Fri, 19 Aug 2022 07:01:56 +0000 (09:01 +0200)] 
cryptsetup: improve password prompt text

Instead of always asking for passphrase, if the device has LUKS2 header check:
- If only regular passphrases are registered, ask for passphrase.
- If only recovery keys are registered, ask for recovery key.
- If both regular passphrases and recovery keys are registered, ask for
passphrase or recovery key.

3 years agoupdate TODO
Lennart Poettering [Mon, 8 Aug 2022 11:50:08 +0000 (13:50 +0200)] 
update TODO

3 years agodocs: mkosi-13 or newer required
Sonali Srivastava [Mon, 8 Aug 2022 10:43:00 +0000 (16:13 +0530)] 
docs: mkosi-13 or newer required

3 years agoboot: Build with at least -O1 as workaround 24233/head
Jan Janssen [Sat, 6 Aug 2022 07:07:47 +0000 (09:07 +0200)] 
boot: Build with at least -O1 as workaround

Fixes: #24202
3 years agosd-netlink: rename NLType and friends
Yu Watanabe [Mon, 25 Jul 2022 05:11:00 +0000 (14:11 +0900)] 
sd-netlink: rename NLType and friends

In sd-netlink, we use 'type' for naming many variables with different type,
and worst of all, function like `type_get_type()` exists. That makes the
code hard to understood.

Let's rename
- NLType -> NLAPolicy
- NLTypeSystem -> NLAPolicySet
- NLTypeSystemUnion -> NLAPolicySetUnion
- type_get_type() -> policy_get_type()
- type_get_type_system() -> policy_get_policy_set(), and so on.

This also changes the type of attribute taken by e.g.
`sd_netlink_message_append_string()` from `unsigned short` -> `uint16_t`
to make the variable size clearer.

3 years agoMerge pull request #23340 from yuwata/network-check-sr-iov-pf-state
Yu Watanabe [Fri, 5 Aug 2022 18:18:30 +0000 (03:18 +0900)] 
Merge pull request #23340 from yuwata/network-check-sr-iov-pf-state

network: check SR-IOV PF state

3 years agoMerge pull request #23508 from yuwata/core-device
Yu Watanabe [Fri, 5 Aug 2022 18:18:14 +0000 (03:18 +0900)] 
Merge pull request #23508 from yuwata/core-device

core/device: fix devlink handling

3 years agomkosi: Add package libfdisk to Ubuntu dependencies (#24211)
Richard Phibel [Fri, 5 Aug 2022 17:40:17 +0000 (19:40 +0200)] 
mkosi: Add package libfdisk to Ubuntu dependencies (#24211)

* mkosi: Add package libfdisk to Ubuntu dependencies

The libfdisk package is needed by systemd-repart.

3 years agobus: use inline trace argument for ANONYMOUS auth
David Rheinsberg [Wed, 29 Jun 2022 11:37:40 +0000 (13:37 +0200)] 
bus: use inline trace argument for ANONYMOUS auth

Rather than using a separate DATA round to transmit the trace-string of
the ANONYMOUS authentication scheme, transmit it inline as argument.
This requires a refactor of the client-side SASL parser, as we now have
a different set of replies depending on the mode used.

This fixes an issue where libdbus-1 does not query for trace-strings if
not transmit inline as AUTH-ANONYMOUS argument. It is unclear from the
wording of the spec whether this is a violation by libdbus-1. However,
we can work around it by simply changing our mode of transmittal.

3 years agoMerge pull request #24216 from poettering/ispowerof2
Luca Boccassi [Fri, 5 Aug 2022 15:38:58 +0000 (16:38 +0100)] 
Merge pull request #24216 from poettering/ispowerof2

add ISPOWEROF2() macro and use it

3 years agoman,journalctl: introduce man/--help sections
Lennart Poettering [Thu, 4 Aug 2022 13:15:52 +0000 (15:15 +0200)] 
man,journalctl: introduce man/--help sections

So far the --help text and the man page of journactl were mostly a large
pile of options shown next to each other. Let's add some basic
structure, and group switches by sections such as "Filtering Options",
"Output Options" and so on.

Do this the same way in the --help text and in the man page.

Since this moves everything around anyway, I also opted to rebreak all
paragraphs in the man page. This makes the patch larger than necessary,
but given that this whole patch doesn't really change contents besides
section titles I figured this would be OK.

3 years agocore/device: add comments for boolean arguments 23508/head
Yu Watanabe [Fri, 5 Aug 2022 13:16:58 +0000 (22:16 +0900)] 
core/device: add comments for boolean arguments

3 years agocore/device: always accept syspath change
Yu Watanabe [Thu, 28 Apr 2022 18:14:44 +0000 (03:14 +0900)] 
core/device: always accept syspath change

When multiple devices have the same devlink, then
adding/updating/removing one of the device may cause syspath change.

Fixes the following issue in
https://github.com/systemd/systemd/issues/23208#issue-1217909746
> the above shows an inconsistency between udev's and systemd's handling
> of the two different devices having the same alias. While udev replaces
> the by-uuid symlink which now points to sdh1 rather than sdd1, systemd
> keeps the previous mapping to sdd1 and emits a warning. This is not the
> problem cause but worth mentioning.

3 years agocore/device: move several functions
Yu Watanabe [Thu, 28 Apr 2022 18:12:17 +0000 (03:12 +0900)] 
core/device: move several functions

No functional change. A preparation for later commits.

3 years agocore/device: store the original path
Yu Watanabe [Fri, 29 Apr 2022 17:35:16 +0000 (02:35 +0900)] 
core/device: store the original path

The unit name may be hashed. Hence, we cannot obtain the original path
from the unit name.

The path will be used in the later commits.

3 years agocore: replace m->honor_device_enumeration with MANAGER_IS_SWITCHING_ROOT()
Franck Bui [Thu, 5 May 2022 09:11:57 +0000 (11:11 +0200)] 
core: replace m->honor_device_enumeration with MANAGER_IS_SWITCHING_ROOT()

3 years agocore: introduce MANAGER_IS_SWITCHING_ROOT() helper function
Franck Bui [Thu, 5 May 2022 06:49:56 +0000 (08:49 +0200)] 
core: introduce MANAGER_IS_SWITCHING_ROOT() helper function

Will be used by the following commit.

3 years agonetwork: also check SR-IOV PF port and other VF ports before configuring 23340/head
Yu Watanabe [Thu, 28 Jul 2022 06:11:46 +0000 (15:11 +0900)] 
network: also check SR-IOV PF port and other VF ports before configuring

When a PF port becomes down (this can happens e.g. the PF port is joining
a bond interface), some drivers make its VF ports also become down, and
may cause failures in configuring VF ports.

Similary, when a VF port become down, some drivers make its PF port and
other VF ports down.

Let's configure SR-IOV ports (both PF and VFs) after all link-layer
settings of all ports being applied.

Fixes #23315.

3 years agonetwork: manage SR-IOV PF and VF ports
Yu Watanabe [Thu, 28 Jul 2022 05:25:52 +0000 (14:25 +0900)] 
network: manage SR-IOV PF and VF ports

3 years agonetwork: split out link_is_ready_to_create_stacked_netdev()
Yu Watanabe [Fri, 13 May 2022 11:21:21 +0000 (20:21 +0900)] 
network: split out link_is_ready_to_create_stacked_netdev()

Preparation for later commits.

3 years agonetwork: check link state with link_is_ready_to_configure() before configuring DHCP...
Yu Watanabe [Fri, 13 May 2022 11:48:18 +0000 (20:48 +0900)] 
network: check link state with link_is_ready_to_configure() before configuring DHCP client or friends

Otherwise, DHCP client or friends may started before link-layer properties,
e.g. MAC address, being configured or the link being activated.

3 years agonetwork: drop carrier check for unmanaged interface from link_is_ready_to_configure()
Yu Watanabe [Thu, 28 Jul 2022 07:43:26 +0000 (16:43 +0900)] 
network: drop carrier check for unmanaged interface from link_is_ready_to_configure()

Preparation for later commits. No functional change.

3 years agonetwork: refuse to configure anything on pending or initialized state
Yu Watanabe [Tue, 10 May 2022 16:54:48 +0000 (01:54 +0900)] 
network: refuse to configure anything on pending or initialized state

3 years agonetwork: unset master ifindex only when necessary
Yu Watanabe [Thu, 12 May 2022 23:36:50 +0000 (08:36 +0900)] 
network: unset master ifindex only when necessary

3 years agonetwork: wiphy: use ERRNO_IS_DEVICE_ABSENT()
Yu Watanabe [Thu, 28 Jul 2022 07:39:11 +0000 (16:39 +0900)] 
network: wiphy: use ERRNO_IS_DEVICE_ABSENT()

3 years agoudev: ignore empty SR-IOV VF suffix
Yu Watanabe [Thu, 12 May 2022 23:54:44 +0000 (08:54 +0900)] 
udev: ignore empty SR-IOV VF suffix

It should not happen. Just for safety.

3 years agosd-device: introduce sd_device_new_child()
Yu Watanabe [Tue, 26 Jul 2022 19:16:55 +0000 (04:16 +0900)] 
sd-device: introduce sd_device_new_child()

3 years agoci: set a timeout for each mkosi stage
Frantisek Sumsal [Fri, 5 Aug 2022 09:48:45 +0000 (11:48 +0200)] 
ci: set a timeout for each mkosi stage

Work around #24202 so we don't wait ~6 hours for a stuck QEMU job.

3 years agomacro: use ISPOWEROF2() at various places 24216/head
Lennart Poettering [Fri, 5 Aug 2022 11:19:23 +0000 (13:19 +0200)] 
macro: use ISPOWEROF2() at various places

3 years agomacro: add macro for checking if integer is power of 2
Lennart Poettering [Fri, 5 Aug 2022 11:16:27 +0000 (13:16 +0200)] 
macro: add macro for checking if integer is power of 2

3 years agoMerge pull request #23367 from yuwata/core-mount
Yu Watanabe [Fri, 5 Aug 2022 04:48:23 +0000 (13:48 +0900)] 
Merge pull request #23367 from yuwata/core-mount

core/mount: fix dependency issues

3 years agotest-network: support the case that l2tp module is not supported
Yu Watanabe [Thu, 4 Aug 2022 16:03:54 +0000 (01:03 +0900)] 
test-network: support the case that l2tp module is not supported

Hopefully fixes the issue reported at
https://github.com/systemd/systemd-centos-ci/pull/517#issuecomment-1205399798.

3 years agotest: add test case for mount unit dependencies 23367/head
Yu Watanabe [Wed, 20 Jul 2022 07:56:25 +0000 (16:56 +0900)] 
test: add test case for mount unit dependencies

3 years agocore/mount: make device deps from /proc/self/mountinfo and .mount unit file exclusive
Yu Watanabe [Sat, 14 May 2022 21:31:17 +0000 (06:31 +0900)] 
core/mount: make device deps from /proc/self/mountinfo and .mount unit file exclusive

Before this commit, when a .mount unit file is loaded, the device
dependencies from the unit file are automatically added. If a device
that is different from which specified in .mount unit file is mounted
on the path, then the device dependencies about the device are also added.
Hence, the unit has device dependencies about two (or more) different
devices. Hence, if one of the devices are unplugged, even if another one
is mounted on the path, then the path is unmounted.

This commit makes device dependencies from two different sources
exclusive, and always regenerate the dependencies when one of the
information is updated.

Fixes #19983 and #23552.

3 years agocore/mount: also remove default deps from /proc/self/mountinfo when it is updated
Yu Watanabe [Sat, 14 May 2022 20:49:01 +0000 (05:49 +0900)] 
core/mount: also remove default deps from /proc/self/mountinfo when it is updated

The dependencies tagged with UNIT_DEPENDENCY_MOUNTINFO_DEFAULT depend
on both /proc/self/mountinfo and corresponding .mount unit file.
Hence, if some information from mountinfo is updated, e.g. device mounted
on the path, we need to update the dependencies.

3 years agocore/mount: set Mount.from_proc_self_mountinfo flag before adding default dependencies
Yu Watanabe [Fri, 13 May 2022 03:30:04 +0000 (12:30 +0900)] 
core/mount: set Mount.from_proc_self_mountinfo flag before adding default dependencies

When the function mount_setup_new_unit() is called, the corresponding
.mount unit file is not loaded. Hence, Mount.from_fragment is false.
To add default dependencies to e.g. .device units, it is necessary that
the Mount.from_proc_self_mountinfo flag is set. However, the flag was
not set even the unit has information from /proc/self/mountinfo.

Partially fixes #19983.

3 years agocore: unit_name_from_path() does not return -ENAMETOOLONG anymore
Yu Watanabe [Fri, 13 May 2022 02:40:55 +0000 (11:40 +0900)] 
core: unit_name_from_path() does not return -ENAMETOOLONG anymore

Follow-ups for a7fb1f2eae3314c28d451822302283a7ab1bc1c0 and
1d0727e76fd5e9a07cc9991ec9a10ea1d78a99c7.

3 years agocore/mount: use set_put_strdup_full()
Yu Watanabe [Sat, 14 May 2022 20:40:34 +0000 (05:40 +0900)] 
core/mount: use set_put_strdup_full()

3 years agoMerge pull request #24189 from medhefgo/boot-secure
Lennart Poettering [Thu, 4 Aug 2022 15:27:20 +0000 (17:27 +0200)] 
Merge pull request #24189 from medhefgo/boot-secure

boot: Follow-up fixes for #20255

3 years agopull: fix PullFlags numbering
Ludwig Nussel [Tue, 19 Jul 2022 15:29:45 +0000 (17:29 +0200)] 
pull: fix PullFlags numbering

3 years agoanalyze: Migrate to bus-locator.h
Richard Phibel [Thu, 4 Aug 2022 09:03:51 +0000 (11:03 +0200)] 
analyze: Migrate to bus-locator.h

Migrated analyze-security to use new API bus_call_method instead of sd_bus_call_method.

3 years agoscope: allow unprivileged delegation on scopes
Michal Sekletar [Wed, 1 Jun 2022 08:15:06 +0000 (10:15 +0200)] 
scope: allow unprivileged delegation on scopes

Previously it was possible to set delegate property for scope, but you
were not able to allow unprivileged process to manage the scope's cgroup
hierarchy. This is useful when launching manager process that  will run
unprivileged but is supposed to manage its own (scope) sub-hierarchy.

Fixes #21683

3 years agotest: skip the relevant test case if systemd-measure is not present
Frantisek Sumsal [Thu, 4 Aug 2022 09:00:10 +0000 (11:00 +0200)] 
test: skip the relevant test case if systemd-measure is not present

systemd-measure is not built without gnu-efi, which is the case, for
example, on ppc64le. Let's skip the relevant test case in this case
instead of failing.

```
The Meson build system
Version: 0.58.2
...
Host machine cpu family: ppc64
Host machine cpu: ppc64le
...
Message: Skipping systemd-measure.1 because HAVE_GNU_EFI is false
...
[  115.711775] testsuite-70.sh[745]: + cat
[  115.741996] testsuite-70.sh[832]: + /usr/lib/systemd/systemd-measure calculate --linux=/tmp/tpmdata1 --initrd=/tmp/tpmdata2
[  115.754015] testsuite-70.sh[833]: + cmp - /tmp/result
[  115.758004] testsuite-70.sh[832]: /usr/lib/systemd/tests/testdata/units/testsuite-70.sh: line 56: /usr/lib/systemd/systemd-measure: No such file or directory
[  115.773851] testsuite-70.sh[833]: cmp: EOF on - which is empty
[  115.983681] sh[835]: + systemctl poweroff --no-block
```

3 years agodocs: add disabled PR template for code freeze
Luca Boccassi [Tue, 26 Jul 2022 17:01:09 +0000 (18:01 +0100)] 
docs: add disabled PR template for code freeze

To be enabled on rc1, and disabled again after the final release.
Gives contributors a clear warning that new features/APIs will be
postponed.

3 years agoboot: Skip safety countdown when running in a VM 24189/head
Jan Janssen [Thu, 4 Aug 2022 08:21:15 +0000 (10:21 +0200)] 
boot: Skip safety countdown when running in a VM

3 years agoman: Add instructions for Microsoft secure boot keys
Jan Janssen [Wed, 3 Aug 2022 09:27:38 +0000 (11:27 +0200)] 
man: Add instructions for Microsoft secure boot keys

Adding Microsoft keys by default is recommended because firmware drivers
might be signed by it.

This also changes the file ending from .esl to .auth as that is used by
sign-efi-sig-list manpage and other sources.

3 years agorepart: Only lock block device once
Daan De Meyer [Wed, 3 Aug 2022 09:37:17 +0000 (11:37 +0200)] 
repart: Only lock block device once

Let's lock the backing fd instead of locking/unlocking multiple
times when doing multiple operations with repart. It doesn't make
much sense for anything else to touch the block device while there
are still repart operations pending on it. By keeping the lock over
the full duration of repart, we avoid anything else from interfering
with the block device inbetween operations.

3 years agoMerge pull request #24141 from DaanDeMeyer/dissect-umount
Luca Boccassi [Thu, 4 Aug 2022 00:02:55 +0000 (01:02 +0100)] 
Merge pull request #24141 from DaanDeMeyer/dissect-umount

dissect: Add systemd-dissect --umount

3 years agointegritysetup: do not use crypt_init_data_device after crypt_init
Luca Boccassi [Wed, 3 Aug 2022 17:41:13 +0000 (18:41 +0100)] 
integritysetup: do not use crypt_init_data_device after crypt_init

crypt_init_data_device() replaces the crypt_device struct with a
new allocation, losing the old one, which we get from crypt_init().
Use crypt_set_data_device() instead.

Enhance the test to cover this option too.

3 years agoman: Clarify that tools should prefer mount units over editing fstab
Daan De Meyer [Wed, 3 Aug 2022 13:52:29 +0000 (15:52 +0200)] 
man: Clarify that tools should prefer mount units over editing fstab

3 years agodissect: Add systemd-dissect --umount 24141/head
Daan De Meyer [Wed, 27 Jul 2022 23:55:11 +0000 (01:55 +0200)] 
dissect: Add systemd-dissect --umount

This command takes a mountpoint, unmounts it and makes sure the
underlying partition devices and block device are removed before
exiting.

To mirror the --mount operation, we also add a --rmdir option which
does the opposite of --mkdir, and a -U option which is a shortcut
for --umount --rmdir.

3 years agoblockdev-util: Add block_device_remove_all_partitions()
Daan De Meyer [Fri, 29 Jul 2022 10:19:09 +0000 (12:19 +0200)] 
blockdev-util: Add block_device_remove_all_partitions()

This function takes a block device, uses sd-device to iterate all
the partitions, and removes them one by one.

3 years agoloop-util: Add loop_device_unrelinquish()
Daan De Meyer [Wed, 27 Jul 2022 23:49:07 +0000 (01:49 +0200)] 
loop-util: Add loop_device_unrelinquish()

Allows taking ownership of a loop device which makes sure that
loop_device_unrefp() will try to destroy it when it runs.

3 years agoblockdev-util: Introduce block_device_add/remove_partition()
Daan De Meyer [Wed, 27 Jul 2022 22:54:16 +0000 (00:54 +0200)] 
blockdev-util: Introduce block_device_add/remove_partition()

Extracted from dissect-image.c.

3 years agoblockdev-util: Introduce fd_get_whole_disk()
Daan De Meyer [Wed, 27 Jul 2022 21:11:37 +0000 (23:11 +0200)] 
blockdev-util: Introduce fd_get_whole_disk()

Extracted from find_devno() in udevadm-lock.c.

3 years agoman: fix docbook
Lennart Poettering [Wed, 3 Aug 2022 16:51:45 +0000 (18:51 +0200)] 
man: fix docbook

3 years agojournal: remove unnecessary HAVE_PCRE2 check
Quentin Deslandes [Mon, 25 Jul 2022 13:53:12 +0000 (15:53 +0200)] 
journal: remove unnecessary HAVE_PCRE2 check

Since HAVE_PCRE2 checks are performed in pcre2-util.c, there is no
need for this extra check in journalctl.c.

3 years agocore: drop unused BUS_UNIT_QUEUE_RETURN_SKIP_ON_CONDITION_FAIL flag
Luca Boccassi [Mon, 18 Apr 2022 20:46:52 +0000 (22:46 +0200)] 
core: drop unused BUS_UNIT_QUEUE_RETURN_SKIP_ON_CONDITION_FAIL flag

We'll refactor and implement the feature in a different way

3 years agorepart: Remove unnecessary newlines from JSON output
Daan De Meyer [Wed, 3 Aug 2022 13:39:12 +0000 (15:39 +0200)] 
repart: Remove unnecessary newlines from JSON output

Before

```
➜  systemd git:(dissect-have-blkid) SYSTEMD_LOG_LEVEL=err build/systemd-repart --definitions definitions/ --dry-run=yes --empty=create --size=100M --json=pretty abc
[
        {
                "type" : "root-x86-64",
                "label" : "root-x86-64",
                "uuid" : "2f7c902c-6b2a-4b47-a44b-dca765f38cd2",
                "file" : "root.conf",
                "node" : "abc1",
                "offset" : 1048576,
                "old_size" : 0,
                "raw_size" : 103788544,
                "old_padding" : 0,
                "raw_padding" : 0,
                "activity" : "create"
        }
]

➜  systemd git:(dissect-have-blkid)
```

After:

```
➜  systemd git:(repart-newlines) SYSTEMD_LOG_LEVEL=err build/systemd-repart --definitions definitions/ --dry-run=yes --empty=create --size=100M --json=pretty abc
[
        {
                "type" : "root-x86-64",
                "label" : "root-x86-64",
                "uuid" : "2f7c902c-6b2a-4b47-a44b-dca765f38cd2",
                "file" : "root.conf",
                "node" : "abc1",
                "offset" : 1048576,
                "old_size" : 0,
                "raw_size" : 103788544,
                "old_padding" : 0,
                "raw_padding" : 0,
                "activity" : "create"
        }
]
➜  systemd git:(repart-newlines)
```

3 years agotest: optionally wait a bit when checking the mount unit
Frantisek Sumsal [Wed, 3 Aug 2022 10:35:49 +0000 (12:35 +0200)] 
test: optionally wait a bit when checking the mount unit

On fast systems we might race against systemd and check the mount unit
after mounting it way too early before systemd had a chance to react to
the change.

```
[    4.677701] H systemd[1]: Event source 0x210b3b0 (mount-monitor-dispatch) entered rate limit state.
...
[    4.863731] H testsuite-64.sh[812]: + mount /logsysfsRxx
[    4.865918] H kernel: EXT4-fs (vda2): mounted filesystem with ordered data mode. Opts: (null)
[    4.866213] H testsuite-64.sh[812]: + systemctl status /logsysfsRxx
[    4.877502] H testsuite-64.sh[919]: ○ logsysfsRxx.mount - /logsysfsRxx
[    4.877502] H testsuite-64.sh[919]:      Loaded: loaded (/etc/fstab; generated)
[    4.877502] H testsuite-64.sh[919]:      Active: inactive (dead)
[    4.877502] H testsuite-64.sh[919]:       Where: /logsysfsRxx
[    4.877502] H testsuite-64.sh[919]:        What: /dev/disk/by-uuid/deadbeef-dead-dead-beef-222222222222
[    4.877502] H testsuite-64.sh[919]:        Docs: man:fstab(5)
[    4.877502] H testsuite-64.sh[919]:              man:systemd-fstab-generator(8)
[    4.877502] H testsuite-64.sh[919]: Aug 03 10:10:10 H systemd[1]: logsysfsRxx.mount: Processing implicit device dependencies
[    4.877502] H testsuite-64.sh[919]: Aug 03 10:10:10 H systemd[1]: logsysfsRxx.mount: Added Requires dependency on /dev/disk/by-uuid/deadbeef-dead-dead-beef-222222222222
[    4.877502] H testsuite-64.sh[919]: Aug 03 10:10:10 H systemd[1]: logsysfsRxx.mount: Added StopPropagatedFrom dependency on /dev/disk/by-uuid/deadbeef-dead-dead-beef-222222222222
[    4.895683] H sh[920]: + systemctl poweroff --no-block
[    4.906533] H systemd[1]: Found unit logsysfsRxx.mount at /run/systemd/generator/logsysfsRxx.mount (regular file)
[    4.906594] H systemd[1]: Preset files don't specify rule for logsysfsRxx.mount. Enabling.
[    4.906990] H systemd[1]: testsuite-64.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
[    4.907057] H systemd[1]: testsuite-64.service: Failed with result 'exit-code'.
[    4.907287] H systemd[1]: Failed to start testsuite-64.service.
[    4.955293] H systemd[1]: Starting end.service...
[    4.955736] H systemd-logind[809]: The system will power off now!
[    4.955868] H systemd-logind[809]: System is powering down.
[    4.975781] H systemd[1]: Event source 0x210b3b0 (mount-monitor-dispatch) left rate limit state.
[    4.975821] H systemd[1]: logsysfsRxx.mount: Processing implicit device dependencies
[    4.975857] H systemd[1]: logsysfsRxx.mount: Added Requires dependency on /dev/vda2
[    4.975893] H systemd[1]: logsysfsRxx.mount: Added StopPropagatedFrom dependency on /dev/vda2
[    4.975928] H systemd[1]: Unit blockdev@dev-vda2.target has alias blockdev@.target.
[    4.975967] H systemd[1]: logsysfsRxx.mount: Added After dependency on /dev/vda2
[    4.976081] H systemd[1]: logsysfsRxx.mount: Changed dead -> mounted
```

3 years agobpf: fix is_allow_list section
James Hilliard [Mon, 1 Aug 2022 01:11:47 +0000 (01:11 +0000)] 
bpf: fix is_allow_list section

The llvm bpf compiler appears to place const volatile variables in
a non-standard section which creates an incompatibility with the gcc
bpf compiler.

To fix this force GCC to also use the rodata section.

Note this does emit an assembler warning:
Generating src/core/bpf/restrict_ifaces/restrict-ifaces.bpf.unstripped.o with a custom command
/tmp/ccM2b7jP.s: Assembler messages:
/tmp/ccM2b7jP.s:87: Warning: setting incorrect section attributes for .rodata

See:
https://github.com/llvm/llvm-project/issues/56468

Fixes:
../src/core/restrict-ifaces.c:45:14: error: ‘struct
restrict_ifaces_bpf’ has no member named ‘rodata’; did you mean
‘data’?
   45 |         obj->rodata->is_allow_list = is_allow_list;
      |              ^~~~~~
      |              data

3 years agoFix 24172: __STDC_VERSION__ may be defined in C++
Loïc Collignon [Wed, 3 Aug 2022 09:42:28 +0000 (11:42 +0200)] 
Fix 24172: __STDC_VERSION__ may be defined in C++

According to the C++ ISO standard, a conformant compiler is allowed to
define this macro to any value for any reason as it is implementation
defined: https://timsong-cpp.github.io/cppwp/cpp.predefined#2.3

This mean that it cannot be assumed that it is not defined in a C++.
Change the condition to reflect that.

3 years agoboot: Follow-up fixes for #20255
Jan Janssen [Wed, 3 Aug 2022 09:05:12 +0000 (11:05 +0200)] 
boot: Follow-up fixes for #20255

3 years agoAdded DERE DBook D10 (#24173)
Gio [Wed, 3 Aug 2022 08:26:03 +0000 (04:26 -0400)] 
Added DERE DBook D10 (#24173)

* Added DERE DBook D10

3 years ago This patch adds support for enrolling secure boot boot keys from sd-boot.
Vincent Dagonneau [Mon, 9 May 2022 18:13:28 +0000 (14:13 -0400)] 
 This patch adds support for enrolling secure boot boot keys from sd-boot.

***DANGER*** NOTE ***DANGER***

This feature might result in your device becoming soft-brick as outlined
below, please use this feature carefully.

***DANGER*** NOTE ***DANGER***

If secure-boot-enrollment is set to no, then no action whatsoever is performed,
no matter the files on the ESP.

If secure boot keys are found under $ESP/loader/keys and secure-boot-enrollment
is set to either manual or force then sd-boot will generate enrollment entries
named after the directories they are in. The entries are shown at the very bottom
of the list and can be selected by the user from the menu. If the user selects it,
the user is shown a screen allowing for cancellation before a timeout. The enrollment
proceeds if the action is not cancelled after the timeout.

Additionally, if the secure-boot-enroll option is set to 'force' then the keys
located in the directory named 'auto' are going to be enrolled automatically. The user
is still going to be shown a screen allowing them to cancel the action if they want to,
however the enrollment will proceed automatically after a timeout without
user cancellation.

After keys are enrolled, the system reboots with secure boot enabled therefore, it is
***critical*** to ensure that everything needed for the system to boot is signed
properly (sd-boot itself, kernel, initramfs, PCI option ROMs).

This feature currently only allows loading the most simple set of variables: PK, KEK
and db.

The files need to be prepared with cert-to-efi-sig-list and then signed with
sign-efi-sig-list.

Here is a short example to generate your own keys and the right files for
auto-enrollement.

`
keys="PK KEK DB"
uuid="{$(systemd-id128 new -u)}"
for key in ${keys}; do
openssl req -new -x509 -subj "/CN=${key}/ -keyout "${key}.key" -out "${key}.crt"
openssl x509 -outform DER -in "${key}.crt" -out "${key}.cer"
cert-to-efi-sig-list -g "${uuid}" "${key}.crt" "${key}.esl.nosign"
done

sign-efi-sig-list -c PK.crt -k PK.key PK PK.esl.nosign PK.esl
sign-efi-sig-list -c PK.crt -k PK.key KEK KEK.esl.nosign KEK.esl
sign-efi-sig-list -c KEK.crt -k KEK.key db db.esl.nosign db.esl
`

Once these keys are enrolled, all the files needed for boot ***NEED*** to be signed in
order to run. You can sign the binaries with the sbsign tool, for example:

`
sbsign --key db.key --cert db.crt bzImage --output $ESP/bzImage
`

Example:

Assuming the system has been put in Setup Mode:

`
$ESP/loader/keys/auto/db.esl
$ESP/loader/keys/auto/KEK.esl
$ESP/loader/keys/auto/PK.esl
$ESP/loader/keys/Linux Only/db.esl
$ESP/loader/keys/Linux Only/KEK.esl
$ESP/loader/keys/Linux Only/PK.esl
$ESP/loader/keys/Linux and Windows/db.esl
$ESP/loader/keys/Linux and Windows/KEK.esl
$ESP/loader/keys/Linux and Windows/PK.esl
`

If auto-enroll is set, then the db, KEK and then PK are enrolled from the 'auto'
directory.

If not, three new boot entries are available to the user in order to enroll either the
'Linux Only', 'Linux And Windows' or 'auto' set of keys.

3 years ago"auto" is the default LogTarget of user service manager
Einsler Lee [Tue, 2 Mar 2021 12:24:23 +0000 (20:24 +0800)] 
"auto" is the default LogTarget of user service manager

"auto"  (not console) is the default LogTarget of user service manager.

3 years agomain: reopen /dev/console for user service manager
Einsler Lee [Tue, 2 Mar 2021 12:21:21 +0000 (20:21 +0800)] 
main: reopen /dev/console for user service manager

Now the console_fd of user service manager is 2. Even if LogTarget=console is set in /etc/systemd/user.conf,there is no log in the console.
This reopen the /dev/console, so the log of user service can be output in the console.

3 years agoMerge pull request #24178 from mrc0mmand/libgcc_s
Frantisek Sumsal [Wed, 3 Aug 2022 07:22:19 +0000 (07:22 +0000)] 
Merge pull request #24178 from mrc0mmand/libgcc_s

test: install libgcc_s.so.1 explicitly if available

3 years agosystemctl: clarify that "status" is about the most recent invocation of a service
Lennart Poettering [Tue, 2 Aug 2022 15:27:29 +0000 (17:27 +0200)] 
systemctl: clarify that "status" is about the most recent invocation of a service

And point people to "journalctl --unit=" for information of prior runs.

Inspired by: #24159

3 years agorepart: when keeping ref to backing inode/devnode, use fd_reopen() rathern than F_DUPFD
Lennart Poettering [Tue, 2 Aug 2022 16:16:21 +0000 (18:16 +0200)] 
repart: when keeping ref to backing inode/devnode, use fd_reopen() rathern than F_DUPFD

Via the "backing_fd" variable we intend to pin the backing inode through
our entire code. So far we typically created the fd via F_DUPFD_CLOEXEC,
and thus any BSD lock taken one the original fd is shared with our
backing_fd reference. And if the origina fd is closed but our backing_fd
is not, we'll keep the BSD lock open, even if we then reopen the block
device through the backing_fd. If hit, this results in a deadlock.

Let's fix that by creating the backing_fd via fd_reopen(), so that the
locks are no longer shared, and if the original fd is closed all BSD
locks on it that are in effect are auto-released.

(Note the deadlock is only triggered if multiple operations on the same
backing inode are executed, i.e. factory reset, resize and applying of
partitions.)

Replaces: #24181

3 years agomkosi: Update to latest
Daan De Meyer [Tue, 2 Aug 2022 18:15:02 +0000 (20:15 +0200)] 
mkosi: Update to latest

Fixed centos stream 8 builds that were hitting a nonexisting mirror
url

3 years agoupdate TODO
Lennart Poettering [Tue, 2 Aug 2022 15:09:34 +0000 (17:09 +0200)] 
update TODO

3 years agomountpoint-util: make fd_is_mountpoint() work reasonably with AT_EMPTYPATH
Lennart Poettering [Tue, 2 Aug 2022 11:58:09 +0000 (13:58 +0200)] 
mountpoint-util: make fd_is_mountpoint() work reasonably with AT_EMPTYPATH

Inspired by: https://github.com/systemd/systemd/pull/24141

Calling fd_is_mountpoint() with AT_EMPTYPATH and an empty filename can
only work if we have new statx() available. If we do not, we can still
make things work for directories, but not for other inodes (since there
we cannot query information about the parent inode to compare things.)

Hence, let's handle and test this explicitly, to support this to the
level this is possible.

3 years agoresolved: fix single-label resolution over DNS
Jacek Migacz [Wed, 27 Jul 2022 16:38:12 +0000 (18:38 +0200)] 
resolved: fix single-label resolution over DNS

Fixes: #23494 (when ResolveUnicastSingleLabel=yes)
3 years agotest: be a bit more verbose about shared library symlinks 24178/head
Frantisek Sumsal [Tue, 2 Aug 2022 16:28:43 +0000 (18:28 +0200)] 
test: be a bit more verbose about shared library symlinks

For example:
```
D: Installing /usr/lib64/libz.so.1.2.11
D: Creating symlink /usr/lib64/libz.so.1.2.11 -> /usr/lib64/libz.so.1
D: Creating extra symlink: /lib64/libz.so
D: Installing /usr/lib64/libgcc_s-12-20220507.so.1
D: Creating symlink /usr/lib64/libgcc_s-12-20220507.so.1 -> /usr/lib64/libgcc_s.so.1
```

3 years agotest: install libgcc_s.so.1 explicitly if available
Frantisek Sumsal [Tue, 2 Aug 2022 11:54:57 +0000 (13:54 +0200)] 
test: install libgcc_s.so.1 explicitly if available

Since the library is dlopen()ed by libpthread and required during
pthread_exit()/pthread_cancel(), let's install it explicitly if available to
avoid unexpected fails in tests. This also consolidates all related
workarounds for this library across the test scripts.

3 years agoMerge pull request #24146 from poettering/efi-stub-measure-payload
Luca Boccassi [Tue, 2 Aug 2022 13:42:33 +0000 (14:42 +0100)] 
Merge pull request #24146 from poettering/efi-stub-measure-payload

stub: measure kernel/initrd/parameters into clean PCRs 11/12/13, and add "systemd-measure" tool to be able to pre-calculate values

3 years agoupdate TODO
Lennart Poettering [Tue, 2 Aug 2022 12:01:29 +0000 (14:01 +0200)] 
update TODO

3 years agomkosi: Update to latest commit
Daan De Meyer [Tue, 2 Aug 2022 09:51:40 +0000 (11:51 +0200)] 
mkosi: Update to latest commit

With this update, Arch Linux keyring updates will be automatically
pulled in instead of having to update to a new mkosi commit every
time the keyring gets outdated.

3 years agoupdate TODO 24146/head
Lennart Poettering [Wed, 27 Jul 2022 13:46:42 +0000 (15:46 +0200)] 
update TODO

3 years agotest: add trivial test for systemd-measure
Lennart Poettering [Fri, 29 Jul 2022 16:45:53 +0000 (18:45 +0200)] 
test: add trivial test for systemd-measure

3 years agomeasure: add new tool to precalculate PCR values for a kernel image
Lennart Poettering [Mon, 25 Jul 2022 22:13:16 +0000 (00:13 +0200)] 
measure: add new tool to precalculate PCR values for a kernel image

For now, this simply outputs the PCR hash values expected for a kernel
image, if it's measured like sd-stub would do it.

(Later on, we can extend the tool, to optionally sign these
pre-calculated measurements, in order to implement signed PCR policies
for disk encryption.)

3 years agobootctl: suppress "Boot Loaders Listed in EFI Variables" section header if section...
Lennart Poettering [Thu, 28 Jul 2022 08:48:16 +0000 (10:48 +0200)] 
bootctl: suppress "Boot Loaders Listed in EFI Variables" section header if section empty

Some more cosmetics.

3 years agobootctl: prettify tree output of discovered boot loaders a bit
Lennart Poettering [Wed, 27 Jul 2022 15:23:25 +0000 (17:23 +0200)] 
bootctl: prettify tree output of discovered boot loaders a bit

Previously, the tree output of discovered boot laoders in the ESP would
look like this:

Available Boot Loaders on ESP:
          ESP: /efi (/dev/disk/by-partuuid/0c6f41ed-2573-4723-8c84-23681f9d1c28)
         File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot v250.7-1.fc36)
         File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot v250.7-1.fc36)

With this change the tree branches are corrected to look like this:

Available Boot Loaders on ESP:
          ESP: /efi (/dev/disk/by-partuuid/0c6f41ed-2573-4723-8c84-23681f9d1c28)
         File: ├─/EFI/systemd/systemd-bootx64.efi (systemd-boot v250.7-1.fc36)
               └─/EFI/BOOT/BOOTX64.EFI (systemd-boot v250.7-1.fc36)

Ahhh! So much nicer. This incorrect tree drawing has been bugging me for
so long. Finally I can sleep at night again!

3 years agobootctl: underline sections in status output
Lennart Poettering [Wed, 27 Jul 2022 15:07:12 +0000 (17:07 +0200)] 
bootctl: underline sections in status output

Let's give the output a bit more structure, inspired by the way our
newer --help texts use underlining to separate out sections a bit.

3 years agoboot: add hexdump helper call
Lennart Poettering [Thu, 28 Jul 2022 08:47:05 +0000 (10:47 +0200)] 
boot: add hexdump helper call

This is not actually used (or even supposed to be used) in clean
codepaths, but is tremendously useful when verifying things work
correctly, as a debugging tool.

3 years agoboot: add three new boot loader feature flags
Lennart Poettering [Wed, 27 Jul 2022 14:39:13 +0000 (16:39 +0200)] 
boot: add three new boot loader feature flags

Report whether the devicetree + sort-key boot loader spec type #1
fields are supported, and whether the "@saved" pseudo-entry is
supported.

Strictly speaking, thes features have been added in versions that are
already released (250+), so by adding this those version even though
they support the features will be considered not supporting them, but
that should be OK (the opposite would be a problem though, i.e. if we'd
assume a boot loader had a feature it actually does not).

These three features are features relevant to userspace, as it allows
userspace to tweak/genereate BLS entries or set EFI vars correctly.
Other features (i.e. that have no impliciations to userspace) are not
reported.

3 years agobootctl: show stub feature set in status output
Lennart Poettering [Wed, 27 Jul 2022 13:28:55 +0000 (15:28 +0200)] 
bootctl: show stub feature set in status output

3 years agostub: clean up kernel command line when converting to ASCII
Lennart Poettering [Thu, 28 Jul 2022 15:11:47 +0000 (17:11 +0200)] 
stub: clean up kernel command line when converting to ASCII

Let's be a bit more careful when converting the UTF-16 cmdline to ASCII.
Let's convert all characters out of the printable ASCII range to spaces,
instead of blindly relying on C's downcasting behaviour.

3 years agostub: introduce StubFeatures, similar to LoaderFeatures
Lennart Poettering [Wed, 27 Jul 2022 13:25:59 +0000 (15:25 +0200)] 
stub: introduce StubFeatures, similar to LoaderFeatures

systemd-boot reports its features via the LoaderFeatures EFI variable.
Let's add something similar for stub features, given they have been
growing.

For starters only define four feature flags. One is a baseline feature
we pretty much always supported (see comment in code), two are features
added in one of the most recently released systemd version, and the
final one, is a feature we added a few commits ago.

This is useful for userspace to figure out what is supported and what
not.

3 years agoboot: move unified kernel PE section definitions into 'fundamental' code
Lennart Poettering [Wed, 27 Jul 2022 08:58:29 +0000 (10:58 +0200)] 
boot: move unified kernel PE section definitions into 'fundamental' code

Le's share this code between userspace and uefispace. This is useful
later when pre-measuring expected PCRs from userspace.

3 years agoboot: split out TPM PCR defines into header file we can share between userspace and...
Lennart Poettering [Wed, 27 Jul 2022 08:43:34 +0000 (10:43 +0200)] 
boot: split out TPM PCR defines into header file we can share between userspace and kernel space

3 years agosd-stub: measure sysext images picked up by sd-stub into PCR 13
Lennart Poettering [Tue, 26 Jul 2022 09:35:57 +0000 (11:35 +0200)] 
sd-stub: measure sysext images picked up by sd-stub into PCR 13

Let's grab another so far unused PCR, and measure all sysext images into
it that we load from the ESP. Note that this is possibly partly redundant,
since sysext images should have dm-verity enabled, and that is hooked up
to IMA. However, measuring this explicitly has the benefit that we can
measure filenames too, easily, and that all without need for IMA or
anything like that.

This means: when booting a unified sd-stub kernel through sd-boot we'll
now have:

1. PCR 11: unified kernel image payload (i.e. kernel, initrd, boot
   splash, dtb, osrelease)

2. PCR 12: kernel command line (i.e. the one embedded in the image, plus
   optionally an overriden one) + any credential files picked up by
   sd-stub

3. PCR 13: sysext images picked up by sd-stub

And each of these three PCRs should carry just the above, and start from
zero, thus be pre-calculatable.

Thus, all components and parameters of the OS boot process (i.e.
everything after the boot loader) is now nicely pre-calculable.

NOTE: this actually replaces previous measuring of the syext images into
PCR 4. I added this back in 845707aae23b3129db635604edb95c4048a5922a,
following the train of thought, that sysext images for the initrd should
be measured like the initrd itself they are for, and according to my
thinking that would be a unified kernel which is measured by firmware
into PCR 4 like any other UEFI executables.

However, I think we should depart from that idea. First and foremost
that makes it harder to pre-calculate PCR 4 (since we actually measured
quite incompatible records to the TPM event log), but also I think
there's great value in being able to write policies that bind to the
used sysexts independently of the earlier boot chain (i.e. shim, boot
loader, unified kernel), hence a separate PCR makes more sense.

Strictly speaking, this is a compatibility break, but I think one we can
get away with, simply because the initrd sysext images are currently not
picked up by systemd-sysext yet in the initrd, and because of that we
can be reasonably sure noone uses this yet, and hence relies on the PCR
register used. Hence, let's clean this up before people actually do
start relying on this.

3 years agostub: measure PE sections in a defined order, and include all sections
Lennart Poettering [Mon, 25 Jul 2022 22:13:06 +0000 (00:13 +0200)] 
stub: measure PE sections in a defined order, and include all sections

3 years agoefi: from the stub measure the ELF kernel + built-in initrd and so on into PCR 11
Lennart Poettering [Mon, 25 Jul 2022 15:44:24 +0000 (17:44 +0200)] 
efi: from the stub measure the ELF kernel + built-in initrd and so on into PCR 11

Here we grab a new – on Linux so far unused (by my Googling skills, that
is) – and measure all static components of the PE kernel image into.
This is useful since for the first time we'll have a PCR that contains
only a PCR of the booted kernel, nothing else. That allows putting
together TPM policies that bind to a specific kernel (+ builtin initrd),
without having to have booted that kernel first. PCRs can be
pre-calculated. Yay!

You might wonder, why we measure just the discovered PE sections we are
about to use, instead of the whole PE image. That's because of the next
step I have in mind: PE images should also be able to carry an
additional section that contains a signature for its own expected,
pre-calculated PCR values. This signature data should then be passed
into the booted kernel and can be used there in TPM policies. Benefit:
TPM policies can now be bound to *signatures* of PCRs, instead of the
raw hash values themselves. This makes update management a *lot* easier,
as policies don't need to be updated whenever a kernel is updated, as
long as the signature is available. Now, if the PCR signature is
embedded in the kernel PE image it cannot be of a PCR hash of the kernel
PE image itself, because that would be a chicken-and-egg problem. Hence,
by only measuring the relavent payload sections (and that means
excluding the future section that will contain the PCR hash signature)
we avoid this problem, naturally.

3 years agoefi: tell userspace where the stub measured the kernel command line/credentials into
Lennart Poettering [Tue, 26 Jul 2022 16:32:21 +0000 (18:32 +0200)] 
efi: tell userspace where the stub measured the kernel command line/credentials into

This is useful for userspace to know, so that policies can be put
together safely, matching what the stub actually measured.

3 years agoefi: optionally report when measuring to TPM whether we actually did
Lennart Poettering [Mon, 25 Jul 2022 15:35:16 +0000 (17:35 +0200)] 
efi: optionally report when measuring to TPM whether we actually did

the measurement calls can succeed either when they actually measured
something, or when they skipped measurement because the local system
didn't support TPMs.

Let's optionally return a boolean saying which case it is. This is later
useful to tell userspace how and if we measured something.

3 years agoupdate TODO
Lennart Poettering [Tue, 2 Aug 2022 08:28:15 +0000 (10:28 +0200)] 
update TODO

3 years agoMerge pull request #24174 from yuwata/network-link-local-address
Yu Watanabe [Tue, 2 Aug 2022 03:56:01 +0000 (12:56 +0900)] 
Merge pull request #24174 from yuwata/network-link-local-address

network: fix link local address handling