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

58411 Commits

Author SHA1 Message Date
Frantisek Sumsal
7b6fa1d3e6 test: add a couple of sanity tests for journalctl
(cherry picked from commit ca46781c5f)
(cherry picked from commit 0508cd3b00)
2022-11-08 00:09:18 +01:00
Yu Watanabe
cf21555d6d sd-device-monitor: dynamically allocate receive buffer
If udevd broadcasts a processed device with huge amount of properties,
then clients cannot receive the device.

Fixes #24987.

(cherry picked from commit efbd4b3ca8)
2022-11-03 17:10:52 +01:00
Frantisek Sumsal
ee42e84968 man: use the correct 'Markers' property name for marking units
Follow-up to c9615f7352 and 70666e28a1.

(cherry picked from commit 1ca1bb03de)
2022-11-03 17:10:52 +01:00
Yu Watanabe
45090f3418 core: fix memleak in GetUnitFileLinks method
(cherry picked from commit a12ba535fa)
2022-11-03 17:10:52 +01:00
Yu Watanabe
7eefd2fbb7 network: forcibly reconfigure all interfaces after sleep
Previously, interfaces are partially reconfigured in a spurious way.
Let's use the same way as `networkctl reconfigure`.

Hopefully fixes #14987 and #24997.

(cherry picked from commit a39a9ac806)
2022-11-03 16:56:27 +01:00
Youfu Zhang
66fa6110ba resolved: fix typo in feature level table
(cherry picked from commit 2ab0042854)
2022-11-03 16:54:28 +01:00
Yu Watanabe
2f8f1d9e4a network: skip to reassign master ifindex if already set
Otherwise, the slave interface may go down, especially when the master
is bond.

Fixes #25067.

(cherry picked from commit 9f913d37a0)
2022-11-03 16:52:59 +01:00
Lennart Poettering
d94f197818 resolved: fix copypasta in resolved varlink API
As reported by @holtmann

(cherry picked from commit 6032283b2f)
2022-11-03 16:51:31 +01:00
Yu Watanabe
b61fcaca1b udev: always create device symlinks for USB disks
Previously, ata_id might not be able to retrieve attributes correctly,
and properties from usb_id were used as a fallback. See issue #24921
and PR #24923. To keep backward compatibility, still we need to create
symlinks based on USB serial.

Fixes #25179.

(cherry picked from commit 479da1107a)
2022-11-03 16:50:50 +01:00
Steve Ramage
6fc2f387af man: Add documentation for AssertCredential= (#25178)
Fixes #25177.

Co-authored-by: Steve Ramage <gitcommits@sjrx.net>
(cherry picked from commit 1d87f03a6e)
2022-11-03 16:49:37 +01:00
Nick Rosbrook
c339e8d71b man: document reboot --poweroff exception
When reboot is invoked, the -p/--poweroff option is intentionally
ignored. Update the man page to reflect this exception.

(cherry picked from commit 6dfaeac370)
2022-11-03 16:49:16 +01:00
Yu Watanabe
91b8491e97 network: allow 0 for table number
Fixes #25089.

(cherry picked from commit 513bed294e)
2022-11-03 16:48:18 +01:00
Yu Watanabe
3f94f03389 network: Table= also accepts table name
(cherry picked from commit 29de4f7304)
2022-11-03 16:48:12 +01:00
Lennart Poettering
bdd84e82e5 analyze: add --image= + --root= to --help text
(cherry picked from commit 9f5b68d6b7)
2022-11-03 16:46:35 +01:00
Jan Janssen
23d66a03de meson: Fix build with --optimization=plain
Note that -O0 is deliberately filtered out as we have to compile with at
least -O1 due to #24202.

Fixes: #24323
(cherry picked from commit 7aa4762ce2)
2022-10-24 21:50:57 +02:00
Zbigniew Jędrzejewski-Szmek
98a45608c4 manager: allow transient units to have drop-ins
In https://github.com/containers/podman/issues/16107, starting of a transient
slice unit fails because there's a "global" drop-in
/usr/lib/systemd/user/slice.d/10-oomd-per-slice-defaults.conf (provided by
systemd-oomd-defaults package to install some default oomd policy). This means
that the unit_is_pristine() check fails and starting of the unit is forbidden.

It seems pretty clear to me that dropins at any other level then the unit
should be ignored in this check: we now have multiple layers of drop-ins
(for each level of the cgroup path, and also "global" ones for a specific
unit type). If we install a "global" drop-in, we wouldn't be able to start
any transient units of that type, which seems undesired.

In principle we could reject dropins at the unit level, but I don't think that
is useful. The whole reason for drop-ins is that they are "add ons", and there
isn't any particular reason to disallow them for transient units. It would also
make things harder to implement and describe: one place for drop-ins is good,
but another is bad. (And as a corner case: for instanciated units, a drop-in
in the template would be acceptable, but a instance-specific drop-in bad?)

Thus, $subject.

While at it, adjust the message. All the conditions in unit_is_pristine()
essentially mean that it wasn't loaded (e.g. it might be in an error state),
and that it doesn't have a fragment path (now that drop-ins are acceptable).
If there's a job for it, it necessarilly must have been loaded. If it is
merged into another unit, it also was loaded and found to be an alias.
Based on the discussion in the bugs, it seems that the current message
is far from obvious ;)

Fixes https://github.com/containers/podman/issues/16107,
https://bugzilla.redhat.com/show_bug.cgi?id=2133792.

(cherry picked from commit 1f83244641)
2022-10-24 21:21:51 +02:00
Zbigniew Jędrzejewski-Szmek
228cd82d2c manager: reformat boolean expression in unit_is_pristine()
Not not IN_SET(…) is just too much for my poor brain. Let's invert
the expression to make it easier to undertand.

(cherry picked from commit b146a7345b)
2022-10-24 21:21:50 +02:00
Yu Watanabe
06dc900efa network/bridge: fix UseBPDU= and AllowPortToBeRoot=
Fixes bugs caused by 7f9915f0de.

Fixes #24268.

(cherry picked from commit 3f504b892b)
2022-10-24 21:05:57 +02:00
Lennart Poettering
b0972e4df0 homed: properly initialize all return params
(cherry picked from commit 3b1494ad70)
2022-10-24 20:52:58 +02:00
Zbigniew Jędrzejewski-Szmek
d61ccd0252 meson: always use libatomic if found
Semi-quoting https://github.com/systemd/systemd/issues/25057:

clang-16 has made the choice to turn on -Werror=implicit-function-declaration,implicit-int.
(See Gentoo's tracker bug https://bugs.gentoo.org/870412).
Added in commit 132c73b57a, systemd now does a
check to see if libatomic is needed with some compile/link tests with e.g.
__atomic_exchange_1, but the tests don't provide a prototype for
__atomic_exchange_1 so with clang-16 the test fails, breaking the build.

Let's simplify things by linking to libatomic unconditionally if it is found
and seems to work. If actually unneeded, it might be dropped via --as-needed.
This seems to work with gcc and clang.

declare_dependency() is used instead of cc.find_library(), because the latter
picks up a symlink in gcc private directory (e.g.
/usr/lib/gcc/x86_64-redhat-linux/12/libatomic.so), and we don't want that.

Fixes #25057.

(cherry picked from commit 96f8c63601)
2022-10-24 20:52:45 +02:00
Luca Boccassi
833ad5f950 Revert "Fix issue with system time set back (#24131)"
This fix unfortunately introduced a much worse regression that
is affecting many users, so let's revert it for now and rework
it in the next release.

This reverts commit 5ded3917a1.

Fixes https://github.com/systemd/systemd/issues/24984

(cherry picked from commit 0bf1d0ff04)
2022-10-24 20:52:23 +02:00
Antonio Alvarez Feijoo
73d1dc665b bash-completion: add systemd-dissect support
(cherry picked from commit 808ec9df38)
2022-10-24 20:49:45 +02:00
Antonio Alvarez Feijoo
d89e9993d2 dissect: add missing --umount to the help output
(cherry picked from commit 1b967529d2)
2022-10-24 20:49:35 +02:00
Zbigniew Jędrzejewski-Szmek
087cbfd936 coredump: avoid deadlock when passing processed backtrace data
We would deadlock when passing the data back from the forked-off process that
was doing backtrace generation back to the coredump parent. This is because we
fork the child and wait for it to exit. The child tries to write too much data
to the output pipe, and and after the first 64k blocks on the parent because
the pipe is full. The bug surfaced in Fedora because of a combination of four
factors:
- 87707784c7 was backported to v251.5, which
  allowed coredump processing to be successful.
- 1a0281a3eb was NOT backported, so the output
  was very verbose.
- Fedora has the ELF package metadata available, so a lot of output can be
  generated. Most other distros just don't have the information.
- gnome-calendar crashes and has a bazillion modules and 69596 bytes of output
  are generated for it.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2135778.

The code is changed to try to write data opportunistically. If we get partial
information, that is still logged. In is generally better to log partial
backtrace information than nothing at all.

(cherry picked from commit 076b807be4)
2022-10-24 20:48:40 +02:00
Zbigniew Jędrzejewski-Szmek
ab587aaf8e shared/json: use different return code for empty input
It is useful to distinguish if json_parse_file() got no input or invalid input.
Use different return codes for the two cases.

(cherry picked from commit 87a16eb8b5)
2022-10-24 20:48:37 +02:00
Zbigniew Jędrzejewski-Szmek
219272f7b2 shared/json: allow json_variant_dump() to return an error
(cherry picked from commit 7922ead507)
2022-10-24 20:48:34 +02:00
Lennart Poettering
d1066f33b5 man: document restrictions on naming interfaces
Let's document that "." is a bad choice of character when naming
interfaces. Let's also document the hard restrictions we make when
naming interfaces.

Result of the mess that is #25052.

(cherry picked from commit 8f598a4635)
2022-10-24 20:48:11 +02:00
Daan De Meyer
e2a07cdac6 qrcode-util: Add support for libqrencode 3.0
They didn't actually change API between major versions, so let's
support the previous version as well so we can add CentOS 8 Stream
back to CI.

(cherry picked from commit 3f5225d7f3)
2022-10-24 20:45:34 +02:00
Celeste Liu
8be601f7ef seccomp: add riscv_flush_icache to allow list
This system call is harmless because it only enforces ordering between stores
and instruction cache fetch.

fixed #24991
Related: https://github.com/felixonmars/archriscv-packages/issues/1840

Signed-off-by: Celeste Liu <CoelacanthusHex@gmail.com>
(cherry picked from commit 09925036cf)
2022-10-24 20:44:57 +02:00
Michael Biebl
3028e05955 logind: fix getting property OnExternalPower via D-Bus
The BUS_DEFINE_PROPERTY_GET_GLOBAL macro requires a value as third
argument, so we need to call manager_is_on_external_power(). Otherwise
the function pointer is interpreted as a boolean and always returns
true:

```
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager OnExternalPower
b true
$ /lib/systemd/systemd-ac-power  --verbose
no
```

Thanks: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021644
(cherry picked from commit 63168cb517)
2022-10-13 23:00:28 +02:00
Zbigniew Jędrzejewski-Szmek
5da595db39 shared/condition: avoid nss lookup in PID1
PID 1 is not allowed to do nss lookups because this may take a long time or
even deadlock.

While at it, the comparisons are reordered to do the "easy" comparisons which
only require a string comparison first. Delay parsing of the UID until it is
really necessary. The result is the same, because we know that "root" and
"nobody" parse as valid.

(cherry picked from commit 734f96b849)
2022-10-13 23:00:15 +02:00
Yu Watanabe
40053e60f5 test: add more tests for StateDirectory= with DynamicUser=
This also moves the check for writable paths from test-execute to TEST-34.

Closes #10337.

(cherry picked from commit f01f70a9a3)
2022-10-13 22:59:07 +02:00
Yu Watanabe
0ba2e4bb69 core: do not create symlink to private directory if parent already exists
The very basic functinality of StateDirectory= or friends is creating
specified directories. That should work if one entry is a subdirectory
of another. However, it does not when combined with DynamicUser=yes.

To support such case, this adds ExecDirectoryItem.only_create flag, and
if it is set PID1 only create private directory, and not create the symlink
to the private directory.

Fixes #24783.

(cherry picked from commit a2ab603cc4)
2022-10-13 22:59:05 +02:00
Yu Watanabe
1de3cb97ee core: make exec_directory_add() extends existing symlinks
Follow-up for 211a3d87fb.

Previously, although ExecDirectoryItem.symlinks is strv, it always
contains at most one symlink.

(cherry picked from commit 564e5c9878)
2022-10-13 22:59:03 +02:00
Yu Watanabe
d7b83b9986 sd-ndisc: ignore failure in sending solicitation
Even if a bonding master interface has carrier, the underlying slave
interfaces may not. In such a case, sending solicitation fails with
-ENOBUS. Here, let's unconditionally ignore errors, as anyway we will
send a solicitation later.

Fixes #24717.

(cherry picked from commit 852bf93826)
2022-10-13 22:56:46 +02:00
Zbigniew Jędrzejewski-Szmek
e0ba044985 analyze: add forgotten return statement
We would fail with an assert in sd_bus_message_enter_container() afterwards.

(cherry picked from commit 5475e963c5)
2022-10-13 22:56:23 +02:00
Zbigniew Jędrzejewski-Szmek
40742ac74f basic/log: include the log syntax callback in the errno protection block
In general, log_syntax_internal() must keep errno unchanged. But the
call to log_syntax_callback() was added outside of the block protected
by PROTECT_ERRNO.

(cherry picked from commit 6b7834fe5d)
2022-10-13 22:56:01 +02:00
Zbigniew Jędrzejewski-Szmek
3e38c39600 logind: do not emit beep in wall messages
Those may go via the PC speaker, which is annoying and unexpected.
Most people have it off, so this doesn't work reliably anyway, so we can
disable it without much loss.

Fixes #23520.

(cherry picked from commit ef3458cd5d)
2022-10-13 22:55:33 +02:00
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