1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-31 05:47:30 +03:00

74882 Commits

Author SHA1 Message Date
Yu Watanabe
69a95d442f core/device: ignore ID_PROCESSING udev property on enumerate
This partially reverts the commit 405be62f05d76f1845f347737b5972158c79dd3e
"tree-wide: refuse enumerated device with ID_PROCESSING=1".

Otherwise, when systemd-udev-trigger.service is (re)started just before
daemon-reexec, which can be easily happen on systemd package update, then
udev database files for many devices may have ID_PROCESSING=1 property,
thus devices may not be enumerated on daemon-reexec. That causes many
units especially mount units being deactivated after daemon-reexec.

Fixes #35329.

(cherry picked from commit c4fc22c4defc5983e53f4ce048e15ea7d31e6a75)
2024-11-29 14:26:56 +01:00
Yu Watanabe
ce997e944f curl-util: do not configure new io event source when the event loop is already dead
Similar to c5ecf0949460dd0bf3211db128a385ce6375252e, but for io event source.

Fixes #35322.

(cherry picked from commit 5b2926d9414f4333153ebe0bf169e1dd76129119)
2024-11-29 14:26:56 +01:00
Lennart Poettering
95c20d0b62 nspawn: improve log message on bad incoming sd_notify() message
It's the PID that is wrong, not the UID/GID, be precise.

(cherry picked from commit 95116bdfd5d45cc1a7c6588e6b8bdcb0d0e007a6)
2024-11-29 14:26:56 +01:00
Yu Watanabe
b30364a037 shutdown: close DM block device before issuing DM_DEV_REMOVE ioctl
Otherwise, the ioctl() may fail with EBUSY.

Follow-up for b4b66b26620bfaf5818c95d5cffafd85207694e7.
Hopefully fixes #35243.

(cherry picked from commit b76730f3fe0e824db001b38c8ea848302be786ee)
2024-11-29 14:26:56 +01:00
Zbigniew Jędrzejewski-Szmek
eb841e9b8e Undeprecate commandline params forcequotacheck, fastboot, and forcefsck
Those are historical names, but there is nothing wrong with them. The files on
/ (/fastboot, /forcefsck, and /forcequotacheck) are problematic because they
require a modification of the root file system. But the commandline params work
fine. They have the obvious advantage compared to our "modern" option that they
are much easier to type without looking up the spelling in the docs. Undeprecate
them to avoid unnecessary churn.

(cherry picked from commit 5598454a3f8fc13257e0313d999e6ac9684082e1)
2024-11-29 14:26:56 +01:00
Lennart Poettering
3d85366ab8 userdbctl: fix counting
Fixes: #35294
(cherry picked from commit 7f8a4f12dfea6f644f92788bd9b03983898e9d32)
2024-11-29 14:26:56 +01:00
Lennart Poettering
aed4e90456 userbdctl: show 'mapped' user range only inside of userns
Outside of userns the concept makes no sense, there cannot be users
mapped from further outside.

(cherry picked from commit e412fc5e042b8f642bcba42f5c175124583e05ae)
2024-11-29 14:26:56 +01:00
Lennart Poettering
ddcc0bc151 cryptenroll: it's called PKCS#11, not PKCS11
In the --help text we really should use the official spelling, just like
in the man page.

(cherry picked from commit cc6baba7200bd8171b6beff446b4009dad5c4230)
2024-11-29 14:26:56 +01:00
Yu Watanabe
6dcb53ba0a core/service: service_add_fd_store() consumes passed fd
Without this change, the fd is closed twice on failure.

Fixes a bug introduced by dff9808a628c31b7ecb1f1aba8fdc3be06ce8372.

Fixes #35288.

(cherry picked from commit d99198819caeff6f40a0a520364e59b8a0cbaa4f)
2024-11-29 14:26:56 +01:00
Lennart Poettering
38e0f618ee killall: gracefully handle processes inserted into containers via nsenter -a
"nsenter -a" doesn't migrate the specified process into the target
cgroup (it really should). Thus the cgroup will remain in a cgroup
that is (due to cgroup ns) outside our visibility. The kernel will
report the cgroup path of such cgroups as starting with "/../". Detect
that and print a reasonably error message instead of trying to resolve
that.

(cherry picked from commit f6793bbcf0e3f0a6daa77add96183b88d5ec2117)
2024-11-28 15:11:07 +01:00
Mike Yuan
3808937ff6 core/exec-invoke: suppress placeholder home only in build_environment()
Currently, get_fixed_user() employs USER_CREDS_SUPPRESS_PLACEHOLDER,
meaning home path is set to NULL if it's empty or root. However,
the path is also used for applying WorkingDirectory=~, and we'd
spuriously use the invoking user's home as fallback even if
User= is changed in that case.

Let's instead delegate such suppression to build_environment(),
so that home is proper initialized for usage at other steps.
shell doesn't actually suffer from such problem, but it's changed
too for consistency.

Alternative to #34789

(cherry picked from commit b718b86e1b8477f58461f3c456c944abb1428c0f)
2024-11-28 15:08:36 +01:00
Mike Yuan
e70064370d core/exec-invoke: minor cleanup for apply_working_directory() error handling
Assign exit_status at the same site where error log is emitted,
for readability.

(cherry picked from commit d911778877c18827c64e21cc98e86c31dff9a627)
2024-11-28 15:08:34 +01:00
Mike Yuan
c6721db367 basic/user-util: split out placeholder suppression from USER_CREDS_CLEAN into its own flag
No functional change, preparation for later commits.

(cherry picked from commit eea9d3eb106a91d4479d859603463bdfe3d262eb)
2024-11-28 15:08:33 +01:00
Mike Yuan
3a8d7a83ff basic/user-util: introduce shell_is_placeholder() helper
(cherry picked from commit 579ce77ead476e3d5b9a774ab00ec3ec53933ab2)
2024-11-28 15:08:25 +01:00
Luca Boccassi
fec28cb4f9 units: add initrd directory to list of conditions for systemd-confext
systemd-sysext has the same check, but it was forgotten for confexts.
Needed to activate confexts from the ESP in the initrd.

(cherry picked from commit fe077a1a582a43a6378ff29452a373cc7d393764)
2024-11-28 15:06:21 +01:00
Antonio Alvarez Feijoo
03b993a9bf man/kernel-command-line: fix typo
(cherry picked from commit a04d42821bb5350b0ffa82834e50e9b679279854)
2024-11-28 15:05:52 +01:00
Yu Watanabe
7bb3040cc4 ndisc-option: use memcpy_safe() at one more place
As 'len' may be 8.

Follow-up for a163404cc88914142ef8bbfaab0eb39d1a990c02.

(cherry picked from commit c8ddd5ff72453876b360e7580cc386945b79f5e9)
2024-11-28 15:04:56 +01:00
Antonio Alvarez Feijoo
4a3d55a032 cryptenroll: show better log message if slot to wipe does not exist
```
$ systemd-cryptenroll /dev/vda3
SLOT TYPE
   0 password
$ systemd-cryptenroll --wipe-slot 1 /dev/vda3
Failed to wipe slot 1, continuing: No such file or directory
```

(cherry picked from commit 2b251491debf9cab695f5f34da9908ca46f085fe)
2024-11-28 15:04:47 +01:00
Mantas Mikulėnas
1877797299 ssh-generator: silence "Binding to socket" messages
(cherry picked from commit 2424a67c02913eac30b5d59f1e5ee39a846ca54b)
2024-11-28 15:04:37 +01:00
Lennart Poettering
ff4b66be4a systemctl: grey out tasks limit the same way we grey out the fd store limit in the output
"systemctl status systemd-logind" otherwise looks a bit weird, since the
tasks and the fdstore lines are so close to each other but formatted
quite differently when it comes to coloring.

(cherry picked from commit 54646b1ca95373dfa3ebe5d6e7e27deeed9e77b0)
2024-11-28 15:03:05 +01:00
Lennart Poettering
bdf3f9b8f2 nspawn: --private-users-ownership= value is called 'chown', not 'own'
(cherry picked from commit bae936b418e08063b68c95f4df53c3cd4f70e881)
2024-11-28 15:00:40 +01:00
Lennart Poettering
cf7b3cc182 pid1: make clear that $WATCHDOG_USEC is set for the shutdown binary, noone else
We use the $WATCHDOG_USEC variable for two very closely uses: as part of
the sd_watchdog_enabled() protocol for implementing service watchdogs.
And as part of the protocol between the service manager and
systemd-shutdown across the PID 1 execve() transition during shutdown.

Apparently some exitrds tools got confused by the latter use. Let's
address that by setting $WATCHDOG_PID to 1, in accordance to the
sd_watchdog_enabled() protocol to make clear this is only intended for
PID 1 and nothing else.

Replaces: #35135
(cherry picked from commit 4b20ae9a0e914e61d6bac095e5fc9664510ac03e)
2024-11-28 15:00:30 +01:00
Daan De Meyer
80462e5dfe Add proper dependencies to ukify target
Also remove the systemd-measure dependency from the mkosi target as
mkosi doesn't invoke systemd-measure itself.

(cherry picked from commit 1a077e05fbcbfffe548ef39f45e4f2ca1399715d)
2024-11-28 15:00:17 +01:00
Luca Boccassi
a2240d1cf9 meson: bump version to 256.8 v256.8 2024-11-14 18:11:30 +00:00
Luca Boccassi
d8ec2770b7 test: skip TEST-84-STORAGETM if running with bugged libnvme
libnvme 1.11 appears to require a kernel built with NVME TLS
kconfigs, and fails hard if it is not, as the expected
privileged keyring '.nvme' is not present. We cannot just
create it from userspace, as privileged keyrings can only
be created by the kernel itself (those starting with '.').

Skip the test if the library exactly matches this version.

https://github.com/linux-nvme/nvme-cli/issues/2573

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

(cherry picked from commit 893aa45886ef84b1827445dc438e410ad89fbbbf)
2024-11-14 18:10:26 +00:00
Yu Watanabe
04ee5e25a1 nspawn: ignore failure in creating /dev/net/tun when --private-network is unspecified
Follow-up for efedb6b0f3cff37950112fd37cb750c16d599bc7.
Closes #35116.

(cherry picked from commit 985ea98e7f90c92fcc0b8441fafb190353d2feb8)
Really rewritten from scratch.
2024-11-14 17:07:30 +01:00
Yu Watanabe
56cc8acf45 network-generator: drop wrong warning for rd.peerdns without value
(cherry picked from commit 2a774f064815573efc33d43dfe3548590e42e9c2)
2024-11-14 13:12:13 +00:00
Yu Watanabe
74f85451cb network-generator: ignore kernel command line without value
And drop duplicated log messages.

(cherry picked from commit 551b21eb0a5ea691d7bce0aff6b1281dd1f98819)
2024-11-14 13:12:13 +00:00
Yu Watanabe
4cd435ca49 network-generator: parse vlan ID from vlan interface name
Fixes #33954.

(cherry picked from commit e31a55edf136e777aabdf19894ee886eac47c20e)
2024-11-14 13:12:13 +00:00
Yu Watanabe
209eaef60f network-generator: allow to create bridge or friends without slave interfaces
(cherry picked from commit c40ef3f8ff3fd212b88aa84b9e17d1d49aca4ddb)
2024-11-14 13:12:13 +00:00
Yu Watanabe
f3baba9442 network-generator: vlan= can be specified multiple times
(cherry picked from commit 9eee6b1b3f00d46459eebefb70be50ea6af30ddb)
2024-11-14 13:12:13 +00:00
Lennart Poettering
dbf933478f shutdown: replace unbounded fsync() with bounded sync_with_progress()
Let's put a time-out on this syncing.

Inspired-by: #34289 #34283
(cherry picked from commit b4b66b26620bfaf5818c95d5cffafd85207694e7)
2024-11-14 13:12:13 +00:00
Lennart Poettering
05df6c3419 shutdown: teach sync_with_progress() to optionally sync a specific fd only
This is preparation for reusing the logic for syncing DM and other
devices with a timeout applied.

(cherry picked from commit 13b5225d6278af15e84ebd1889f04cfe81b47787)
2024-11-14 13:12:13 +00:00
Mike Yuan
489cf962ad shutdown: clean up sync_with_progress a bit
Also, ignore the error on caller's side.

(cherry picked from commit 758760a3610e3c6674de8a1d51b12b991eafef7c)
2024-11-14 13:12:13 +00:00
andre4ik3
a9d9db7f4e boot: allocate cleanup pages below 4GiB only on x86
Outside of x86, some machines (e.g. Apple silicon, AMD Opteron A1100) have
physical memory mapped above 4GiB, meaning this allocation will fail, causing
the entire boot process to fail on these machines.

This commit makes it so that the below-4GB address space allocation requirement
is only set on x86 platforms, and not on other platforms (that don't have the
specific Linux x86 boot protocol), thereby fixing boot on those that have no
memory mapped below 4GiB in their address space.

Tested on an Apple silicon M1 laptop and an AMD x86_64 desktop tower.

Fixes: #35026

Manual backport of 6e207b370e91e681efb08c497a6c8ad78e3c8d83.
2024-11-14 13:12:13 +00:00
Mike Yuan
018c7fb18a portable: do not use SYNTHETIC_ERRNO for sd_bus_error_set_errno()
The concept of synthetic errnos is about logging, which
is irrelevant irt bus error and we don't do any special
treatment in sd-bus for them, meaning the value propagated
would be spurious.

(cherry picked from commit 2f2058da0b88535cb3a95fc98e7b2f1ae4d35601)
2024-11-14 13:12:13 +00:00
Luca Boccassi
7e36a73e2e hwdb: update to main@{2024-11-12}
git restore -s origin/main hwdb.d/ test/hwdb.d
2024-11-13 19:48:10 +00:00
Luca Boccassi
cdaf50e71d mkosi: update opensuse commit reference
It was force-pushed again

(cherry picked from commit 3034dc001394bba6d94d16a2a9c7a8cefd53035e)
2024-11-13 19:48:10 +00:00
Luca Boccassi
d7ced5c3e0 mkosi: update opensuse commit reference and switch branch
'factory' was reset to 8 years ago

(cherry picked from commit 77579c66ef4b8aec1e723f9ed6c63efd10fb2688)
2024-11-13 19:48:10 +00:00
Yu Watanabe
c479007d18 TEST-17-UDEV: check if udev database file is removed on remove event
(cherry picked from commit 49c46fbaf15b95a8264d01213539914e15fdc6fe)
2024-11-13 19:48:10 +00:00
Yu Watanabe
b2ce8fa2f1 udev: do not re-create database on remove event
Fixes a bug introduced by f6bda694f908cc227b002570b893029aa4c9e173 (v256).

With the offending commit, on remove event, database file for a device is once
removed in event_execute_rules_on_remove(), but later re-created here.
This fixes the issue, and makes the database file not re-created on remove event.

(cherry picked from commit 5b2dce150d5eadcd33d620e095c9c1e2de51dd24)
2024-11-13 19:48:10 +00:00
Yu Watanabe
dc44fd69b0 core/namespace: honor MountEntry.read_only, .options, and so on in static entries
Otherwise, ProtectHome=tmpfs makes /home/ and friends not read-only.
Also, mount options for /run/ specified in MountAPIVFS=yes are not
applied.

The function append_static_mounts() was introduced in
5327c910d2fc1ae91bd0b891be92b30379c7467b, but at that time, there were
neither .read_only nor .options in the struct. But, when later the
struct is extended, the function was not updated and they were not
copied from the static table.
The fields has been used in static tables since
e4da7d8c796a1fd11ecfa80fb8a48eac9e823f06, and also in
94293d65cd4125347e21b3e423d0e245226b1be2.

Fixes #34825.

(cherry picked from commit 0cc496b2d21f73d0a03414ce40eceb9e3af76e22)
2024-11-13 19:48:10 +00:00
Yu Watanabe
3093ac05ab network/tunnel: allow Local=/Remote=any for all tunnel types
It seems there is no restriction for local and remote addresses.

Fixes #34930.

(cherry picked from commit 5e48fd0506ed6212c9db2276d5845ab77aa9bce4)
2024-11-13 19:48:10 +00:00
Štěpán Němec
1bc1a5ea7e man/systemd.special: fix a typo
(cherry picked from commit 62ec4798f28ccf02926c2ae53d2a772b088383ee)
2024-11-13 19:48:10 +00:00
Štěpán Němec
a07693cda5 man: fix incorrect volume numbers in internal man page references
Some ambiguity (e.g., same-named man pages in multiple volumes)
makes it impossible to fully automate this, but the following
Python snippet (run inside the man/ directory of the systemd repo)
helped to generate the sed command lines (which were subsequently
manually reviewed, run and the false positives reverted):

from pathlib import Path

import lxml
from lxml import etree as ET

man2vol: dict[str, str] = {}
man2citerefs: dict[str, list] = {}

for file in Path(".").glob("*.xml"):
    tree = ET.parse(file, lxml.etree.XMLParser(recover=True))
    meta = tree.find("refmeta")
    if meta is not None:
        title = meta.findtext("refentrytitle")
        if title is not None:
            vol = meta.findtext("manvolnum")
            if vol is not None:
                man2vol[title] = vol
            citerefs = list(tree.iter("citerefentry"))
            if citerefs:
                man2citerefs[title] = citerefs

for man, refs in man2citerefs.items():
    for ref in refs:
        title = ref.findtext("refentrytitle")
        if title is not None:
            has = ref.findtext("manvolnum")
            try:
                should_have = man2vol[title]
            except KeyError:  # Non-systemd man page reference?  Ignore.
                continue
            if has != should_have:
                print(
                    f"sed -i '\\|<citerefentry><refentrytitle>{title}"
                    f"</refentrytitle><manvolnum>{has}</manvolnum>"
                    f"</citerefentry>|s|<manvolnum>{has}</manvolnum>|"
                    f"<manvolnum>{should_have}</manvolnum>|' {man}.xml"
                )

(cherry picked from commit 597c6cc1195a986e8f89921aa89505b0eacf8181)
2024-11-13 19:48:10 +00:00
12paper
c89c5d04f3 login: fix session_kill(..., KILL_LEADER,...) (#35105)
`loginctl kill-session --kill-whom=leader <N>` (or the D-Bus equivalent)
doesn't work because logind ends up calling `KillUnit(..., "main", ...)`
on a scope unit and these don't have a `MainPID` property. Here, I just
make it send a signal to the `Leader` directly.

(cherry picked from commit 8254755091847105c33e473c62cdc7621ed275bc)
2024-11-13 19:48:10 +00:00
Lidong Zhong
688eb20fdb udev: skipping empty udev rules file while collecting the stats
To keep align with the logic used in udev_rules_parse_file(), we also
should skip the empty udev rules file while collecting the stats during
manager reload. Otherwise all udev rules files will be parsed again whenever
reloading udev manager with an empty udev rules file. It's time consuming
and the following uevents will fail with timeout.

(cherry picked from commit 2ae79a31b7c7947e2c16e18eb85ac5607ebc40b6)
2024-11-13 19:48:10 +00:00
Zbigniew Jędrzejewski-Szmek
4cafd1a21f man: drop whitespace from final <programlisting> lines
In the troff output, this doesn't seem to make any difference. But in the
html output, the whitespace is sometimes preserved, creating an additional
gap before the following content. Drop it everywhere to avoid this.

(cherry picked from commit fe45f8dc9bf1e9be8de4e14838bc2d7befcf946b)
2024-11-13 19:48:10 +00:00
Luca Boccassi
53c85fc3c5 docs: add reminder to run update-man-rules before tagging a release
(cherry picked from commit 088793239ebc9c3a26c562be82dd5f4467162b26)
2024-11-13 19:48:10 +00:00
Luca Boccassi
42d32c0505 docs: remove 'v' prefix from meson.version
It is actually v-less

(cherry picked from commit 94a46c20dacd8859a6fa3f807b0d134f800a1e90)
2024-11-13 19:48:10 +00:00