1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-10 00:58:20 +03:00

58511 Commits

Author SHA1 Message Date
Frantisek Sumsal
b22bd6de9e test: force mkfs.btrfs to overwrite any existing file systems
mkfs.btrfs (unlike mkfs.ext4) checks if the target already contains
a file system and refuses to continue if so. This causes spurious fails
in case the random garbage on the temporary device matches a valid FS
header:

[   19.723806] testsuite-64.sh[355]: + udevadm lock --device=/dev/mapper/encbtrfs0 --device=/dev/mapper/encbtrfs1 --device=/dev/mapper/encbtrfs2 --device=/dev/mapper/encbtrfs3 mkfs.btrfs -M -d raid1 -m raid1 -L btrfs_mencdisk -U deadbeef-dead-dead-beef-000000000003 /dev/mapper/encbtrfs0 /dev/mapper/encbtrfs1 /dev/mapper/encbtrfs2 /dev/mapper/encbtrfs3
[   19.918934] testsuite-64.sh[2494]: ERROR: /dev/mapper/encbtrfs0 appears to contain an existing filesystem (hfsplus)
[   19.920490] testsuite-64.sh[2494]: ERROR: use the -f option to force overwrite of /dev/mapper/encbtrfs0

Let's force mkfs.btrfs to overwrite the file system in such case.

(cherry picked from commit b3ba7d6274aff864a80dc9b1ff7d88ad376da451)
(cherry picked from commit 12c3b1980b47a87139c3f4406161df69e7515873)
(cherry picked from commit b67fad80e048ab4d8f0f39e40302b41f6161fe75)
2023-03-31 08:51:56 +02:00
Zbigniew Jędrzejewski-Szmek
a50500c28f man: explain route-only domains a bit more
The details discussion of how search and route-only domains work is in
systemd-resolved.service(8). But users are more likely to look at
resolved.conf(5), because that's where Domains= is described. So let's add a
reference to the other man page there, and also strengthen the text a bit. In
particular, in systemd-resolved.service(8) we say "route-only", which makes
the distinction with search domains clearer. Let's use the same in the other
man page too.

This is based on feedback from Lukáš Nykrýn that the man page is not clear
enough.

(cherry picked from commit 87291a26f5262c47bdb3493d15534c18f25870e6)
(cherry picked from commit c7afeee1e6b42d2c68074dc0b89ace502a16315b)
(cherry picked from commit 1114a7a52215777e6c87d9e96514846f1b215d47)
2023-03-31 08:51:56 +02:00
Yu Watanabe
459d487f4a man: mention systemd-growfs-root.service
(cherry picked from commit 61ccf030aef82e335941260b82381d0056b475c7)
(cherry picked from commit b8b20dc261751598b8b4ddfcd9c2e3244b938571)
(cherry picked from commit 0e29ec09dd35cfe244af88c778605cd0033a7874)
2023-03-31 08:51:56 +02:00
Yu Watanabe
ce2f4e2c11 man: mention systemd-fsck-usr.service
(cherry picked from commit 5e9750533586efa3d480ac2bc4cf8549993bc3f1)
(cherry picked from commit 20f71ba98f9e55796693cdbd5d0416c372a7056c)
(cherry picked from commit 720cb50229e6c8d5ecdf44a3d4b8c050743d4f49)
2023-03-31 08:51:56 +02:00
Yu Watanabe
7e33c78366 test: add header build tests for newer C and C++ standards
(cherry picked from commit a6d46fe64b61c62dc5c0dadbad65134075b29303)
(cherry picked from commit efbe08c27cb3881f154142a1797cb32034ad4748)
(cherry picked from commit 3e270826ceacd0172b7cd20a525c8606ea6fe687)
2023-03-31 08:51:56 +02:00
Cristian Rodríguez
5487e1e142 Include <threads.h> if possible to get thread_local definition
IN C23, thread_local is a reserved keyword and we shall therefore
do nothing to redefine it. glibc has it defined for older standard
version with the right conditions.

v2 by Yu Watanabe:
Move the definition to missing_threads.h like the way we define e.g.
missing syscalls or missing definitions, and include it by the users.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
(cherry picked from commit 5545f336fd09148e8d9aa7f83ed19384deaf7a64)
(cherry picked from commit 25b5c24e59b63abe081c31e3d9a3dd392c2fdbae)
(cherry picked from commit dd9c50c6cb2f5f97dd055e483d67dffa43921d60)
2023-03-31 08:51:56 +02:00
Daan De Meyer
c8cb3bc326 journal-file: Fix return value in bump_entry_array()
(cherry picked from commit 0399902440fbaea5b163254f70be57dbedb7131e)
(cherry picked from commit 7e76a341462d452e83753d8bbb683509a43fe837)
(cherry picked from commit 2b55c8a6f1b641de71fdcf5f662c4c077f8ab855)
2023-03-31 08:51:56 +02:00
Yu Watanabe
b57305a771 core/main: make positional arguments followed by '=', then by value
To make ConditionKernelCommandLine= or friend not confused when we are
running in a container.

Addresses https://github.com/systemd/systemd/pull/26887#discussion_r1143358884.

(cherry picked from commit d2ebd50d7f9740dcf30e84efc75610af173967d2)
(cherry picked from commit 0417b2875521424104d27229c13681c03baf9290)

[The patch didn't apply cleanly. When fixing stuff, I left the array size
as it was. The extra few bytes don't matter and this way it's unlikely to
be wrong.]

(cherry picked from commit a85ed9af34f0d35721702235807b973c9e3fd215)
2023-03-31 08:23:50 +02:00
Yu Watanabe
1420c16bbd core/main: fix maximum number of arguments for shutdown command
Follow-up for c5673ed0de3bec38f68d8113d253842b47766e27.

(cherry picked from commit 6920049fad4fa39db5fec712f82f7f75b98fd4b9)
(cherry picked from commit 0880a3af7775a3ecb022fa2bc772ef23c4fbbfd7)
(cherry picked from commit 06207ae0e4f6e858dc3a9ad36e074cca1563d2c6)
2023-03-31 08:23:49 +02:00
Yu Watanabe
ef59967812 coredump: use unaligned_read_ne{32,64}() to parse auxv
Fixes a bug introduced by 3e4d0f6cf99f8677edd6a237382a65bfe758de03.

The auxv metadata is unaligned, as the length of the prefix
"COREDUMP_PROC_AUXV=" is 19. Hence, parse_auxv{32,64}() may triger
an undefined behavior (or at least cause slow down), which can be
detected when running on an undefined behavior sanitizer.

This also introduces a macro to define `parse_auxv{32,64}()`.

Fixes #26912.

(cherry picked from commit 9b032f932c4172fac379234d9d42cf2b266ccaea)
(cherry picked from commit bff4f7b3fd77b2dd2fe8813e2038a33a1992021e)
(cherry picked from commit f718ee9d5151d4dd9153b129a5c6aed3216f3fc4)
2023-03-31 08:23:43 +02:00
Yu Watanabe
a1e28690a1 core/transaction: do not log "(null)"
As we ignores the failure in merge_unit_ids(), so unit_ids may be NULL.

(cherry picked from commit 5803c24da5cf543a55c4fce9009a9c5f2b18519a)
(cherry picked from commit 591a82f24fa233e8011a8baf8bade597d550e557)
(cherry picked from commit 03163a0d81ad0f1bc71ea6fd918294acef7a82ff)
2023-03-31 08:23:39 +02:00
Yu Watanabe
d938e48207 core/transaction: make merge_unit_ids() return non-NULL on success
(cherry picked from commit 999f16514367224cbc50cb3ccc1e4392e43f6811)
(cherry picked from commit d084528c49e84354b9a032a1138175bff1198cfa)
(cherry picked from commit 8974821f7925d07089c29d619b7996714e833aa5)
2023-03-31 08:23:39 +02:00
Yu Watanabe
1ece85e7d4 core/transaction: make merge_unit_ids() always return NUL-terminated string
Follow-up for 924775e8ce49817f96df19c2b06356c12ecfc754.

The loop run with `STRV_FOREACH_PAIR()`, hence `if (*(unit_id+1))` is
not a good way to detect if there exist a next entry.

Fixes #26872.

(cherry picked from commit 366eced4c81a15a25b9225347fa203aa67798b02)
(cherry picked from commit 7002c5c210a7ae3607bd8a424112e9f8789bc5f9)
(cherry picked from commit 89f780969b4436cf766eb9c0d6412362fc85f042)
2023-03-31 08:23:38 +02:00
Yu Watanabe
9feaf857de bootctl: fix wrong type comparison
(cherry picked from commit de2c62e847f3b5b0c0796396086ebdce4e8a9ca4)
(cherry picked from commit dbfd85dc95a004065e0f1f2f14d2b11eab5f1372)
(cherry picked from commit 4a9dc2d190dcf5370fcd13a081fe2bec7247174c)
2023-03-31 08:23:33 +02:00
Dmitry V. Levin
8f250a3ff0 Revert "udev: prepare memory for extra NUL termination for NULSTR"
This reverts commit cd3c8a117ccf3505e49d34324473e2175ef0a9ce which was
papering over the bug instead of a proper fix made by the previous
commit.

(cherry picked from commit 8c499a61c46eb434db04d3ee4b116a0a755b3797)
(cherry picked from commit 56a81351afe89711442058a5b373cafa0288feaf)
(cherry picked from commit e97016b9816896b09bd59ed8ee088fa25538d32a)
2023-03-31 08:23:28 +02:00
Dmitry V. Levin
b36f5dae63 udev-rules: fix matching of token types that support alternative patterns
For those token types that support matching of alternative patterns,
their token values are interpreted as nulstr, so make sure the parser
does the right thing and makes these token values terminated by two
subsequent NULs so they could be safely interpreted as nulstr.

Before this fix, the following rules would result to "echo foo" invocation:
  ENV{foo}=", RUN"
  ENV{foo}=="bar", RUN+="echo foo"
because the value of `ENV{foo}` is treated as nulstr, and it used to match
against alternative patterns, in this case `bar`, `, RUN`, and `="echo foo`.

Fixes: 25de7aa7b90c ("udev: modernize udev-rules.c")
(cherry picked from commit c43ff248f94266cfc93e300a2d3d163ed805e55b)
(cherry picked from commit 88d8ab119df0239e70a5312f1f2c179c7f642dec)
(cherry picked from commit 82e82792de606bee0001adbbfef91e1b788f7b39)
2023-03-31 08:23:23 +02:00
Mike Yuan
cd1d4f65e5 docs: update unit name for sd-tmpfiles-setup
(cherry picked from commit 7d33146dbc1bd727a2923bb2da54856a7cb15fb5)
(cherry picked from commit 7b5b85286f7eacfc60c326e656fb0c17b048f7c2)
(cherry picked from commit 006648448b2413483b4f9baf9439d4dc3a4239df)
2023-03-31 08:23:14 +02:00
Mike Yuan
7dcb586274 unit: sysext: update unit name for sd-tmpfiles-setup
Fixes #26882

(cherry picked from commit 23c4c0340645cc1711d9e5446dcace10104b4491)
(cherry picked from commit f8b6d97185b3f55edee542dce823c1700acdf31a)
(cherry picked from commit ec8613a7b786bb888294971ba80c5f9767564ba5)
2023-03-31 08:23:08 +02:00
Brett Holman
922cdcc6ae network: ipv4acd: update MAC address on change (#26753)
Commit 76a86ffdbee2dd9ef0f2b5338e14eb6ba7671456 added function
ipv4acd_update_mac() but invoked ipv4ll_update_mac(), which doesn't
align with debug or commit messages.

(cherry picked from commit 0a14f83a0edb2c809c932b5d98240dd10a6bb79a)
(cherry picked from commit 59ae2a45a92025097de94cc7c0c622aa990179cf)
(cherry picked from commit 0703aa328c0c405e3771af8078c43fa9d5980860)
2023-03-31 08:23:03 +02:00
Lennart Poettering
01ef1b83d7 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)
(cherry picked from commit b77f041885fa68cc3bfefcae97b6ca76a327c77a)
2023-03-31 08:22:58 +02:00
Chitoku
9c2412ac87 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)
(cherry picked from commit 197ad2e965ad6b1f8bc17e7717736a8007e9583a)
2023-03-31 08:22:48 +02:00
Luca Boccassi
f6bba0b47e core: allow-list char-rtc with ProtectClock=yes only if needed
Allow-listing a device implicitly blocks everything else, so this
has the opposite of the intended effect when PrivateDevices= is
not used.
Allow-list char-rtc only if there is a device policy set.

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

(cherry picked from commit 63857bf4f7a5dd48a2b971d9bae2c06cc829b630)
2023-03-05 23:18:11 +00:00
msizanoen1
11ecf66646 test-escape: Add tests for escaping bogus UTF-8 sequences
(cherry picked from commit 582843ee37fb2de62321085dd3c2f4bfbdbad12e)
(cherry picked from commit c4e7cf2bd734b480c38b16c227a2b4f1928df270)
(cherry picked from commit dec5e2e7b5ae829b8542810c5d44daed3442cb28)
v251.13
2023-03-03 15:40:31 +01:00
msizanoen1
dfa043ae1f 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)
(cherry picked from commit e0a674f7f8ed934eb3b600f09b0ca75a9579293c)
2023-03-03 15:40:26 +01:00
Frantisek Sumsal
085795656a virt: correctly detect QEMU emulated pSeries guests
Resolves: #26629
(cherry picked from commit 8c7a6c742afef9284d5c06fc285cf66306cbce31)
(cherry picked from commit 1a220065740b128476c572541fa6e90bdd5b548f)
(cherry picked from commit 48911dc5ece96de84efe54ff5208e703f86bf30f)
2023-03-03 15:40:22 +01:00
Lennart Poettering
cb4f512f47 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)
(cherry picked from commit 8e6234064d3339f3043d2bc42dd8d493d656f08e)
2023-03-03 15:40:17 +01:00
David Tardon
407726df07 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)
(cherry picked from commit 30eae23c4a061f1a5cf25dcbd9187560c491b92b)
2023-03-03 15:40:10 +01:00
Lennart Poettering
09174303d1 man: add two missing commands to synopsys
(cherry picked from commit aff131775b002ddac74b1c65d849dcd52a02c06d)
(cherry picked from commit dc98d58dd8864d537d38cc78617c0a1bf7385ee8)
(cherry picked from commit 7d3af1ff11d17e4cac02668537e6e59e78fe5fc4)
2023-03-03 15:40:05 +01:00
Yu Watanabe
1a4634b6f4 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)
(cherry picked from commit 22d1f01b052e5f938201340a0279f2013bcf8986)
2023-03-03 15:40:02 +01:00
Yu Watanabe
8be4af4204 sd-event: fix error handling
Follow-up for 6d2326e036ceed30f9ccdb0266713c10a44dcf6c.

(cherry picked from commit 1912f790fee9e0182acd77b77496f500094a140d)
(cherry picked from commit a719c2ec2f410f8b979cec04dcdac9af470ee52b)
(cherry picked from commit dd6561ff3e12314d41954b7ea8e3627101931a18)
2023-03-03 15:39:58 +01:00
Yu Watanabe
ac04d804c3 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)
(cherry picked from commit 78976199b2e016600c3f7cf8f39747c9ef6c853b)
2023-03-03 15:39:57 +01:00
Yu Watanabe
e385eb57dc 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)
(cherry picked from commit 028cee00dd5e37ef94ce11c06d7fdc61dd2a6f47)
2023-03-03 15:39:44 +01:00
Zbigniew Jędrzejewski-Szmek
3339b23f4c 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)
(cherry picked from commit 2ca2390b113dd45305ff131b74ed39b919931417)
2023-03-03 15:39:38 +01:00
Zbigniew Jędrzejewski-Szmek
c68ae31edb 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)
(cherry picked from commit 4f4344e3a5578b76e83633673cbb3ce368ebd2de)
2023-03-03 15:39:21 +01:00
Lennart Poettering
73fd236311 homectl: add missing break
(cherry picked from commit 464ec1dec741e31d7bf08a4b7bb5a64a6adbb81d)
(cherry picked from commit eae11e3f064372ec30efe460381ce807238daa82)
(cherry picked from commit 8af5e945c7d489e7cf4c1dd29612e5452122b754)
2023-03-03 15:38:21 +01:00
Zbigniew Jędrzejewski-Szmek
88302d7f84 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)
(cherry picked from commit e72f1676afe4ceae96583e848d023f1b6ec3d6c4)
2023-03-03 15:38:12 +01:00
Yu Watanabe
bfbd75cf87 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)
(cherry picked from commit 892fe5d2049b1cb25a523c51518fd66a14642974)
2023-03-03 15:37:33 +01:00
Mike Yuan
a90a4560ff 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)
(cherry picked from commit e9889190bea734566e778a60a1dc337e9c7ad18d)
2023-03-03 15:37:27 +01:00
Jan Janssen
2cf90e13f5 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)
(cherry picked from commit ac3d8922df1a08de934fc9d8c81cd0215bcb1633)
2023-03-03 15:36:41 +01:00
Lennart Poettering
292debc981 pid1: generate compat warning for SystemCallArchitectures= if seccomp is off
(cherry picked from commit 6aa2c55522d7cac62ecfd5d5687a86a84f158d18)
(cherry picked from commit 01b90e1588e29888c7583bd320b898b59257d737)
(cherry picked from commit 7c9b9c8d93b57f06ad1974adfa1fc0e94ac7b405)
2023-03-03 15:36:37 +01:00
Yu Watanabe
4647e86922 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)
(cherry picked from commit 6e8d76f776b02eadfa6e4575f516866786fd3817)
2023-03-03 15:36:32 +01:00
Joan Bruguera
5f6a369a6a 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)
(cherry picked from commit 58cbb7a89b1b66be8b593eec29a6413d5ecdb780)
2023-03-03 15:36:21 +01:00
Marcus Schäfer
fa71bb7bce Handle MACHINE_ID=uninitialized
systemd supports /etc/machine-id to be set to: uninitialized
In this case the expectation is that systemd creates a new
machine ID and replaces the value 'uninitialized' with the
effective machine id. In the scope of kernel-install we
should also enforce the creation of a new machine id in this
condition

(cherry picked from commit 305dd91adfde332e7e5c1b2470edb32774f9a032)
(cherry picked from commit 132f0ec7de303538dcdae02175a807fec97712b8)

Backported for https://bugzilla.redhat.com/show_bug.cgi?id=2148464.
2023-03-03 15:36:04 +01:00
Marcus Schäfer
7f18d82308 Fix reading /etc/machine-id in kernel-install (#25388)
The kernel-install script has code to read the contents of
/etc/machine-id into the MACHINE_ID variable. Depending
on the variable content kernel-install either logs the
value or creates a new machine id via 'systemd-id128 new'.
In that logic there is one issue. If the file /etc/machine-id
exists but is empty, the script tries to call read on an
empty file which return with an exit code != 0. As the
script code also uses 'set -e', kernel-install will exit at
this point which is unexpected.

The condition of an empty /etc/machine-id file exists for
example when building OS images, which should initialize the
system id on first boot but not staticly inside of the image.
afaik an empty /etc/machine-id is also a common approach
to make systemd indicate that it should create a new system
id. Because of this, the commit makes sure the reading of
/etc/machine-id does not fail in any case such that the
handling of the MACHINE_ID variable takes place.

(cherry picked from commit 883e7cbfc0dba6c81338e7924419b5cbb0cba0b2)
(cherry picked from commit d34ea410f4bac2bbdf8c9a8ba5b27350b80360c4)

Backported for https://bugzilla.redhat.com/show_bug.cgi?id=2148464.
2023-03-03 15:35:45 +01:00
наб
a1addcf47d shellcheck-clean kernel-install again
(cherry picked from commit 35339eb88c72f30204589101765a0bca5424e253)
2023-03-03 15:31:25 +01:00
Yu Watanabe
f32581ac80 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)
(cherry picked from commit e91a3042747398475b83ba00915f768e578bb9ff)
v251.12
2023-02-16 20:58:20 +00:00
Daan De Meyer
18a2aaf2f6 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)
(cherry picked from commit ef96e60f18c6fd267dc0e942120a95fe25a94960)
2023-02-16 10:46:26 +00:00
ml
067b5b7e89 man: fix directory for user home bind mounts
(cherry picked from commit f39d7d00a31c1867d5fa41b3dd4e6d20665a8f3a)
(cherry picked from commit bfaf02348e1086c9ce2e4503ef03dc75ed4f1afb)
2023-02-16 10:46:26 +00:00
ml
3a44be9ad0 nspawn: fix directory in logged error
(cherry picked from commit 7b03b44ed9f5f748670aa26193274dae94468149)
(cherry picked from commit cad1e9c53d7ce0b8e461c094d6244a6409c80ab6)
2023-02-16 10:46:26 +00:00
Lennart Poettering
bfe6d1d197 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)
(cherry picked from commit c973e2295cdc0fcf63569044ae81e6b93d4f2b4b)
2023-02-13 14:50:14 +00:00