1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-14 16:58:22 +03:00

60993 Commits

Author SHA1 Message Date
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
Yu Watanabe
7aeb2a8d4e sd-dhcp-server: allow to send header only message
If we receive a header only message, and the server is running in relay
mode, then the assertion was triggered.

Fixes #26151.

(cherry picked from commit b52031dbbcabe4b1e3016ba64d4a2822740188bc)
2023-02-10 20:28:11 +00:00
Daan De Meyer
ab877f7072 resolve: Skip creating stubs if missing CAP_NET_BIND_SERVICE
If we don't have CAP_NET_BIND_SERVICE, we won't be able to bind
the stub listener socket, so let's skip creating it and log a warning.

We do the same for the extra stubs if they're configured on privileged
ports.

(cherry picked from commit 0398c084efba664e44625d82f2be72e18c952678)
2023-02-10 20:28:11 +00:00
Daan De Meyer
3a49291f4b nspawn: Drop CAP_NET_BIND_SERVICE when in userns but not in netns
If we're in a user namespace but not unsharing the network namespace,
we won't be able to bind any privileged ports even with
CAP_NET_BIND_SERVICE, so let's drop it from the retained capabilities
so services can condition themselves on that.

(cherry picked from commit 2642d22adc66771bd8bbb4187dc3de5472d04ad6)
2023-02-10 20:28:11 +00:00
Jan Janssen
ce56d12f01 boot: Use aarch64 virtual counter
This should be used in VMs and should also yield the same value when
running on real devices. It is also what grub uses.

Fixes: #26224
(cherry picked from commit 2df8574af035ce4f515beb7c0adf83973440a8a6)
2023-02-10 20:28:11 +00:00
William Roberts
e1b0f8c20c sha256: header needs stddef
The sha256 header uses size_t which is within stddef, so add it.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
(cherry picked from commit 6ae3bd82d04155d27488c85c63f7330cc7e144d3)
2023-02-10 20:28:11 +00:00
Lennart Poettering
278e0d5b19 sha256: external headers should be included with <>
(cherry picked from commit 17b296a11839ac63279b89e40cecb4c114c229b2)
2023-02-10 20:28:11 +00:00
Nick Rosbrook
efc5612e47 test-network: add a test for renaming device to current altname
(cherry picked from commit f68f644a167af3452be853b631fa9144c6716c28)
2023-02-10 20:28:11 +00:00
Nick Rosbrook
7299341bd1 sd-netlink: add a test for rtnl_set_link_name()
Add a test that verifies a deleted alternative name is restored on error
in rtnl_set_link_name().

(cherry picked from commit b338a8bb402a3ab241a617e096b21ae6a7b7badf)
2023-02-10 20:28:11 +00:00
Nick Rosbrook
c6722b6975 udev: attempt device rename even if interface is up
Currently rename_netif() will not attempt to rename a device if it is
already up, because the kernel will return -EBUSY unless live renaming
is allowed on the device. This restriction will be removed in a future
kernel version [1].

To cover both cases, always attempt to rename the interface and return 0
if we get -EBUSY.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=bd039b5ea2a9

(cherry picked from commit 53584e7b61373c26635b906eb64e98fbd3fd3ba4)
2023-02-10 20:28:11 +00:00
Nick Rosbrook
42d8817bd6 sd-netlink: restore altname on error in rtnl_set_link_name
If a current alternative name is to be used to rename a network
interface, the alternative name must be removed first. If interface
renaming fails, restore the alternative name that was deleted if
necessary.

(cherry picked from commit 4d600667f8af2985850b03a46357e068d3fb8570)
2023-02-10 20:28:11 +00:00
Nick Rosbrook
3dc5b19f10 sd-netlink: do not swap old name and alternative name
Commit 434a348380 ("netlink: do not fail when new interface name is
already used as an alternative name") added logic to set the old
interface name as an alternative name, but only when the new name is
currently an alternative name. This is not the desired outcome in most
cases, and the important part of this commit was to delete the new name
from the list of alternative names if necessary.

(cherry picked from commit 080afbb57c4b2d592c5cf77ab10c6e0be74f0732)
2023-02-10 20:28:11 +00:00