1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

66388 Commits

Author SHA1 Message Date
Franck Bui
f1f331a252 sleep: don't init /sys/power/resume if 'resume=' option is missing and EFI is disabled
Otherwise in such case a first `systemctl hibernate` would fail but would still
initialize /sys/power/resume fooling a second `systemctl hibernate` into
believing that 'resume=' is correctly set and can be used by the resume process
to find the swap device to resume from.

Follow-up for #27330.
2023-07-27 12:30:40 +01:00
Frantisek Sumsal
8f766afe98 network: don't log non-negative errno
Otherwise bad things happen:

systemd-networkd[3140]: wlan0: Saved new link: ifindex=5, iftype=ETHER(1), kind=n/a
systemd-networkd[3140]: Assertion '(_error) != 0' failed at src/network/networkd-wifi.c:119, function manager_genl_process_nl80211_config(). Aborting.

Resolves: #28534
2023-07-27 12:29:05 +01:00
Erik Sjölund
6870daff03 man: fix typos 2023-07-27 09:54:43 +01:00
Luca Boccassi
0199f203cb mkosi: install sd-boot on opensuse in base image
Workaround for CI issue, the sd-stub we build is overwritten in the final
image as the package gets pulled there, install it in the base to
work around it for now
2023-07-26 22:02:58 +01:00
Yu Watanabe
bb2e3c90fc missing: include linux/types.h for __s64 and __u64
Fixes #28529.
2023-07-26 21:39:56 +01:00
Luca Boccassi
eff91e2f38 efi: link with -z nopack-relative-relocs
elf2efi.py cannot handle DT_RELR relocations, so disable it
if we can

Fixes https://github.com/systemd/systemd/issues/28520
2023-07-26 18:47:53 +01:00
Yu Watanabe
03de154a1e test-fstab-generator: add more tests for systemd.mount-extra= and friends 2023-07-27 00:50:15 +09:00
Yu Watanabe
aeded6b0b5 test-fstab-generator: also test with SYSTEMD_IN_INITRD=no 2023-07-27 00:50:15 +09:00
Yu Watanabe
7f8c67c996 test-fstab-generator: extract core part as a function
No functional change, preparation for later commits.
2023-07-27 00:50:15 +09:00
Yu Watanabe
22f5a825e4 fstab-generator: add a flag to accept entry for "/" in initrd
When both prefix_sysroot and accept_root is true, the entry for "/" will
be accepted and converted to "/sysroot/".

Why? If the entry is read from the main system's fstab, then we already
mounted /sysroot/, hence it is not and should not re-add the .mount unit
for /sysroot/. However, if we want to specify the root mount through the
kernel command line or credential, without this change, we need to
specify the same entry in the two options. E.g.
===
systemd.mount-extra=/dev/sda1:/:auto:defaults
rd.systemd.mount-extra=/dev/sda1:/sysroot:auto:defaults
===
That's inconvenient. Of course, we can dedup that by using traditional
options, but cannot when defined in credential.
2023-07-27 00:50:15 +09:00
Yu Watanabe
dfd10549ac fstab-generator: read both credentials in initrd
This makes the behavior consistent with the way we already do for
fstab and command line options.
In initrd, entries read from fstab.extra are mounted under /sysroot.
2023-07-27 00:50:15 +09:00
Yu Watanabe
45c535ddb0 fstab-generator: add rd.systemd.mount-extra= and friends
Previously, mounts specified in systemd.mount-extra= are equally handled
both in initrd and the main system. So, the mounts for the main system
are also mounted in initrd.

This introduces rd.systemd.mount-extra=, which specifies mounts in initrd.
Then, mounts specified in systemd.mount-extra= are still mounted both in
initrd and the main system, but prefixed with /sysroot/ when running in
initrd.

Fixes #28516.
2023-07-27 00:50:01 +09:00
Yu Watanabe
b93d9e06fc fstab-generator: fix target of /sysroot/usr
If /usr mount is picked from the main system's fstab file (prefix_sysroot
is true, and the path is prefixed as /sysroot/usr), then previously it
was installed in the wrong target unit.
2023-07-26 23:59:56 +09:00
Jan Janssen
bc32a9fdfd boot: Fall back to using image load address for stack guard
If we cannot get random data from the RNG protocol we can still use our
load address to make the stack guard a little less static.
2023-07-26 15:11:08 +02:00
Luca Boccassi
4cf5b343c9 mkosi: add drop-in to make emergency.service shut down the system
When the mkosi CI fails to boot, it just sits there waiting at the emergency
console until the job times out. Add a drop-in for emergency.service in the
CI configuration so that instead it exists immediately.
2023-07-26 14:07:13 +01:00
Zbigniew Jędrzejewski-Szmek
99aa03c3af
Merge pull request #28511 from YHNdnzj/gpt-auto-no-duplicate
gpt-auto: skip mounting ESP if fstab for /boot/ uses the same device as discovered one
2023-07-26 14:34:08 +02:00
Mike Yuan
69d7f35ce4
gpt-auto: skip mounting ESP if fstab for /boot/ uses the same device as discovered one
Follow-up for 6a488fa7cc

Currently, if an fstab entry for /boot/ exists, we'll skip to try /efi/
instead. However, if it's already using the same device as the discovered
one, we should not duplicate the mount.
2023-07-26 15:00:06 +08:00
Mike Yuan
99299d0d5a
fstab-util: add fstab_is_mount_point_full which takes a source path to compare 2023-07-26 15:00:06 +08:00
Luca Boccassi
859ecf0aaa pam: lower warning about closing sd-bus after fork
There is some issue in our code that triggers this warning constantly,
but it's nothing users can solve, so downgrade to debug level until
we can figure out the original issue (which is a permission denied
error on ReleaseSession D-Bus method call).

Related to https://github.com/systemd/systemd/issues/28514
2023-07-26 10:07:06 +09:00
Yu Watanabe
8f88e57397 fstab-generator: rename 'initrd' flag to 'prefix_sysroot'
The name 'initrd' is confusing with 'in_initrd()'.
2023-07-26 05:08:01 +09:00
Yu Watanabe
6636b2b6bf udev: set ID_PATH properties for all pci, usb, and platform devices
Before c43ff248f9, the following line in
60-drm.rules also sets ID_PATH for all pci, usb, and platform devices:
===
ACTION!="remove", SUBSYSTEM=="drm", SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id"
===
Unfortunately, some existing rules rely on the unexpected behavior.
To keep the backward compatibility, let's set ID_PATH for them.

Fixes #28411.
2023-07-25 17:56:59 +01:00
Yu Watanabe
62843efc8f NEWS: fix typo 2023-07-25 15:50:29 +09:00
Luca Boccassi
5a945fab7a ukify: fix armv7 architecture mapping
$ uname -m
armv7l

Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/kernel-install/60-ukify.install", line 223, in <module>
    main()
  File "/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/kernel-install/60-ukify.install", line 219, in main
    call_ukify(opts)
  File "/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/kernel-install/60-ukify.install", line 205, in call_ukify
    ukify['finalize_options'](opts2)
  File "/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/ukify", line 1423, in finalize_options
    opts.efi_arch = guess_efi_arch()
                    ^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/ukify", line 78, in guess_efi_arch
    raise ValueError(f'Unsupported architecture {arch}')
ValueError: Unsupported architecture armv7l
2023-07-24 21:10:48 +02:00
Frantisek Sumsal
283f3bd588 shell-completion: include units in 'verify' completions
Resolves: #28500
2023-07-24 20:02:55 +01:00
Luca Boccassi
b9e39e11e2
Merge pull request #28505 from bluca/vconsole_debian
vconsole-setup: don't fail with an empty keymap
2023-07-24 18:02:32 +01:00
Luca Boccassi
febbc24ee0 mkosi: set default-keymap='' on Debian/Ubuntu 2023-07-24 15:43:16 +01:00
Luca Boccassi
1cd4211068 vconsole-setup: don't fail with an empty keymap
The new meson option 'default-keymap' means that by default there's always
a keymap to configure, so vconsole-setup fails. Allow to set
-Ddefault-keymap="" to disable it and skip gracefully again.

Follow-up for f129d0e77c
2023-07-24 15:43:11 +01:00
Luca Boccassi
739bbc5869 NEWS: update for rc3 2023-07-24 12:47:28 +01:00
Zbigniew Jędrzejewski-Szmek
779268d202
Merge pull request #28503 from bluca/rc
RC busywork
2023-07-24 13:42:17 +02:00
Luca Boccassi
0b5e5e4cb4 NEWS: update contributors list 2023-07-24 11:46:33 +01:00
Luca Boccassi
f07775a2a0 hwdb: run update-hwdb
git diff hwdb.d/*.hwdb looks sensible
2023-07-24 11:42:23 +01:00
Luca Boccassi
291c66914f
Merge pull request #28498 from bluca/softreboot
softreboot: ensure all processes are killed
2023-07-24 11:36:16 +01:00
Luca Boccassi
2bfe7261de
Merge pull request #28497 from bluca/run
switch-root: use MS_REC for /run, unless we are soft-rebooting
2023-07-24 11:20:06 +01:00
Luca Boccassi
7f0bf48d31 Update NEWS 2023-07-24 10:45:28 +01:00
Luca Boccassi
b41ab9b3f4 softreboot: ensure all processes are killed
Having surviving processes is not ready yet as a feature, so ensure
everything is killed on the transition for now
2023-07-24 10:45:28 +01:00
Frantisek Sumsal
8256994c63 test: check if we correctly propagate /run mounts during switch root
Since 7c764d4 we bind mount certain directories during switch root
instead of moving the mount directly, and for /run we do this without
MS_REC. This, unfortunately, leaves all mounts under /run behind
in the old root, which breaks certain use cases.

See: https://github.com/systemd/systemd/issues/28452
2023-07-24 10:39:14 +01:00
Luca Boccassi
b12d41a8bb switch-root: use MS_REC for /run, unless we are soft-rebooting
There are applications that rely on mounts under /run surviving the
switch from initrd to rootfs, so use MS_REC unless we are soft
rebooting.

Follow-up for 7c764d4599

Fixes https://github.com/systemd/systemd/issues/28452
2023-07-24 10:39:14 +01:00
Luca Boccassi
3835b9aa4b Revert "core: add IgnoreOnSoftReboot= unit option"
The feature is not ready, postpone it

This reverts commit b80fc61e89.
2023-07-22 23:27:27 +01:00
Yu Watanabe
16bfb12c8f Revert "network: delay to configure address until it is removed on reconfigure"
This reverts commit 6e8477edd3.

The commit intended to fix a race reported at #28009. However,
unfortunately, it does not fix the root of the race, and reveals
the race in more simple setups. See reports in #28358.
2023-07-22 23:03:57 +01:00
Daniel Rusek
acfff02c8f po: Translated using Weblate (Czech)
Currently translated at 93.3% (212 of 227 strings)

Co-authored-by: Daniel Rusek <mail@asciiwolf.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/cs/
Translation: systemd/main
2023-07-22 18:43:25 +01:00
Dan Streetman
63477a71df tpm2: instead of adjusting authValue trailing 0(s), trim them as required by tpm spec
To keep compatibility with any existing object authValues with trailing 0's,
change tpm2_get_pin_auth() to trim trailing 0's, which is what the TPM
implementation will do. This should retain compatibility with any existing
authValues that contain trailing 0's.

Note that any existing authValues with trailing 0's are unlikely to have worked
in the way that systemd uses them in object sealing, which is as a bind key for
the encryption (and policy) session. However, it is better to be compatible
with the TPM spec (and implementations) even if previously created objects that
are affected may not have worked.

Fixes: #28414
2023-07-21 23:10:03 +01:00
Luca Boccassi
73d6f20155
Merge pull request #28487 from yuwata/statx-fixlets
util: fix error handling of statx()
2023-07-21 23:09:40 +01:00
Dan Streetman
adb7fe82c7 Revert "cryptenroll: drop unmet condition"
This reverts commit cefa4a02ab.

Because the first 'break' is inside a nested for loop, this second 'break' is
needed to exit the outer for loop.

Fixes: #28451
2023-07-21 18:59:26 +01:00
Luca Boccassi
686b983040
Merge pull request #26541 from DaanDeMeyer/xfs-whitespace-fix
mkfs-util: Escape spaces with slashes in protofile format
2023-07-21 18:58:27 +01:00
Yu Watanabe
68a4fc8b53 fd-util: do not call statx() twice when it does not provide mount ID
Previously, in path_is_root_at(), if statx() does not provide mount ID,
path_get_mnt_id_at() was called, but it also calls statx(). Let's avoid
the second trial.
2023-07-22 02:22:06 +09:00
Yu Watanabe
bd96111d5f fd-util: make path_is_root_at() not fail even when /proc is mounted
path_get_mnt_id_at() -> fd_fdinfo_mnt_id() may return -EOPNOTSUPP when
/proc is mounted, and -ENOSYS otherwise, when an old kernel is used.
2023-07-22 02:20:27 +09:00
Yu Watanabe
7487115766 mountpoint-util: statx() may return EINVAL if the kernel does not support the syscall
When statx() is called with AT_STATX_DONT_SYNC, glibc's fallback code
returns EINVAL. See statx_generic() in glibc.
2023-07-22 02:20:22 +09:00
Yu Watanabe
d35ff4b60e stat-util: fix error handling of statx()
When newer glibc is used, but kernel does not support statx(), then
glibc try to fallback with fstatat(). That's quite similar to our
implementation, but the supported flags are different, and if
unsupported flags are specified, it returns EINVAL.

Let's handle the case more gracefully.
2023-07-22 02:14:54 +09:00
Zbigniew Jędrzejewski-Szmek
671903b315
Merge pull request #28436 from rpigott/zsh-fixups
zsh systemctl completion fixups
2023-07-21 19:13:53 +02:00
Luca Boccassi
b80fc61e89 core: add IgnoreOnSoftReboot= unit option
As it says on the tin, configures the unit to survive a soft reboot.
Currently all the following options have to be set by hand:

Conflicts=reboot.target kexec.target poweroff.target halt.target
Before=reboot.target kexec.target poweroff.target halt.target
After=sysinit.target basic.target
DefaultDependencies=no
IgnoreOnIsolate=yes

This is not very user friendly. If new default dependencies are added,
or new shutdown/reboot types, they also have to be added manually.

The new option is much simpler, easy to find, and does the right thing
by default.
2023-07-21 18:05:41 +02:00