1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00
Commit Graph

74906 Commits

Author SHA1 Message Date
Yu Watanabe
56cc8acf45 network-generator: drop wrong warning for rd.peerdns without value
(cherry picked from commit 2a774f0648)
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 551b21eb0a)
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 e31a55edf1)
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 c40ef3f8ff)
2024-11-14 13:12:13 +00:00
Yu Watanabe
f3baba9442 network-generator: vlan= can be specified multiple times
(cherry picked from commit 9eee6b1b3f)
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 b4b66b2662)
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 13b5225d62)
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 758760a361)
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 6e207b370e.
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 2f2058da0b)
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 3034dc0013)
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 77579c66ef)
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 49c46fbaf1)
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 f6bda694f9 (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 5b2dce150d)
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
5327c910d2, 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
e4da7d8c79, and also in
94293d65cd.

Fixes #34825.

(cherry picked from commit 0cc496b2d2)
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 5e48fd0506)
2024-11-13 19:48:10 +00:00
Štěpán Němec
1bc1a5ea7e man/systemd.special: fix a typo
(cherry picked from commit 62ec4798f2)
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 597c6cc119)
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 8254755091)
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 2ae79a31b7)
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 fe45f8dc9b)
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 088793239e)
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 94a46c20da)
2024-11-13 19:48:10 +00:00
Zbigniew Jędrzejewski-Szmek
9ab93761c1 pid1: stop refusing to boot with cgroup v1
Since v256 we completely fail to boot if v1 is configured. Fedora 41 was just
released with v256.7 and this is probably the first major exposure of users to
this code. It turns out not work very well. Fedora switched to v2 as default in
F31 (2019) and at that time some people added configuration to use v1 either
because of Docker or for other reasons. But it's been long enough ago that
people don't remember this and are now very unhappy when the system refuses to
boot after an upgrade.

Refusing to boot is also unnecessarilly punishing to users. For machines that
are used remotely, this could mean somebody needs to physically access the
machine. For other users, the machine might be the only way to access the net
and help, and people might not know how to set kernel parameters without some
docs. And because this is in systemd, after an upgrade all boot choices are
affected, and it's not possible to e.g. select an older kernel for boot. And
crashing the machine doesn't really serve our goal either: we were giving a
hint how to continue using v1 and nothing else.

If the new override is configured, warn and immediately boot to v1.
If v1 is configured w/o the override, warn and wait 30 s and boot to v2.
Also give a hint how to switch to v2.

https://bugzilla.redhat.com/show_bug.cgi?id=2323323
https://bugzilla.redhat.com/show_bug.cgi?id=2323345
https://bugzilla.redhat.com/show_bug.cgi?id=2322467
https://www.reddit.com/r/Fedora/comments/1gfcyw9/refusing_to_run_under_cgroup_01_sy_specified_on/

The advice is to set systemd.unified_cgroup_hierarchy=1 (instead of removing
systemd.unified_cgroup_hierarchy=0). I think this is easier to convey. Users
who are understand what is going on can just remove the option instead.

The caching is dropped in cg_is_legacy_wanted(). It turns out that the
order in which those functions are called during early setup is very fragile.
If cg_is_legacy_wanted() is called before we have set up the v2 hierarchy,
we incorrectly cache a true answer. The function is called just a handful
of times at most, so we don't really need to cache the response.

(cherry picked from commit d0ab0e5fa5)
2024-11-13 19:48:10 +00:00
Yu Watanabe
4d574b106f man/udev: fix typo
Follow-up for df8f9b88bd.

(cherry picked from commit 9dcf5c226e)
2024-11-13 19:48:10 +00:00
Lennart Poettering
d4d7aa60e1 man: convert multiple left-over "See Also" sections to <simplelist>
These were forgotten during the initial conversion, probably because
most of them consisted only of a single entry.

Fix that.

(cherry picked from commit df8f9b88bd)
2024-11-13 19:48:10 +00:00
Lennart Poettering
d9ab18e747 man: link up D-Bus API docs from daemon man pages
Let's systematically make sure that we link up the D-Bus interfaces from
the daemon man pages once in prose and once in short form at the bottom
("See Also"), for all daemons.

Also, add reverse links at the bottom of the D-Bus API docs.

Fixes: #34996
(cherry picked from commit 607d297487)
2024-11-13 19:48:10 +00:00
Lennart Poettering
ea8b10409b man: point people from sd-bus man page to busctl
(cherry picked from commit 2f69ad26ca)
2024-11-13 19:48:10 +00:00
Lennart Poettering
307a6332a6 man: tone down claims on processes having exited already in ExecStop=
Processes can easily survive the first kill operation we execute, hence
we shouldn't make strong claims about them having exited already. Let's
just say "likely" hence.

Fixes: #15032
(cherry picked from commit ac804bc2f8)
2024-11-13 19:48:10 +00:00
Lennart Poettering
a6f9c20316 man: document that .path units don't care for hidden files
Fixes: #32751
(cherry picked from commit 5adc433799)
2024-11-13 19:48:10 +00:00
Lennart Poettering
48559a0b22 man: document that PrivateTmp= is unaffected by ProtectSystem=strict
Fixes: #33130
(cherry picked from commit b711737096)
2024-11-13 19:48:10 +00:00
Lennart Poettering
5a2ffc543b man: don't claim SELinuxContext= only worked in the system service manager
Fixes: #34840
(cherry picked from commit ecbe9ae5a0)
2024-11-13 19:48:10 +00:00
Lennart Poettering
f792b8020b man: document the timeout applied to /usr/lib/systemd/system-shutdown/ drop-in binaries
Fixes: #34949
(cherry picked from commit af080967ba)
2024-11-13 19:48:10 +00:00
Luca Boccassi
dadb179bec test: delete /swapfile after swapoff
[   23.608342] TEST-55-OOMD.sh[689]: + btrfs filesystem mkswapfile -s 64M /swapfile
[   23.651930] TEST-55-OOMD.sh[704]: ERROR: cannot create new swapfile: File exists

(cherry picked from commit 78b032d727)
2024-11-13 19:48:10 +00:00
Lennart Poettering
070dbe1e77 run: handle gracefully if we can't find binary client-side due to perms
Fixes: #35022
(cherry picked from commit 9810899ef2)
2024-11-13 19:48:10 +00:00
Zbigniew Jędrzejewski-Szmek
abd1e40820 resolved: log error messages for openssl/gnutls context creation
In https://bugzilla.redhat.com/show_bug.cgi?id=2322937 we're getting
an error message:
Okt 29 22:21:03 fedora systemd-resolved[29311]: Could not create manager: Cannot allocate memory
I expect that this actually comes from dnstls_manager_init(), the
openssl version. But without real logs it's hard to know for sure.

Use EIO instead of ENOMEM, because the problem is unlikely to be actually
related to memory.

(cherry picked from commit ee95e86ae1)
2024-11-13 19:48:10 +00:00
Luca Boccassi
5a13150485 ci: add coverage for builds without sd-boot
This should catch compilation issues such as:
https://github.com/systemd/systemd/pull/35014

(cherry picked from commit 8a3ac7afa6)
2024-11-13 19:48:10 +00:00
Luca Boccassi
a105a9bda6 test: set nullglob to avoid failure when building without sd-boot
2024-11-04T20:13:17.3258095Z + for loader in build/src/boot/efi/*{.efi,.efi.stub}
2024-11-04T20:13:17.3258275Z ++ sbverify --list 'build/src/boot/efi/*.efi'
2024-11-04T20:13:17.3258525Z + [[ Error reading file build/src/boot/efi/*.efi: No such file or directory
2024-11-04T20:13:17.3258952Z Can't open image build/src/boot/efi/*.efi != \N\o\ \s\i\g\n\a\t\u\r\e\ \t\a\b\l\e\ \p\r\e\s\e\n\t ]]
(cherry picked from commit 441922336b)
2024-11-13 19:48:10 +00:00
Luca Boccassi
59f5de450a test: fix tool name in comment
(cherry picked from commit c53df275d5)
2024-11-13 19:48:10 +00:00
Daan De Meyer
9d22224e00 pcrlock: Pad pe hash to a multiple of 8 bytes
All other tools (sbsigntools, osslsigncode, sbctl, goblin) do this
as well so let's follow suite.

(cherry picked from commit e37701a8cd)
2024-11-13 19:48:10 +00:00
Colin Foster
4ea8428848 test-dhcp-client: utilize log_info instead of printf
log_info appears to be the preferred method to convey information from
tests. Convert all the printfs to log_info to follow this standard.

(cherry picked from commit 38557d9ffb)
2024-11-13 19:48:10 +00:00
Martin Wilck
852e38edd0 udev-builtin-path_id: SAS wide ports must have num_phys > 1
Some kernel SAS drivers (e.g. smartpqi) expose ports with num_phys = 0. udev
shouldn't treat these ports as wide ports.  SAS wide ports always have
num_phys > 1. See comments for sas_port_add_phy() in the kernel sources.

Sample data from a smartpqi system to illustrate the issue below.
Here the phy device is attached to port 0:0, which has no end devices attached
and the SAS end device (where sda is attached) is associated with SAS
port 0:1, which has no associated phy device. Thus num_phys for port-0:1 is 0.
This is arguably wrong, but it's how smartpqi has always set up its devices in
sysfs.

/sys/class/sas_phy/phy-0:0 -> ../../devices/pci0000:46/0000:46:02.0/0000:47:00.0/host0/scsi_host/host0/phy-0:0/sas_phy/phy-0:0
/sys/devices/pci0000:46/0000:46:02.0/0000:47:00.0/host0/scsi_host/host0/port-0:0/phy-0:0 -> ../phy-0:0
/sys/devices/pci0000:46/0000:46:02.0/0000:47:00.0/host0/scsi_host/host0/phy-0:0/port -> ../port-0:0

/sys/class/sas_device/end_device-0:1 -> ../../devices/pci0000:46/0000:46:02.0/0000:47:00.0/host0/scsi_host/host0/port-0:1/end_device-0:1/sas_device/end_device-0:1
/sys/class/block/sda -> ../../devices/pci0000:46/0000:46:02.0/0000:47:00.0/host0/scsi_host/host0/port-0:1/end_device-0:1/target0:0:0/0:0:0:0/block/sda

Signed-off-by: Martin Wilck <mwilck@suse.com>
(cherry picked from commit 7f6674624e)
2024-11-13 19:48:10 +00:00
Daan De Meyer
f7d52524a7 TEST-64-UDEV-STORAGE: Don't hardcode device name in long-sysfs-path test
There's no guarantee our device will be named /dev/vda, so give it
a serial so we can query for its devname inside the test.

(cherry picked from commit 2ec809dd3b)
2024-11-13 19:48:10 +00:00
Daan De Meyer
beca1de2ef TEST-17-UDEV: Don't hardcode root device name
There's no guarantee the root device will be /dev/sda, so let's use
bootctl to get the actual path instead of harcoding it.

(cherry picked from commit 29a8e71d9c)
2024-11-13 19:48:10 +00:00
Ronan Pigott
c413c43c12 pam: quiet a spurious debug message
This singular debug message gets printed even if debug is not enabled.
Quiet this message when debug is not enabled for consistency.

(cherry picked from commit f4092cb974)
2024-11-13 19:48:10 +00:00
Mike Gilbert
aa0aa1093d posix_spawn_wrapper: do not set POSIX_SPAWN_SETSIGDEF flag
Setting this flag is a noop without a corresponding call to
posix_spawnattr_setsigdefault.

If we call posix_spawnattr_setsigdefault with a full signal set,
it causes glibc's posix_spawn implementation to call sigaction 63 times,
once for each signal. That seems wasteful.

This feature is really only useful for signals which have their
disposition set to SIG_IGN. Otherwise the dispostion gets set to
SIG_DFL automatically, either by clone(CLONE_CLEAR_SIGHAND) or the
subsequent execve.

As far as I can tell, systemd does not have any signals set to SIG_IGN
under normal operating conditions.

(cherry picked from commit ff94426f8a)
2024-11-13 19:48:10 +00:00
Łukasz Stelmach
9d060fb7eb core: make mount(8) and swapon(8) inherit SMACK label from systemd
By default mount(8), umount(8), swapon(8) and swapoff(8) should run with
with the SMACK label inherited from systemd rather than the default one
meant for services.

Fixes: aa5ae9711e
Follow-up-for: 20bbf5ee4c
(cherry picked from commit 8144537a81)
2024-11-13 19:48:10 +00:00
Yu Watanabe
c54a5fa6a8 test-network: add test for DHCPv4 address removal on stop
For issue #34837.

(cherry picked from commit 58a011ba48)
2024-11-13 19:48:10 +00:00
Yu Watanabe
96147d0104 network: process queued remove requests before networkd is stopped
This makes networkd process all queued remove requests when a
terminating or restarting signal is received. Otherwise, e.g. DHCPv4
address will not be removed on stop, especially when
KeepConfiguration=no.

Fixes a bug introduced by 85a6f300c1 and
its subsequent commits.

Fixes #34837.

Co-authored-by: Will Fancher <elvishjerricco@gmail.com>
(cherry picked from commit db68e99046)
2024-11-13 19:48:10 +00:00