1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-18 06:03:42 +03:00

56006 Commits

Author SHA1 Message Date
Yu Watanabe
40cdad3506 core/mount: downgrade log level about several mkdir failures
(cherry picked from commit 574febda6b0e00aae164b18b70aa80744d950500)
(cherry picked from commit 9f8b7ee55a38ac94fe88e396772efeda8a020693)
2022-11-04 13:02:19 +01:00
Yu Watanabe
f26f995108 Revert "core/mount: fail early if directory cannot be created"
This reverts commit e4de58c8231e47509ffeb3aa47620ca42f22d7f6.

If mkdir() fails and the path does exist, then the later mount
command fails anyway. Hence, it is not necessary to fail here.

Fixes #24120.

(cherry picked from commit e5e6b7c225987551ebda14d2d7feadb66a64fb3c)
(cherry picked from commit b1e494d64ded9b1f4927d41d0165420bf1def996)
2022-11-04 13:02:19 +01:00
Yu Watanabe
f0f5e74b2b home: drop conflicted headers
Fixes #24117.

(cherry picked from commit 0a58cd00454cc7b57b04f3a4a334584d743d7f7a)
(cherry picked from commit 739d7130cb7cfc67e79bd2dbf13856b6a2fc666d)
2022-11-04 13:02:19 +01:00
Yu Watanabe
ed66376b05 homed: fix dbus node enumerator
Fixes #24114.

(cherry picked from commit 52023622d2f8312887fcf72ca29bab4ad42c8eb7)
(cherry picked from commit 834632a4775e72d361a493979fd038f48163f65c)
2022-11-04 13:02:19 +01:00
Lennart Poettering
81bc16ab7c localed: don't fail if we cannot copy an xattr
We ignore xattr copy failures on all other cases, and we should do so
here too.

Fixes: #24106
(cherry picked from commit d3efe29452aeddc395865469b776fe7a1eb45eae)
(cherry picked from commit 200cbc299bddd6f0c896167be8a8be6475d76f20)
2022-11-04 13:02:19 +01:00
Yu Watanabe
8ead3d8e07 udev: downgrade error level and mention that the error is ignored
(cherry picked from commit 6e40ed53257604f81b14ddefadf5a782dc8ad279)
(cherry picked from commit a9dd0f6fc962e9cf00bfd98b056928fc956f78b7)
2022-11-04 13:02:19 +01:00
Rudi Heitbaum
998b08ec5f glibc: Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
(cherry picked from commit 3657d3a01c7e25ff86d7a4642065b367c4ff7484)
(cherry picked from commit 8fe0c121787efe16c2a7a0f27a3d9862d0a12c81)
2022-11-04 13:02:19 +01:00
Yu Watanabe
0e7214c8b5 unit-file: avoid (null) in debugging logs
The variable `inst` was set to NULL by TAKE_PTR().

This fixes the following log message:
```
systemd[1]: Unit getty@tty2.service has alias (null).
```

(cherry picked from commit 7c35b78a0b96085e3d634542212c5521bc2a2f21)
(cherry picked from commit 9ac0ad80fe97c22ec3dc4670e859abaae9a1f8bf)
2022-11-04 13:02:19 +01:00
Zbigniew Jędrzejewski-Szmek
aa97e014fa manager: limit access to private dbus socket
For the system manager, /run/systemd/private is publicly accessible, because
/run/systemd is 0755, and /run/systemd/private is 0777. For the user manager,
/run/user/<uid> is 0700, and /run/user/<uid>/systemd/private is 0777. This
does not directly cause any security issue because we check the sender in
bus_check_peercred (ucred.uid != 0 && ucred.uid != geteuid()).

But it makes sense to limit access to the socket to avoid wasting time in PID1.
Somebody could send messages there that'd we'd reject anyway. It also makes
things more explicit.

(cherry picked from commit df1cbd1adf26071aab41d96e054452a3d66103a4)
(cherry picked from commit dc3333bcc992003607582e4a05ca8699ee9317aa)
2022-11-04 13:02:19 +01:00
Richard Huang
44725ecccd Update sleep.conf HibernateDelaySec default to match implementation
(cherry picked from commit 5f2b4f9cb9555f3beb582e95624418a8277128e9)
(cherry picked from commit 9f3ed4f5ccccd1ab36e099b548a71c5518cd28ba)
2022-11-04 13:02:19 +01:00
David Tardon
1dbe819311 systemctl: include upheld units in dependencies
Fixes: #22706
(cherry picked from commit cbc2593eeaf35a42881319d7fa50b12fc5584bf9)
(cherry picked from commit 8e466d902d56b7a815abc81536a71b92690d8c51)
2022-11-04 13:02:19 +01:00
Vito Caputo
919b10b361 man: fix grammatical error in --cursor-file description
Just a minor cleanup to fix unparseable wording

(cherry picked from commit 729d2df8065ac90ac606e1fff91dc2d588b2795d)
(cherry picked from commit 110d49d15138ff6de17c7d964cd20ac124697c3e)
2022-11-04 13:02:19 +01:00
Frantisek Sumsal
32848f4559 core: drop a stray %m specifier from a warning message
since in this specific case (r == 0) `errno` is irrelevant and most likely
set to zero, leading up to a confusing message:

```
[  120.595085] H systemd[1]: session-5.scope: No PIDs left to attach to the scope's control group, refusing: Success
[  120.595144] H systemd[1]: session-5.scope: Failed with result 'resources'.
```

(cherry picked from commit e99b9285cb289115a64d775c768e6e831e39f12e)
(cherry picked from commit 5c822e33c90bd7f15c44e7375fd0c83ccec54918)
2022-11-04 13:02:19 +01:00
Zbigniew Jędrzejewski-Szmek
c4c647fdb9 man: fix formatting of "BARRIER=1"
Whitespace inside of the <varname> field was propagated to the displayed form,
causing strange indentation.

(cherry picked from commit 9cfc294fe0e2637d96f8e5c29143c10e2173daa3)
(cherry picked from commit b7c5530a1f6874650628cc4771cb99ae353c2495)
2022-11-04 13:02:19 +01:00
lastkrick
c93fb9a57e man: fix typo in systemd.network documentation in IPv6RoutePrefix section (#24030)
(cherry picked from commit 69a7d108327fa5d4b4e8e913441e924b2187cd78)
(cherry picked from commit 7632ff4cccb03893800d36bbf1966f8c20829c9f)
2022-11-04 13:02:19 +01:00
Łukasz Stelmach
217b3e012b core: drop ambient capabilities in user manager
Ambient capabilities should not be passed implicitly to user
services. Dropping them does not affect the permitted and effective sets
which are important for the manager itself to operate.

(cherry picked from commit 963b6b906e5666876f5c90b47600b13ae94d5e4c)
(cherry picked from commit c88309d5cd69d9997cfb74a77e340783a7ac63a9)
2022-11-04 13:02:19 +01:00
Lennart Poettering
d8464304f0 cgroups-agent: connect stdin/stdout/stderr to /dev/null
Inspired by https://github.com/systemd/systemd/pull/24024 this is
another user mode helper, where this might be an issue. hence let's
rather be safe than sorry, and also connect stdin/stdout/stderr
explicitly with /dev/null.

(cherry picked from commit 50492ce81589773df2d82b4fc8047778e86c6edf)
(cherry picked from commit 689487785f776815e71642f89685ff01f0bc4fde)
2022-11-04 13:02:19 +01:00
Daan De Meyer
3e1224d4ac coredump: Connect stdout/stderr to /dev/null before doing anything
When invoked as the coredump handler by the kernel, systemd-coredump's
stdout and stderr streams are closed. This is dangerous as this means
the fd's can get reallocated, leading to hard to debug errors such as
log messages ending up being appended to a compressed coredump file.

To avoid such issues in the future, let's bind stdout/stderr to
/dev/null so the file descriptors can't get used for anything else.

(cherry picked from commit 1f9d2a8199c261593aa6a11df9cce5d31e23c714)
(cherry picked from commit fba50bc0fc5a69e5573ceadb5d6224f365d3c3f5)
2022-11-04 13:02:19 +01:00
Lennart Poettering
7e7a6d60f4 man: explain why various resource limits don't make sense and should not be used.
(cherry picked from commit 8c8889577238749007c9bc129635af7c608723df)
(cherry picked from commit 724d52146abcdc02187d7cc2a12aec5e56300a9b)
2022-11-04 13:02:19 +01:00
Lennart Poettering
e655a7ac7b man: drop misplaced ','
(cherry picked from commit 3840b147818882a0d8e3ad5427c464796bb713f5)
(cherry picked from commit 83203873ee90e943966b36e5d6b4506d2526fa46)
2022-11-04 13:02:19 +01:00
Andre Kalb
a791dc67f8 man/network: ServerAddress= drop "literal" from IP address ranges
(cherry picked from commit 1df6201882607666daec13d7f7c056e8366ef5aa)
(cherry picked from commit 098d70f438661fee40dba45d8f00f2b6415e0d15)
2022-11-04 13:02:18 +01:00
Lennart Poettering
296bd564cc base-filesystem: pick more conservative access mode for /root/
Let's not allow anyone to look into /root/ if we create it via the
base-filesystem logic. i.e. change 0755 → 0750 as default access mode
for /root/, in case we create it if it happens to be missing.

(cherry picked from commit 93cbc9ca12043a13a2a80087a00012e009216f13)
(cherry picked from commit 64be8d8a345424021d837e922679816595d4b9ee)
2022-11-04 13:02:18 +01:00
Lennart Poettering
8b674cf43f tmpfiles: check the directory we were supposed to create, not its parent
This current code checks the wrong directory. This was broken in
4c39d899ff00e90b7290e4985696f321d7f2726f which converted the previous
code incorrectly.

(cherry picked from commit 92631578fff1568fa8e99f96de05baae5b258ffe)
(cherry picked from commit 625472b219a4b1ac64534d38cf6e64b51ab22bbb)
2022-11-04 13:02:18 +01:00
Lennart Poettering
a77b81f124 stat-util: replace is_dir() + is_dir_fd() by single is_dir_full() call
This new call can execute both of the old operations, but also do
generic fstatat() like behaviour.

(cherry picked from commit a586dc791ca465f4087473d2ad6794b7776aee2d)
(cherry picked from commit 9255fa3a15c5c7dea9ddb2ce5399d3b675f8368b)
2022-11-04 13:02:18 +01:00
undef
71e8f6de62 growfs: Expand FS even if underlying block expansion fails
This allows growfs to expand the filesystem even when the underlying
block device cannot be expanded. This has been useful for example on
LUKS devices that have already been expanded using systemd-repart.

This works around the following error:
```
root@mobian:/home/mobian# /usr/lib/systemd/systemd-growfs /
crypt_resize() of /dev/block/179:2 failed: Operation not permitted
```

(cherry picked from commit e9a28b8ccd3352da3e0a75a18fc1185e52476a80)
(cherry picked from commit 378e187ed49d28fed2adfb4848f89aa438854f28)
2022-11-04 13:02:18 +01:00
undef
e39019fd10 growfs: don't actually resize on dry-run
This causes systemd-growfs to exit before resizing the partition when
`--dry-run` is passed. Resizing during a dry run of a change breaks the
users expectations.

(cherry picked from commit d26c0f7243a709cfa7b8bdc87e8131746bb0e2d0)
(cherry picked from commit 00c6c62845c560ef09f845aeedabdc9027be5678)
2022-11-04 13:02:18 +01:00
Yu Watanabe
a6aa5b2f72 sd-bus: do not pass NULL when received message with invalid type
Fixes #24003.

(cherry picked from commit 3f0dbb0f0c4e3c0013fa5fe54441ca7f969555a7)
(cherry picked from commit e56bfc8a417d1877c25b943b75cd73163246fbf2)
2022-11-04 13:02:18 +01:00
Zbigniew Jędrzejewski-Szmek
ca6ee4241a man: lift pam_systemd_homed description to Summary
Also change the title to describe the module more comprehensively.
Follow-up for 90bc309aa2c1430941f4c50f73e681ab3e488bd3. Suggested
in https://bugzilla.redhat.com/show_bug.cgi?id=2085485#c5.

(cherry picked from commit 9e6df034128936895df2d6348eefce61317ebcc2)
(cherry picked from commit a4af8592c66900734d2561b2f6809baaefdbcce8)
2022-11-04 13:02:18 +01:00
Yu Watanabe
bbcc9f2e5b sd-device: send udev database version
Otherwise, sd-device object received through sd-device-monitor does not
show current tags.

Fixes #23799.

(cherry picked from commit 4bc4040bc0a57e8bdd811c53b0db7cd443315f33)
(cherry picked from commit 7f801023432bd4857e3d9633747f5640769c52fa)
2022-11-04 13:02:18 +01:00
Yu Watanabe
665c2f340c sd-device: make device_get_properties_{nulstr,strv}() take NULL for result value
In most cases, it is not necessary to call them without retrieving
result. But, most of other getter functions for sd-device can take NULL.
Let's follow the way for consistency.

(cherry picked from commit 793ab3e9dd733d743e1d3825a26ff65384ac3cbb)
(cherry picked from commit 925cff4a15022b3452eab289b8631675e0e755e8)
2022-11-04 13:02:18 +01:00
Yu Watanabe
05763bb446 sd-device: change type of properties nulstr from uint8_t* to char*
(cherry picked from commit cff31876dabdfdc0d70c0b72917d6b66ab973a54)
(cherry picked from commit 0ecda6fdf065286007e873b8d3d0a27b127a2c9a)
2022-11-04 13:02:18 +01:00
Lennart Poettering
922e717ee9 man: explain why pam_systemd_home wants to be in all four stacks
Suggested here:

https://bugzilla.redhat.com/show_bug.cgi?id=2085485#c5
(cherry picked from commit 90bc309aa2c1430941f4c50f73e681ab3e488bd3)
(cherry picked from commit 69de3e810a7e7996bc757faa5e8b1e2e982f117e)
2022-11-04 13:02:18 +01:00
Michael Biebl
885e4e531b Do not fail EFI build with newer binutils
Newer binutils versions currently trigger the following warnings due to
a bug in gnu-efi

on arm64:
/usr/bin/ld.bfd: warning: src/boot/efi/systemd-bootaa64.elf has a LOAD segment with RWX permissions

on amd64:
/usr/bin/ld.bfd: warning: /usr/lib/crt0-efi-x86_64.o: missing .note.GNU-stack section implies executable stack

This results in a build failure due to --fatal-warnings.
Work around this issue by suppressing those warnings until gnu-efi has
been fixed.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1013341

(cherry picked from commit b0e5bf0451a6bc94e6e7b2a1de668b75c63f38c8)
(cherry picked from commit 8a6f966be404897b5333c218701965ac3b5a0806)
2022-11-04 13:02:18 +01:00
Martin Wilck
a96ef943b4 core/device: device_coldplug(): don't set DEVICE_DEAD
dm-crypt device units generated by systemd-cryptsetup-generator
habe BindsTo= dependencies on their backend devices. The dm-crypt
devices have the db_persist flag set, and thus survive the udev db
cleanup while switching root. But backend devices usually don't survive.
These devices are neither mounted nor used for swap, thus they will
seen as DEVICE_NOT_FOUND after switching root.

The BindsTo dependency will cause systemd to schedule a stop
job for the dm-crypt device, breaking boot:

[   68.929457] krypton systemd[1]: systemd-cryptsetup@cr_root.service: Unit is stopped because bound to inactive unit dev-disk-by\x2duuid-3bf91f73\x2d1ee8\x2d4cfc\x2d9048\x2d93ba349b786d.device.
[   68.945660] krypton systemd[1]: systemd-cryptsetup@cr_root.service: Trying to enqueue job systemd-cryptsetup@cr_root.service/stop/replace
[   69.473459] krypton systemd[1]: systemd-cryptsetup@cr_root.service: Installed new job systemd-cryptsetup@cr_root.service/stop as 343

Avoid this by not setting the state of the backend devices to
DEVICE_DEAD.

Fixes the LUKS setup issue reported in #23429.

(cherry picked from commit cf1ac0cfe44997747b0f857a1d0b67cea1298272)
(cherry picked from commit 4f86dd28499cf3f7338dc3368d18eccbb126b4a9)
2022-11-04 13:02:18 +01:00
Nick Rosbrook
608264bb63 pstore: do not try to load all known pstore modules
Commit 70e74a5997 ("pstore: Run after modules are loaded") added After=
and Wants= entries for all known kernel modules providing a pstore.

While adding these dependencies on systems where one of the modules is
not present, or not configured, should not have a real affect on the
system, it can produce annoying error messages in the kernel log. E.g.
"mtd device must be supplied (device name is empty)" when the mtdpstore
module is not configured correctly.

Since dependencies cannot be removed with drop-ins, if a distro wants to
remove some of these modules from systemd-pstore.service, they need to
patch units/systemd-pstore.service.in. On the other hand, if they want
to append to the dependencies this can be done by shipping a drop-in.

Since the original intent of the previous commit was to fix [1], which
only requires the efi_pstore module, remove all other kernel module
dependencies from systemd-pstore.service, and let distros ship drop-ins
to add dependencies if needed.

[1] https://github.com/systemd/systemd/issues/18540

(cherry picked from commit 8b8bd621e1d16808678fc3afed257df1fa03a281)
2022-11-03 16:38:28 +01:00
Alexander Graf
60a239c54e pstore: Run after modules are loaded
The systemd-pstore service takes pstore files on boot and transfers them
to disk. It only does it once on boot and only if it finds any. The typical
location of the pstore on modern systems is the UEFI variable store.

Most distributions ship with CONFIG_EFI_VARS_PSTORE=m. That means, the
UEFI variable store is only available on boot after the respective module
is loaded.

In most situations, the pstore service gets loaded before the UEFI pstore,
so we don't get to transfer logs. Instead, they accumulate, filling up the
pstore over time, potentially breaking the UEFI variable store.

Let's add a service dependency on any kernel module that can provide a
pstore to ensure we only scan for pstate after we can actually see pstate.

I have seen live occurences of systems breaking because we did not erase
the pstates and ran out of UEFI nvram space.

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

(cherry picked from commit 70e74a5997ae2ce7ba72a74ac949c3b2dad1a1d6)
2022-11-03 16:38:28 +01:00
Yu Watanabe
b927b303c1 core/device: do not downgrade device state if it is already enumerated
On switching root, a device may have a persistent databse. In that case,
Device.enumerated_found may have DEVICE_FOUND_UDEV flag, and it is not
necessary to downgrade the Device.deserialized_found and
Device.deserialized_state. Otherwise, the state of the device unit may
be changed plugged -> dead -> plugged, if the device has not been mounted.

Fixes #23429.

[mwilck: cherry-picked from #23437]

(cherry picked from commit 4fc69e8a0949c2537019466f839d9b7aee5628c9)
(cherry picked from commit 131206de786cd5c4d82d7a49ec1f6e562775022d)
2022-09-30 16:56:18 +02:00
Yu Watanabe
c2939963fe core/device: ignore DEVICE_FOUND_UDEV bit on switching root
The issue #12953 is caused by the following:
On switching root,
- deserialized_found == DEVICE_FOUND_UDEV | DEVICE_FOUND_MOUNT,
- deserialized_state == DEVICE_PLUGGED,
- enumerated_found == DEVICE_FOUND_MOUNT,
On switching root, most devices are not found by the enumeration process.
Hence, the device state is set to plugged by device_coldplug(), and then
changed to the dead state in device_catchup(). So the corresponding
mount point is unmounted. Later when the device is processed by udevd, it
will be changed to plugged state again.

The issue #23208 is caused by the fact that generated udev database in
initramfs and the main system are often different.

So, the two issues have the same root; we should not honor
DEVICE_FOUND_UDEV bit in the deserialized_found on switching root.

This partially reverts c6e892bc0eebe1d42c282bd2d8bae149fbeba85f.

Fixes #12953 and #23208.
Replaces #23215.

Co-authored-by: Martin Wilck <mwilck@suse.com>
(cherry picked from commit 75d7b5989f99125e52d5c0e5656fa1cd0fae2405)
2022-09-30 16:56:18 +02:00
Yu Watanabe
b16a4d45eb sd-device: make sd_device_get_is_initialized() not return -ENOENT
(cherry picked from commit 591c186f2fc11523e098fbb09b3c1f0a07d49ca4)
(cherry picked from commit d36b2af98783cafb2789473c2ea2cce3ce055ebc)
v250.8
2022-07-13 13:30:45 +02:00
Yu Watanabe
b791f05992 resolve: introduce FORMAT_DNS_RCODE() macro
Fixes #23958.

(cherry picked from commit 0d609349ba7e4df07c548c1cfe5127b431de7554)
(cherry picked from commit a03ea9798afa4f2c757c2a2556f735b6aa600c99)
2022-07-13 13:30:45 +02:00
Yu Watanabe
3f909ca95a sd-dhcp-client: fix log message
(cherry picked from commit 3857d367f0028dd5480498ba5d3507866c7f294e)
(cherry picked from commit d56649142b01652976b6ee647f51fa25f4227542)
2022-07-13 13:30:45 +02:00
Yu Watanabe
45944e44a7 network: drop redundant warning
If file is world readable, then `read_full_file_full()` will warn
about that.

(cherry picked from commit d5ad2ec1d409e983cc8727f343137bfb8615a57d)
(cherry picked from commit c87c7e723193d6a19f0d8c195296b6f00eeb3b55)
2022-07-13 13:30:45 +02:00
Yu Watanabe
e2335238d9 core/load-fragment: fix error value in log_syntax()
`extract_first_word()` may return positive value on success.

(cherry picked from commit 6a35d52d786137f8f955d41dbc505a818169d904)
(cherry picked from commit 900af2155833107e502feade072694b402aa831e)
2022-07-13 13:30:45 +02:00
Yu Watanabe
79d9afd3d6 resolve: fix possible integer overflow
(cherry picked from commit 370999c05bd21b18056686dfb27f999acda7c0b6)
(cherry picked from commit b7fc4ffe9747b7a967b43cbff5a96286976946ee)
2022-07-13 13:30:45 +02:00
Yu Watanabe
63c0ce2346 resolve: fix heap-buffer-overflow reported by ASAN with strict_string_checks=1
Fixes #23942.

(cherry picked from commit beeab352de413e1c04de0a67ee36525fcf6e99dd)
(cherry picked from commit feb244676baa246e660b713544c2cb8766c25b34)
2022-07-13 13:30:45 +02:00
Yu Watanabe
c32530f5bd time-util: fix buffer-over-run
Fixes #23928.

(cherry picked from commit 9102c625a673a3246d7e73d8737f3494446bad4e)
(cherry picked from commit 72d4c15a946d20143cd4c6783c802124bc894dc7)
2022-07-13 13:30:45 +02:00
Lennart Poettering
9e9d8b8ef7 tmpfiles: correct error variable to use
(cherry picked from commit 149e0ca6c77692b82a9e4602ca4ffb7108346379)
(cherry picked from commit 9e73f919abad4166214c704bbd2cde9ea0e5614b)
2022-07-13 13:30:45 +02:00
Lennart Poettering
859f107020 namespace: fix propagated error number
(cherry picked from commit 1ce268c7892be2221bec6bf5ef795a82df92e48f)
(cherry picked from commit c377dc4832083dfd7bd42fc9fbad9f0e0e7a8bf8)
2022-07-13 13:30:45 +02:00
Lennart Poettering
2317d49cfb man: "enabled commands are started at boot" is rubbish
it's enabled units, and they might be started by various forms of
activation, not just "at boot".

Fix that.

(cherry picked from commit 0c772b1cc1f08bee260addbecb8adc6cdf4ddeef)
(cherry picked from commit 81d33ab7f60a5fe672f3869d97bf4e007aa49510)
2022-07-13 13:30:44 +02:00
Lennart Poettering
84715375d5 json: actually use numeric C locale we just allocated
This fixes formatting of JSON real values, and uses C locale for them.
It's kinda interesting that this wasn't noticed before: the C locale
object we allocated was not used, hence doing the dance had zero effect.

This makes "test-varlink" pass again on systems with non-C locale.

(My guess: noone noticed this because "long double" was used before by
the JSON code and that had no locale supporting printer or so?)

(cherry picked from commit 93258c7d72fae23c9f8103c98dd0e79a24838e26)
(cherry picked from commit 2e6e30a92f5a36f84cf068f2b3c31ced7d7a9865)
2022-07-13 13:30:44 +02:00