1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-08 21:17:47 +03:00
Commit Graph

58373 Commits

Author SHA1 Message Date
Yu Watanabe
bf13ffec59 udev: drop assertion which is always false
Fixes a bug introduced by 67c3e1f63a.

Fixes #24945.

(cherry picked from commit 6209bbbd4b)
2022-10-13 22:54:00 +02:00
anarcat
78a8e938e4 man/shutdown: document how to switch to single-user mode
Before Debian switched to systemd, `shutdown now` would reset the system into
single user mode, doing roughly the equivalent of `telinit 1`.

Now, systemd's `shutdown` command does not behave that way; it defaults to
`poweroff` which might be confusing for users (like me) used to the previous
method.

Because I don't use the command often, I keep being stumped by this behavior,
and every time I look at the `shutdown(1)` manpage, I don't understand why I
can't find what I am looking for. This patch should make sure that people like
me find their way back to some sort of reason.

Maybe the *proper* way to fix this would be to restore the more classic
behavior, but I'm definitely not going to climb that hill. Besides, I clearly
remember the time I found out about the `shutdown` command and was *really*
confused when it brought me back to a command-line prompt. That was really
counter-intuitive and I find that change to actually be a good thing. So I'm
not proposing to change this behavior, merely document it better.

I originally added this to the `-P` option but it was suggested adding a new
`COMPATIBILITY` section instead, where other such issues could be added.

The `COMPATIBILITY` section is not actually officially documented. `man(1)`
talks about a `CONFORMING TO` section, but `shutdown(1)` is not
POSIX (`shutdown(2)` is, of course), so there's no actual standard on how this
should work.

The other option I considered was to add a `BUGS` section, but that seemed to
inflammatory, and definitely counter-productive.

(cherry picked from commit 9aafd310cc)
2022-10-13 22:53:23 +02:00
Dominique Martinet
9de8a5d5d0 libbpf: add compat helpers for libbpf down to 0.1.0
- new symbols are available from libbpf 0.6.0 so could be used with
libbpf.so.0, but we're sure the old symbols will be there and this
simplifies code
- detection at runtime should always work, regardless of whether systemd
has been compiled with older or newer libbpf and runs with older or newer
libbpf

(cherry picked from commit 87e462f713)
2022-10-13 22:52:51 +02:00
Daan De Meyer
9d5d267ab3 Try to load libbpf.so.1 as well
libbpf had a soname bump. Our usage of libbpf is compatible with
both libbpf.so.0 and libbpf.so.1, so let's try to load from both.

(cherry picked from commit 5a967e2887)
2022-10-13 22:52:05 +02:00
Daan De Meyer
8cc2387b03 libbpf: Remove use of deprecated APIs
(cherry picked from commit 6b8085db68)
2022-10-13 22:51:59 +02:00
Arnaud Ferraris
4abc5b2cfe repart: always honour --discard=no
Currently, even if `--discard=no` is passed to `systemd-repart`, the
`context_discard_gap_after()` function still runs normally, discarding
e.g. all blocks between the GPT and the start of the first partition.

This can lead to issues on some embedded devices, where this space
holds the bootloader and shouldn't be modified (creating a protective
partition there is not always possible due to the specifics of the boot
process of some ARM-based SoC's).

This commit ensures passing `--discard=no` would be enough to ensure
the bootloader isn't wiped in such cases.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@gmail.com>
(cherry picked from commit 5113436b05)
2022-10-13 22:49:22 +02:00
Aleksey Vasenev
b3d5724bfc ata_id: Fixed getting Response Code from SCSI Sense Data (#24921)
The Response Code is contained in the first byte of the SCSI Sense Data.
Bit number 7 is reserved or has a different meaning for some Response Codes
and is set to 1 for some drives.

(cherry picked from commit 2be1ae54ba)
2022-10-13 22:49:08 +02:00
Jacek Migacz
e91ea65aba resolve: unsupported DNSSEC algorithms are considered INSECURE; not BOGUS
Resolves: #19824
(cherry picked from commit 1ca3600120)
2022-10-13 22:42:25 +02:00
Jonas Kümmerlin
73db7d9932 generator: skip fsck if fsck command is missing
This is useful for systems which don't have any fsck.

We already skip emitting the fsck dependency when the fsck.$fstype helper
is missing, but fstab-generator doesn't necessarily know the fstype when
handling the root= parameter.

Previously, systemd-fsck was started for these mounts and then exited
immediately because it couldn't find the fsck.$fstype helper.

(cherry picked from commit 1355672437)
2022-10-13 22:40:47 +02:00
Yu Watanabe
80dc4425db udevadm: do not try to find device unit when a path like string is provided
Otherwise, we provide misleading error message.
Before:
---
$ udevadm info /sys/class/foo
Bad argument "/sys/class/foo", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument
---
After:
---
$ udevadm info /sys/class/foo
Unknown device "/sys/class/foo": No such device
---

(cherry picked from commit 4273a041f1)
2022-10-13 22:37:23 +02:00
Lennart Poettering
7add2f21f1 resolved: don't access sshfp fields from tlsa printer
(cherry picked from commit 411d095d79)
2022-10-13 22:36:35 +02:00
Lennart Poettering
9d9a970ad7 resolved: fix parameter reuse in DNS_ANSWER_FOREACH_ITEM() iterator macro
(cherry picked from commit 63fe457c1b)
2022-10-13 22:36:11 +02:00
Yu Watanabe
913d22cf8d kernel-install: do not fail if $layout is not "bls"
Fixes #24836.

(cherry picked from commit 46f347ada3)
2022-10-13 22:34:53 +02:00
Topi Miettinen
25facc6e7f units: udev: partially emulate ProtectClock=
Drop CAP_SYS_TIME and CAP_WAKE_ALARM capabilities and block clock-related
system calls. Update TODO.

(cherry picked from commit 75723d31a6)
2022-10-13 22:32:55 +02:00
Lennart Poettering
2e6e0498aa nspawn: fix two error strings
(cherry picked from commit c941b65075)
2022-10-13 22:15:33 +02:00
David Edmundson
5befffa69a xdg-autostart-service: expand tilde in Exec lines
In typical desktop file parsing it is expected that "~" expands to a
home directory.

Users may write an autostart file with "Exec=myCoolService
~/.someSpecialConfig" which worked before the systemd migration.

(cherry picked from commit 8c0a6a96fe)
2022-10-13 22:14:17 +02:00
j00512545
4cb75191c4 fix typo in log
(cherry picked from commit 365c2885f0)
2022-10-13 22:13:06 +02:00
Heinrich Schuchardt
738eca5e05 meson: add libatomic dependency
Building with GCC 12.2 and binutils 2.39 fails on riscv64 Ubuntu Kinetic
with:

FAILED: systemd-oomd
/usr/bin/ld: systemd-oomd.p/src_oom_oomd-util.c.o:
in function `oomd_cgroup_context_acquire':
build/../src/oom/oomd-util.c:415:
undefined reference to `__atomic_exchange_1'

We have to link with -latomic.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
(cherry picked from commit 132c73b57a)
2022-10-13 22:12:45 +02:00
David Edmundson
c40fa78968 xdg-autostart-service: Use common boolean parser
Technically the desktop entry specification says value should be the
string "true" or "false". Pragmatically every desktop has their own
parsing rules which are typically less strict on how to interpret other
values.

This caused some regressions downstream when we switched to the
xdg-autostart-generator where existing handmade files contained values
with "True" or "False".

(cherry picked from commit 38429cb1e3)
2022-10-13 22:04:08 +02:00
Ansgar Burchardt
654ae8c1e4 base-filesystem.c: add trailing zero byte for s390x entry
(cherry picked from commit 4167e2135e)
2022-10-01 19:05:55 +02:00
Guillaume W. Bres
e4a19eef33 basic/missing_loop.h: fix missing lo_flags LO_FLAGS_DIRECT_IO
(cherry picked from commit b3fe33ff52)
2022-10-01 19:05:55 +02:00
Yu Watanabe
24238be484 mount-util: fix error code
If multiple service is starting simultaneously with a shared image,
then one of the service may fail to create a mount node:

systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[695]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[696]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Failed to create destination mount point node '/run/systemd/unit-root/run/host/os-release': Operation not permitted
systemd[695]: Successfully mounted /usr/lib/os-release to /run/systemd/unit-root/run/host/os-release

The function apply_one_mount() in src/core/namespace.c gracefully
handles -EEXIST from make_mount_point_inode_from_path(), but it erroneously
returned -EPERM previously. This fixes the issue.

Fixes one of the issues in #24147, especially reported at
https://github.com/systemd/systemd/issues/24147#issuecomment-1236194671.

(cherry picked from commit b6ca2b281e)
2022-10-01 19:05:54 +02:00
Yu Watanabe
1b1ad8c79f udev: certainly restart event for previously locked device
If udevd receives a uevent for a locked block device, then the event
is requeued. However, the queued event will be processed only when at
least one sd_event_source is processed. Hence, if udevd has no event
under processing, or receives no new uevent, etc., then the requeued
event will be never processed.

Follow-up for 400e3d21f8.

Fixes #24439.

(cherry picked from commit 4f294ffdf1)
2022-10-01 19:05:54 +02:00
Jan Janssen
7dacfb3fb4 stub: Use EfiLoaderCode for kernel memory
Fixes: #24237
(cherry picked from commit 79a7ef89aa)
2022-10-01 19:05:54 +02:00
Yu Watanabe
eaeaf4f6ef network: do not silently stop to process configuration on activation failure
Previously, if activation failed, link did not enter the failed state,
but still Link.activated flag not set. Hence, nothing processed even if
the interface is manually brought up later.

Partially fixes #23649.

(cherry picked from commit b05e52000b)
2022-10-01 19:05:54 +02:00
David Rheinsberg
bb803856bc 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.

(cherry picked from commit 347f48246f)
2022-10-01 19:05:54 +02:00
igo95862
6349062326 Fix ObjectManager interface emitted for non-manager objects
(cherry picked from commit b283d50240)
2022-10-01 19:05:54 +02:00
igo95862
c90ab07fa0 test-bus-objects: Test interfaces added/removed signal interfaces
`org.freedesktop.DBus.ObjectManager` should only be emitted if
object in question has ObjectManager attached.

(cherry picked from commit 19b581466a)
2022-10-01 19:05:54 +02:00
igo95862
e32fe1b457 Fix GetManagedObjects returning ObjectManager interface for non-manager objects
(cherry picked from commit 2ccd0828fc)
2022-10-01 19:05:54 +02:00
igo95862
efd8e39f4a test-bus-objects: Test GetManagedObjects interfaces are correct
Objects without ObjectManager should not have
`org.freedesktop.DBus.ObjectManager` interface.

Object with ObjectManager should do.

Also added ASSERT_SE_NONNEG and ASSERT_NONNEG macros.

(cherry picked from commit 724e13b346)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
344efd022a coredump: when parsing json, optionally copy the string first
(cherry picked from commit 87707784c7)
2022-10-01 19:05:54 +02:00
Christian Hesse
de08edca17 systemctl: color ignored exit status in yellow, not red
If the executable path is prefixed with "-", an exit code of the command
normally considered a failure (i.e. non-zero exit status or abnormal exit
due to signal) is recorded, but has no further effect and is considered
equivalent to success.

Let's honor this with `systemctl status`, and color ignored exit status
in yellow, not red.

(cherry picked from commit e879434df5)
2022-10-01 19:05:54 +02:00
Lennart Poettering
1531a496e3 manager: make clear internal Dump() logic is debugging only.
(cherry picked from commit acf2de5217)
2022-10-01 19:05:54 +02:00
Lennart Poettering
c4fd38f7d2 man: document the Dump() calls of the PID 1 D-Bus interface, and what they are
(cherry picked from commit 0df8512124)
2022-10-01 19:05:54 +02:00
Yu Watanabe
140fee4627 resolve: do not cache mDNS goodbye packet
Fixes #24842.

(cherry picked from commit a78049fc0e)
2022-10-01 19:05:54 +02:00
Adam Williamson
1a2d93a770 kbd-model-map: correct variants for cz-qwerty to include comma
As explained by @poncovka , the 'xvariant' string should contain
the same number of comma-separated elements as 'xlayout'. When
we have two layouts we need two items in xvariant, in this case
one of them is empty.

See https://github.com/rhinstaller/anaconda/pull/4355#pullrequestreview-1119913870
for @poncovka's full explanation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit 950aeeb8ff)
2022-10-01 19:05:54 +02:00
msizanoen1
9d1ebb2247 resolve: persist DNSOverTLS configuration in state file
Currently, NetworkManager will set DNSOverTLS according to its
`connection.dnsovertls` configuration only once during connection,
instead of every single restart of systemd-resolved, causing resolved to
lose the configuration on restart.

Fix this by persisting DNSOverTLS in the runtime state file, which will
also make it more consistent with other interface-specific settings.

(cherry picked from commit b49e029a99)
2022-10-01 19:05:54 +02:00
Yu Watanabe
3137ac6ef5 udev: support by-path devlink for multipath nvme block devices
If multipath feature is enabled, nvme block devices may belong to the
"nvme-subsystem" subsystem, instead of "nvme" subsystem.
(What a confusing name...)

Then, the syspath is something like the following,
    /sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
Hence, we need to find the 'real parent' device, such as
    /sys/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2031810.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2124964.
Replaces #24748.

(cherry picked from commit 67c3e1f63a)
2022-10-01 19:05:54 +02:00
Lennart Poettering
c948091cc5 run: make --working-directory= work for --scope too
This sounds like a more user-friendly alternative to #24780

(cherry picked from commit fecc447766)
2022-10-01 19:05:54 +02:00
Adam Williamson
7bb204620d kbd-model-map: add a mapping for switched czech qwerty/us
See https://bugzilla.redhat.com/show_bug.cgi?id=2121106 for the
background on this. One of Fedora's QA folks ran an install
and chose two keyboard layouts: Czech (qwerty) and US. Due to
the sad details of how the whole logic flow for trying to decide
what kbd layout best matches a given xkb config works (see
details in the bug comments), we wound up deciding the best-
matching kbd layout for this situation was cz-us-qwertz, which
is a czech/us switched layout, but is qwertz, not qwerty. This
seems like a poor outcome. Adding this line should result in us
picking cz-qwerty in this case. Which may be the 'legacy'
cz-qwerty.map from upstream kbd project (which is switched
cz/us), or may be the auto-converted xkb layout (which obviously
isn't switched). But either way, at least its primary mode is
Czech qwerty, which seems like a *better* choice than a layout
whose primary mode is Czech qwertz.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit 97f9950698)
2022-10-01 19:05:54 +02:00
Yu Watanabe
e5157050d1 test: add more test cases for mkdir_p_safe() and mkdir_p_root()
(cherry picked from commit f8d5048dbf)
2022-10-01 19:05:54 +02:00
Yu Watanabe
b3a9f7b5cb mkdir: chase_symlinks_and_stat() does not return 0
This reverts commits e22916e61d and
1e146d7382.

(cherry picked from commit f1d93b84bc)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
0bfdc91807 units: make sure that initrd-switch-root.service pulls in .target
Normally we queue initrd-switch-root.target/isolate, which pulls in the
service via Wants= in the .target unit file. But if the service is instead
started directly, there may be nothing pulling in the target. Let's make
sure that the reference exists.

(cherry picked from commit 5b5ec138c6)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
45fb64c54b units: add dependency ordering for emergency.service conflicts
If we want to stop those services which would compete for access to
the console, we need to have an ordering so that they are actually
stopped before the other things starts, not asynchronously.

(cherry picked from commit 3449814b8b)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
6535813084 units: add ordering dependencies on initrd-switch-root.target
For shutdown, we queue shutdown.target/start, so in every unit which should be
stopped *before* shutdown, we need both Conflicts and an ordering dependency
with shutdown.target (either Before= or After= would work, because stop jobs
are always ordered before start jobs).

For initrd transition, we queue initrd-switch-root.service/isolate. This
automatically creates a /stop job for every running unit without
IgnoreOnIsolate. But no ordering dependency is created, unless the unit has a
(possibly transitive) ordering dependency on initrd-switch-root.service.
Since most units must stop before the transition, we should add the ordering
dependency. It is nicer to use Before=initrd-switch-root.target for this.
initrd-switch-root.target is ordered before initrd-switch-root.service, so
the effect it the same when both are in a transaction.

Fixes #23745.

To also cover the case where somebody is emergency mode in the initrd and
queues initrd-switch-root.service/start (not isolate), also add
Conflicts=initrd-switch-root.target, so various units are stopped properly.
This extends 2525682565 to cover all the other
services that are touched. It could be consider "operator error", but it's
easy to make and it's nicer if we can make this more foolproof.

(cherry picked from commit 7c0e2b5559)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
09c90224f1 units/systemd-network-generator.service: add forgotten ordering for shutdown
(cherry picked from commit d5fd07cdee)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
1dd723a3b8 units: reorder/split unit dependency blocks
The block is reordered and split to have:
  1. description + documentation
  2. (optionally) conditions
  3. all the dependencies
I think it's easier to read the units this way.
Also, the Conflicts+Before is seperated out to separate lines.
The ordering dependency is "fake", because it could just as well be
After=, we are adding it to force ordering wrt. shutdown.target, and
it plays a different role than the other Before=, which are about a
real ordering on boot.

(cherry picked from commit 9810e41942)
2022-10-01 19:05:54 +02:00
Yu Watanabe
054cad0097 man: explicitly document that "reboot -f" is different from "systemctl reboot -f"
Closes #24696.

(cherry picked from commit cb19517490)
2022-10-01 19:05:54 +02:00
Yu Watanabe
c5b0ae86b1 watchdog: use /dev/watchdog0 only if it exists
Fixes #24661.

(cherry picked from commit a6b7ebaafa)
2022-10-01 19:05:54 +02:00
Daniel Braunwarth
ac805eac15 journalctl: respect --quiet flag during file concistency verification
Fixes #24563.

(cherry picked from commit 43deb1a8dc)
2022-10-01 19:05:54 +02:00