1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-19 21:57:27 +03:00

61273 Commits

Author SHA1 Message Date
Lennart Poettering
b77f041885 socket-util: fix socket_get_family()
Function didn't actually return anything useful. Quite a shame.

(cherry picked from commit 5f64d2bf332371bdfdcb91b588e57d4c0c20428f)
(cherry picked from commit 59514a6d87be7013d61b4f15b993918f5d1e44e5)
2023-03-30 18:44:25 +02:00
Chitoku
197ad2e965 timesync: stop re-sync on network configuration change when no link servers are configured (#26708)
This commit fixes an issue where systemd-timesyncd re-synchronizes the
system clock every time the network configuration is updated, no matter
whether link servers are actually changed.

Fixes a bug introduced by e05dd7718d0b32e039c9e0f7bf3875079d1a359d.

(cherry picked from commit 0f9c8d02918492e9369cf85479c2e540b9c1f698)
(cherry picked from commit cbd7a29604d78297e3ca8057fd21cf9be50e2962)
2023-03-30 18:43:36 +02:00
Zbigniew Jędrzejewski-Szmek
57741512f4 meson: adjust for removal of gnu-efi compat
gnu-efi-3.0.11-13.fc39 in Fedora dropped the old include paths.

/usr/include/efi/efi.h uses 'include "efibind.h"', so we cannot use -isystem.

(cherry picked from commit efcde781de4ebf7d15410b5d6cb7de3a8c67f6aa)
(cherry picked from commit 8d1db692194f7db407754e85961d82d99117ddab)
2023-03-30 18:42:04 +02:00
msizanoen1
fe05452b50 escape: add missing non-NULL parameter assertions
(cherry picked from commit 0b82a6fa5d2ba94bbc1c3db4a04dfd052e1cd446)
(cherry picked from commit bb3e44323bfeecad1e8a6af8c571c91eaebf5072)
v252.7
2023-03-03 12:01:34 +01:00
msizanoen1
dec5e2e7b5 test-escape: Add tests for escaping bogus UTF-8 sequences
(cherry picked from commit 582843ee37fb2de62321085dd3c2f4bfbdbad12e)
(cherry picked from commit c4e7cf2bd734b480c38b16c227a2b4f1928df270)
2023-03-03 12:01:34 +01:00
msizanoen1
e0a674f7f8 escape: Ensure that output is always valid UTF-8
This ensures that shell string escape operations will not produce output
with invalid UTF-8 from the input by escaping invalid UTF-8 data as if
they were single byte characters.

(cherry picked from commit 00f57157f32f6ed5a68d68986b013c203cd78c37)
(cherry picked from commit e906fd24214f53f1160918a5bb55a1d14368bfd8)
2023-03-03 12:01:30 +01:00
Frantisek Sumsal
48911dc5ec virt: correctly detect QEMU emulated pSeries guests
Resolves: #26629
(cherry picked from commit 8c7a6c742afef9284d5c06fc285cf66306cbce31)
(cherry picked from commit 1a220065740b128476c572541fa6e90bdd5b548f)
2023-03-03 12:01:26 +01:00
Lennart Poettering
8e6234064d psi-util: fix error handling
We checked ERRNO_IS_NOT_SUPPORTED on a possible positive non-error code,
which isn't right.

Fix that. Also add caching, since we are about to call this more often.

(cherry picked from commit 90ec8ebe33ec72ed6d9f451de9443d67dd351d72)
(cherry picked from commit 5ee19fdfa054f68e82cedbbff26d60c893ca5ef4)
2023-03-03 12:01:23 +01:00
David Tardon
30eae23c4a systemctl: print better message if default target is masked
If the default target is masked, `systemctl get-default` prints

  Failed to get default target: Operation not possible due to RF-kill

That's a bit too cryptic, so let's make it clear what's actually
happening.

Fixes #26589.

(cherry picked from commit 7c78a19322962bb386f87bcaf37bf650cca1c400)
(cherry picked from commit 144ac494ec8f13e4da2420720c96808046947762)
2023-03-03 12:01:03 +01:00
Lennart Poettering
7d3af1ff11 man: add two missing commands to synopsys
(cherry picked from commit aff131775b002ddac74b1c65d849dcd52a02c06d)
(cherry picked from commit dc98d58dd8864d537d38cc78617c0a1bf7385ee8)
2023-03-03 12:00:36 +01:00
Yu Watanabe
22d1f01b05 core/dbus-socket: check the socket path is absolute
In config_parse_socket_listen(), we have checked the path is absolute,
however we have not in the dbus method.

(cherry picked from commit 4de2b47bdec8bbb7df78678a152f18281b20e7b5)
(cherry picked from commit e093acd062f36de4471948c6d932b931333af4da)
2023-03-03 12:00:32 +01:00
Yu Watanabe
dd6561ff3e sd-event: fix error handling
Follow-up for 6d2326e036ceed30f9ccdb0266713c10a44dcf6c.

(cherry picked from commit 1912f790fee9e0182acd77b77496f500094a140d)
(cherry picked from commit a719c2ec2f410f8b979cec04dcdac9af470ee52b)
2023-03-03 12:00:28 +01:00
Yu Watanabe
78976199b2 sd-event: always initialize sd_event.perturb
If the boot ID cannot be obtained, let's first fallback to the machine
ID, and if still cannot, then let's use 0.
Otherwise, no timer event source cannot be triggered.

Fixes #26549.

(cherry picked from commit 6d2326e036ceed30f9ccdb0266713c10a44dcf6c)
(cherry picked from commit 58c821af607b61738b7b72ad1452e70f648689a6)
2023-03-03 12:00:25 +01:00
Yu Watanabe
028cee00dd systemctl: show "Until:" field only for service and scope units
Only service and scope units have RuntimeMaxUSec bus property.
To suppress the "Until:" field for other unit types, the entry must be
initialized with USEC_INFINITY.

Fixes #26473.

(cherry picked from commit b59052be261523721a86caf4ef820e63f03e26a4)
(cherry picked from commit 2bfb07b22ff1cce4f663740bff202bd65f041916)
2023-03-03 12:00:19 +01:00
Zbigniew Jędrzejewski-Szmek
2ca2390b11 tmpfiles.d: drop misleading comment
I'm not sure what "suffix" was meant by this comment, but the file has the usual suffix.
The file was added with the current name back in c4708f132381e4bbc864d5241381b5cde4f54878.
Maybe an earlier version of the patch did something different.

(cherry picked from commit 9c7188547cd53dddd635c86c8ef5655290541966)
(cherry picked from commit d9abd8babe01ab4e2e6d913d148369ade78441a4)
2023-03-03 12:00:07 +01:00
Aidan Dang
3856cada26 Enable TPM by default with SetCredentialEncrypted
(cherry picked from commit d59025698f6261aa65ac074a3b46e8babed0d05d)
(cherry picked from commit 0f4dbe6367b8adf00132782f71bd60bc0dc02e57)
2023-03-03 12:00:03 +01:00
Zbigniew Jędrzejewski-Szmek
4f4344e3a5 efi: drop executable-stack bit from .elf file
An rpminspect test in Fedora/RHEL is flagging our stub files as having an
executable stack. The check is correct:

$ readelf --wide --program-headers build/src/boot/efi/linuxx64.elf.stub | rg -i stack
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RWE 0x10

It seems to be just an omission in the linker script… None of the objects that
are linked into the stub are marked as requiring an executable stack:

$ readelf --wide --sections build/src/boot/efi/*.c.o \
  /usr/lib/gnuefi/x64/libgnuefi.a \
  /usr/lib/gnuefi/x64/libefi.a \
  /usr/lib/gcc/x86_64-redhat-linux/12/libgcc.a \
  | rg '.note.GNU-stack.*X'
(nothing)

On aarch64 we end up with a nonexecutable stack, but on ia32 and x64 we get one,
so this might be just a matter of defaults in the linker. It doesn't matter
greatly, but let's mark the stack as non-executable to avoid the warning.

Note: '-Wl,-z' is not needed, things work with just '-z'.
(cherry picked from commit 1eca770933e49a1be16e40bfbaefc0f75af81781)
(cherry picked from commit 44c2ff5b1ebbc0a18c0f3676b7ea3242250315f0)
2023-03-03 11:59:49 +01:00
David Tardon
a39a0c6db4 logind-session: make stopping of idle session visible to admins
(cherry picked from commit 6269ffe7ee8a659df7336a2582054ecd9eecf4b1)
(cherry picked from commit f2460b78b9a4e46deb2e9432df68b546a988d46a)
2023-03-03 11:59:44 +01:00
Mike Yuan
338bbe76ac sleep: check if we're on AC power before checking battery capacity
Before this commit, battery_is_low() returns
true if there's no battery on the system.
It's now modified to check if the system is
on AC power first, and returns false early
if that's the case.

Fixes #26492

(cherry picked from commit e0b3a70fabb871bf55678e9e177445b1df2aee88)
(cherry picked from commit 1947b9939c42d8d1a6f09ac35351e7a4a6238450)
2023-03-03 11:59:07 +01:00
David Tardon
3eb0f9f8a6 install: fail early if specifier expansion failed
Before:

systemd[1]: Assertion 'path' failed at src/shared/install.c:288, function install_changes_add(). Aborting.
systemd[1]: Caught <ABRT> from our own process.
systemd[1]: Caught <ABRT>, dumped core as pid 2525.
systemd[1]: Freezing execution

After:

Failed to enable unit: Invalid specifier in user-%J.service

Fixes #26467.

Follow-up for: f5a0162

(cherry picked from commit f8979e869812988835f6951fb73a68e30a4c608c)
(cherry picked from commit 452cad62c83c134c4a1ee964824ac9dd40796293)
2023-03-03 11:59:01 +01:00
Lennart Poettering
8af5e945c7 homectl: add missing break
(cherry picked from commit 464ec1dec741e31d7bf08a4b7bb5a64a6adbb81d)
(cherry picked from commit eae11e3f064372ec30efe460381ce807238daa82)
2023-03-03 11:58:56 +01:00
Zbigniew Jędrzejewski-Szmek
e72f1676af man/tmpfiles.d: adjust the table in synopsis, improve spelling
r and R take globs, so let's name the argument appropriately in the tl;dr listing.

Also, use 'clean-up' in the file name where it represents the verb "clean up",
and other minor spelling adjustments.

(cherry picked from commit 164297cd9a410fdd9ca3c068da4d80d74916cf18)
(cherry picked from commit aac692160ef2a88f4a725f7ade900c6bd6b36641)
2023-03-03 11:58:46 +01:00
Frantisek Sumsal
e8eb3ddbaf test: disable pipefail when testing interactive firstboot
Otherwise we might get unexpected test fails due to SIGPIPE:

```
[   14.334917] testsuite-74.sh[565]: + grep -q '^root:.*:0:0:.*:/bin/fooshell$' test-root/etc/passwd
[   14.335670] testsuite-74.sh[681]: + systemd-firstboot --root=test-root --prompt-root-shell
[   14.336382] testsuite-74.sh[680]: + echo -ne '\n/bin/barshell\n'
[   14.336980] testsuite-74.sh[680]: .//usr/lib/systemd/tests/testdata/units/testsuite-74.firstboot.sh: line 166: echo: write error: Broken pipe
```

(cherry picked from commit 27c814666fa25210c3f6c603c8da836189272eb0)
(cherry picked from commit d2739b8c1470d326fb539b6d03a6d938e089d3f1)
2023-03-03 11:58:41 +01:00
Yu Watanabe
892fe5d204 process-util: show requested process name in the log
This is useful for debugging issues like #26474.

(cherry picked from commit b9fadf2e2cb83d342342341b0edba4f519890634)
(cherry picked from commit ba1cb4156bb7df9d5ce1b35a25425e544f6989de)
2023-03-03 11:57:59 +01:00
Mike Yuan
e9889190be journalctl: fix output when --lines is used with --grep
Previously, we skip the entries before arg_lines
unconditionally, which doesn't behave correctly
when used with --grep. After this commit, when
a pattern is specified, we don't skip the entries
early, but rely on the count of the lines shown
to tell us when to stop. To achieve that we would
have to search backwards instead.

Fixes #25147

(cherry picked from commit db4691961ca52759fe6645d0fddb659ee4299ac2)
(cherry picked from commit c4cdbb978f681e7356c6c6367c1730d156a6a4e0)
2023-03-03 11:37:00 +01:00
Yu Watanabe
a6c1c2cfbd loop-util: fix error condition and return value
Fixes a bug introduced by da4fd28871227d23d4719e30da03af5a71f47e5a.

(cherry picked from commit 2421dd72674d55bd8ed026bdf47939cbda26152f)
(cherry picked from commit 6dafcad55c6a47bbd27f06eb035a3e544e51f889)
2023-03-03 11:36:56 +01:00
Jan Janssen
ac3d8922df boot: Fix assertion failure
The TPM code expects a description unless the PCR index indicates that
no measurements have to take place. The assert was preempting this
check from happening.

Fixes: #26428
(cherry picked from commit f92428eae53685f372775e8cb0f0f4c249f02724)
(cherry picked from commit cd5de2811ae72e209377f714cdbd8e5a0d6361bc)
2023-03-03 11:36:12 +01:00
Lennart Poettering
7c9b9c8d93 pid1: generate compat warning for SystemCallArchitectures= if seccomp is off
(cherry picked from commit 6aa2c55522d7cac62ecfd5d5687a86a84f158d18)
(cherry picked from commit 01b90e1588e29888c7583bd320b898b59257d737)
2023-03-03 11:36:09 +01:00
Yu Watanabe
6e8d76f776 core/mount: fix default target for /sysusr/usr and its child
Follow-up for 29a24ab28e9790680348b1ffab653a321fa49a67.

(cherry picked from commit dbfc096095cb741f5345be0dc6508628008c46d7)
(cherry picked from commit a3177cbe546537c873d477138014d054b1cc6376)
2023-03-03 11:36:05 +01:00
Joan Bruguera
58cbb7a89b resolved: Fall back to TCP if UDP is blocked
If UDP is blocked on the system (e.g. by iptables or BPF), the kernel will
return EPERM on some or all of the system calls (connect, sendmsg, etc.).
In this case, try to fall back to TCP, which hopefully will not be blocked.

(cherry picked from commit 3dd6336ad0cb40e928745404ed72c41e4ac9c39e)
(cherry picked from commit a88e35bf953f5a0047d5170d0d0e2d372b2280ae)
2023-03-03 11:35:32 +01:00
Yu Watanabe
e91a304274 sysusers: also add root group
Follow-up for 49bb7fe5f88fc35b8529d7d8dfcd4c151a9aaf1a.

Fixes an issue reported at
https://github.com/systemd/systemd/pull/26270#issuecomment-1428945403.

(cherry picked from commit 9361a712f85860ead532dba1468dbd3deef00e34)
v252.6
2023-02-16 18:10:56 +00:00
Luca Boccassi
4dc38d3979 hwdb: update
(cherry picked from commit 0c1f5d50be2d7a99ad4259eb1486724e17af6964)
2023-02-16 00:46:43 +00:00
Jean-Tiare Le Bigot
978afa29ee hwdb: Add HP ENVY x360 2-in-1
Since #26144, RFKILL events are disabled for HP ENVY x360 Convertible.
This commit adds a variation of the name.

(cherry picked from commit 112f81a547bb5cc4f3dbbfd11456377de870196b)
2023-02-16 00:46:43 +00:00
Mike Gilbert
0e5fb5cd09 bootctl: avoid using __WORDSIZE macro
__WORDSIZE does not seem to be documented anywhere, and is probably
meant to be used internally by glibc headers.

In systemd, it was only being used in warning messages. We can avoid
using it by rewording the messages slightly.

Fixes a build error with musl libc.

Bug: https://bugs.gentoo.org/894430
(cherry picked from commit 7cd137e6478746eb02a516cef85ade0da618b017)
2023-02-16 00:46:43 +00:00
Daan De Meyer
ef96e60f18 test-boot-timestamp: Handle ERANGE error
Timestampfs from sysfs files can be zero in which case ERANGE will
be returned so let's make sure we catch that.

(cherry picked from commit 0da4cc97b446b43802692f2415e5a774771b0ca9)
2023-02-16 00:46:43 +00:00
ml
bfaf02348e man: fix directory for user home bind mounts
(cherry picked from commit f39d7d00a31c1867d5fa41b3dd4e6d20665a8f3a)
2023-02-16 00:46:43 +00:00
ml
cad1e9c53d nspawn: fix directory in logged error
(cherry picked from commit 7b03b44ed9f5f748670aa26193274dae94468149)
2023-02-16 00:46:43 +00:00
Luca Boccassi
a8396fd1c7 packit: remove -Ddefault-user-timeout-sec/-Ddefault-timeout-sec
Added in v253, so breaks the packit build which uses rawhide's spec
2023-02-10 20:28:11 +00:00
Yu Watanabe
196614c06c cryptenroll: drop deadcode
Follow-up for b0fc23fae51d244d2c33d70c10003aa5d5840223.

After the commit, 'signature_path' is now always non-NULL, hence the
condition can be dropped.

Fixes CID#1504492.

(cherry picked from commit 645063d1bb309137f884d9c9f01d2b7d01ab2ca8)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
20fbd29d10 hwdb: update to v253-rc3
$ git restore -s a7073ede833c3204dbed9d643d721c8017bd8d78 hwdb.d/
2023-02-10 20:28:11 +00:00
Lennart Poettering
c973e2295c core: when isolating to a unit, also keep units running that are triggered by units we keep running
Inspired by: #26364

(this might even "fix" #26364, but without debug logs it's hard to make
such claims)

Fixes: #23055
(cherry picked from commit 32d6707dd1692d41e12f5469dfdcbc10f14d6619)
2023-02-10 20:28:11 +00:00
Samuel Cabrero
68d11465e4 userdb: Use json_dispatch_user_group_name() to parse GetMembership fields
It allows to relax the checks and allow characters like '\', used by
windows to split the domain name and user name.

For reference, discussion in the systemd-devel mailing list:
https://lists.freedesktop.org/archives/systemd-devel/2023-February/048804.html

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
(cherry picked from commit edd5ec23738ef9ae7b1416bacede97e70ddf9402)
2023-02-10 20:28:11 +00:00
Luca Boccassi
0dc9f7335d README: explicitly note that util-linux's mount/swap are required
These are the most visible and hard requirements, as we use options that
busybox does not provide, so list them explicitly to avoid surprises

(cherry picked from commit 164070e497f36b6d8055e4338e07188dd975f6f2)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
9ad732e70c man: fix links to man pages
Done using linkchecker as usual.

(cherry picked from commit f37f0f35cd37a102fc300ec0188934de94980a06)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
ebada36b7b man: fix section number
Fixes #26376.

(cherry picked from commit 359c14368e64ea4714b84d7f5311fd8c3f9c91c1)
2023-02-10 20:28:11 +00:00
Luca Boccassi
33e7522030 units: change assert to condition to skip running in initrd/os
These units are also present in the initrd, so instead of an assert,
just use a condition so they are skipped where they need to be skipped.

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

(cherry picked from commit 7ef09e2099a4f97ad40748d6b7c735b45aa4c990)
2023-02-10 20:28:11 +00:00
Daan De Meyer
601d8564b3 bootctl: Add missing %m
(cherry picked from commit 3b42ffe590c5728af50feb138890a44264c4b02e)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
9bb72a4e96 manager: "downgrade" message about command vanishing from the unit file
We would print "Current command vanished from the unit file, execution of
the command list won't be resumed." as a warning, but most of the time there
is nothing to resume, because a unit has just one command. So let's detect
the case where the command that was active is the last command in the sequence
and skip the warning.

I was considering how to store the information that the command is last. An
important consideration is not to use a format that would confuse older versions
of systemd. (It wouldn't be a big problem if older systemd just refused the
new serialization, since we require systemd to be newer, but we should avoid
the case where the deserialization is "successful", but actually incorrect.)
Similarly, the deserialization from the old systemd must not confuse new systemd.
For this command, we have a list of arguments at the end, so just adding a
new field either in the middle or at the end is problematic because it's hard
to ensure that we don't mix up the positional and variable arguments.

We actually need to store just one bit of information, so '+' is prefixed on
the index of the last command and used by new systemd to skip the warning.
When deserializing from older systemd, '+' is not present, so we detect all
commands as "not last", and still emit the warning, so we err on the side of
caution. If the user were to deserialize from newer to older systemd, nothing
untoward would happen, because the '+' is ignored. (Users shouldn't do this,
but we know that this occasionally happens with initrds or exitrds and package
downgrades.)

(cherry picked from commit a99bd455b59b7922a1b1af480b209263a4d3c659)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
7c0ac515c8 test-parse-util: add tests with explicit plus character
I expected this to work, but our tests did not cover this
explicitly.

(cherry picked from commit 8eb491f4993c6080e9724c0359a87c64c460605e)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
e811aead84 core/service: constify ExecCommand* in two functions
(cherry picked from commit 502096b56593919fc947415f6e32bcb680728dac)
2023-02-10 20:28:11 +00:00