1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-26 10:03:40 +03:00

61104 Commits

Author SHA1 Message Date
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
Luca Boccassi
f0126ad7f9 core: imply DeviceAllow=/dev/tpmrm0 with LoadCredentialEncrypted
If the device access policy is restricted, add implicitly access to the TPM
if at least one encrypted credential needs to be loaded.

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

(cherry picked from commit 398dc7d39b9a877e71529f0e0b139329e4c6992e)
2023-02-10 20:28:11 +00:00
Luca Boccassi
a46a74e8e9 cryptenroll: do not implicitly verify with default tpm policy signature
If it was not requested to use a tpm2 signature file when enrolling, do
not fallback to the default /run/systemd/tpm2-pcr-signature.json as it
likely will be unrelated if it exists.

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

(cherry picked from commit b0fc23fae51d244d2c33d70c10003aa5d5840223)
2023-02-10 20:28:11 +00:00
Yu Watanabe
62055cfd4b udevd: configure a child process name for worker processes
This effectively reverts commit ff86c92e3043f71fc801cf687600a480ee8f6778,
and re-apply 49f3ee7e74c714f55aab395c080b1099fc17f7fd.

The change was dropped due to the process name was not correctly logged,
but the issue was fixed by dd15e4cb57129b915e01495e113696bfe0b70214.
Let's set the child process name again.

(cherry picked from commit e955a7f460adadf54da7bfb62f04cbff16ca5941)
2023-02-10 20:28:11 +00:00
Lennart Poettering
1187340c9d journal: print a useful error message if we hit the journal file open limit
See: #20921
(cherry picked from commit 763c46defa1c9b632a0788622d05c71a7de18424)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
7c9dcd50f0 resolve: adjust message for NXDOMAIN lookup result
Previously, we reported:
  nx.example.org: resolve call failed: 'nx.example.org' not found
But the call did succeed, and in fact all communication with the upstream
servers was successful, and we got an authoritative negative answer.
So instead of saying that the call fail, just say that the host doesn't exist:
  nx.example.org: Name 'nx.example.org' not found

I wanted to keep the prefix of "<name>: ", to keep the output uniform. But
it'd look a bit strange to say "<name>: <name> not found", so I added "Name "
to make the output more readable. (Another option would be to not display
the error string received from resolved, but that seems risky: even if right
now resolved uses just one message format, it could start doing something else
in the future, so it's better to display the error as received.)

Fixes #26233.

(cherry picked from commit bbb86efa7c668fa79331aa9a7f0567d89a3af50f)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
c538abc8bd resolve: define normal macros for BUS_ERROR_DNS error codes
This result is identical after cpp is done, so we don't save anything
by not having the usual macros. And with the usual macros it's easier to
grep and code-crossreferencing works better.

(cherry picked from commit 03e80572a71c65833ccca7b9ef06c5d86322e2ed)
2023-02-10 20:28:11 +00:00
Yu Watanabe
ce4726468d argv-util: also update program_invocation_short_name
Our logging uses program_invocation_short_name. Without this patch,
logs from forked client may become broken; spuriously truncated or
the short invocation name is not completely shown in the log.

(cherry picked from commit dd15e4cb57129b915e01495e113696bfe0b70214)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
53ca414a45 repart: silence bogus gcc warning
[2/3] Compiling C object systemd-repart.p/src_partition_repart.c.o
../src/partition/repart.c: In function ‘context_open_copy_block_paths’:
../src/partition/repart.c:5194:41: warning: ‘devno’ may be used uninitialized [-Wmaybe-uninitialized]
 5194 |                         source_fd = r = device_open_from_devnum(S_IFBLK, devno, O_RDONLY|O_CLOEXEC|O_NONBLOCK, &opened);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/partition/repart.c:5188:31: note: ‘devno’ was declared here
 5188 |                         dev_t devno;
      |                               ^~~~~

This is with gcc-13.0.1-0.2.fc38.x86_64, -O2. I'm pretty sure the code
is correct. I also tried adding some asserts where errno is used for the return
value, but that didn't help. I think resolve_copy_blocks_auto() is just too long
for gcc to understand.

(cherry picked from commit 03f5e501b6b58cb05a275403af4a36694ff0c205)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
31b7785814 repart: fix invalid errno in log
(cherry picked from commit 375ffdba43f6dac5f4b1222d4e345f7cdf868f8c)
2023-02-10 20:28:11 +00:00
Robin Humble
015b0ca928 pid1: fix segv triggered by status query (#26279)
If any query makes it to the end of install_info_follow() then I think symlink_target is set to NULL.
If that is followed by -EXDEV from unit_file_load_or_readlink(), then that causes basename(NULL)
which segfaults pid 1.

This is triggered by eg. "systemctl status crond" in RHEL9 if

/etc/systemd/system/crond.service
  -> /ram/etc/systemd/system/crond.service
  -> /usr/lib/systemd/system/.crond.service.blah.blah
  -> /usr/lib/systemd/system/crond.service

(cherry picked from commit 19cfda9fc3c60de21a362ebb56bcb9f4a9855e85)
2023-02-10 20:28:11 +00:00
Jan Janssen
7573078a7d meson: Install missing udev rule
(cherry picked from commit 4c6d1e16657193a2848db3201baf0cccd2b0cfb1)
2023-02-10 20:28:11 +00:00
Jan Janssen
6d8885af57 meson: Install missing bash-completions
(cherry picked from commit 7b2f84e3f2c5cf84ca39a054493979a8960a9d47)
2023-02-10 20:28:11 +00:00
Jan Janssen
aa79d157af meson: Install missing network file
(cherry picked from commit 17be6f270907eff274df80e91e1d323cb04f266f)
2023-02-10 20:28:11 +00:00
Jan Janssen
5bad071f73 meson: Install all catalogs
(cherry picked from commit 3774ff06f25335c2a049585f0ecb486a3da58e5e)
2023-02-10 20:28:11 +00:00
Rudi Heitbaum
a8b9c4766d glibc: Conditionally #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
(cherry picked from commit 1bb6ba08b128d62acdbbc566d60a054ff5bb9565)
2023-02-10 20:28:11 +00:00
Zbigniew Jędrzejewski-Szmek
8ad3d68acd sysusers: insist that root group is 0
In https://bugzilla.redhat.com/show_bug.cgi?id=2156900 sysusers was reporting a
conflict between the following lines:
  u root 0:0 "Super User" /root /bin/bash
  u root    0     "Super User" /root

The problem is that those configurations are indeed not equivalent. If group 0
exists with a different name, the first line would just create the user, but the
second line would create a 'root' group with a different GID. The second
behaviour seems definitely wrong. (Or at least more confusing in practice than
the first one. The system is in a strange shape, but the second approach takes
an additional step than is worse than doing nothing.)

When this line was initially added, we didn't have the uid:gid functionality for
'u', so we didn't think about this too much. But now we do, so we should use it.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'g foobar 0'
Creating group 'foobar' with GID 0.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0 "Zuper zuper"'
src/sysusers/sysusers.c:1365: Creating group 'root' with GID 999.
src/sysusers/sysusers.c:1115: Suggested user ID 0 for root already used.
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 999 and GID 999.

vs.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0:0 "Zuper zuper"'
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 0 and GID 0.

(cherry picked from commit 49bb7fe5f88fc35b8529d7d8dfcd4c151a9aaf1a)
2023-02-10 20:28:11 +00:00
Arsen Arsenović
817b8441c4 importd: Always specify file unpacked by tar
Despite popular belief, the default file extracted by GNU tar is not stdin.  It
is the value of the TAPE environment variable, falling back on a compile-time
constant.  On my system, the default value is /dev/full, which causes tar to
just spin forever due to --ignore-zeros.  Always specifying this flag is the
safe thing to do.

  ~$ tar --show-defaults
  --format=gnu -f/dev/full -b20 --quoting-style=escape
  --rmt-command=/usr/sbin/grmt

See also: ``(tar)defaults'', available via Info viewers, and in HTML form at:
https://www.gnu.org/s/tar/manual/html_node/defaults.html

(cherry picked from commit 181eea677dd364d2b22dc691647792142b271074)
2023-02-10 20:28:11 +00:00
Dmitry V. Levin
212aa36d03 tmpfiles: avoid double specifier expansion in L lines
Starting with commit 2f3b873a4973, when the path contains a specifier
and the argument is omitted, tmpfiles used to perform specifier
expansions twice: first specifier expansion was applied to the path
itself, and afterwards the result of the first expansion was used
in the constructed argument and expanded once again.

Resolves: #26244
Fixes: 2f3b873a4973 ("tmpfiles: copy/link /usr/share/factory/ files when the source argument is omitted")
(cherry picked from commit 05381430a5d632ffc716fb4c89328952bd8ccafd)
2023-02-10 20:28:11 +00:00
Dmitry V. Levin
80b5af843b tmpfiles: fix specifier expansion in arguments of C lines
Make sure the argument of "C" type undergoes specifier expansion
before it's checked for validity.  In particular, starting with
commit ce610af143b2, the check for path existence used to fail
in case of presence of any specifier in the argument.

Also, starting with commit 2f3b873a4973, when the path contains
a specifier and the argument is omitted, tmpfiles used to perform
specifier expansions twice: first specifier expansion was applied
to the path itself, and afterwards the result of the first expansion
was used in the constructed argument and expanded once again.

Finally, starting with commit 849958d1ba35, when the argument begins
with %h specifier, tmpfiles used to complain that the source path
is not absolute.

Resolves: #25381
Fixes: ce610af143b2 ('tmpfiles: in C lines, make missing source graceful error')
Fixes: 2f3b873a4973 ('tmpfiles: copy/link /usr/share/factory/ files when the source argument is omitted')
Fixes: 849958d1ba35 ('tmpfiles: add new "C" line for copying files or directories')
(cherry picked from commit 1ed8887e3b539c89f3bb381427fbe9b0307bdfd0)
2023-02-10 20:28:11 +00:00