Commit Graph
80040 Commits
Author SHA1 Message Date
Michael Catanzaro 780f320229 resolve: add warning comment to config file
There are way too many users configuring the DNS= setting by mistake,
because what it seems to do is different from what it actually does. We
do not have consensus to change its behavior, so let's at least add a
warning comment.

Fixes #33973
2025-03-13 04:12:18 +09:00
Yu Watanabe a4cb6c41a1 hostname: several follow-ups for wildcard hostname support (#36707) 2025-03-13 00:46:00 +09:00
Lennart Poettering b330824e59 test-cgroup-util: Check return values (#36024)
Reported by Coverity and
Fixes CID#1587767
2025-03-12 15:50:33 +01:00
nkraetzschmar 0bdf94e588 boot: add reboot-on-error config option
Enabling this option will cause the system to reboot in case the selected
entry fails to load.
2025-03-12 15:47:38 +01:00
Lennart Poettering d54196a4cd Fixes several recent CI issues (#36691)
- Fixes a race in systemd-run caused by
b7ba8d55b8, which causes issue #36679.
- Skip verifying masked units in TEST-23.
- Avoid false-positive ASan warning by switching sanitizer run from
Fedora rawhide to Fedora 41, caused by recent update from
llvm-19.1.7-11.fc43 to llvm-20.1.0-1.fc43. Hopefully issue #36678 should
be fixed.

Closes #36678.
Closes #36679.
2025-03-12 15:32:58 +01:00
Yu Watanabe 11361e3293 meson: drop split-usr, rootlibdir, and rootprefix from meson_options.txt
These options were deprecated by b0d3095fd6 (v255).
Let's remove them completely.
2025-03-12 15:21:57 +01:00
Lennart Poettering d77bf27c80 update TODO 2025-03-12 13:35:20 +01:00
Lennart Poettering 36f529fd2d update TODO 2025-03-12 13:30:30 +01:00
Michal Koutný b67a45841f test-cgroup-util: Ignore LXC group
LXC helper processes hide themselve in .lxc cgroup, we don't have to
deal with the inside tests (and the error in conversion to unit is handled).
Skip those but keep iterating over remaining processes to detect what
can be created around us.
2025-03-12 11:46:19 +01:00
Michal Koutný b78003c793 test-cgroup-util: Skip procs analysis without cgroupfs
cg_pidref_get_path() cannot work (current implementaion) without
cgroupfs (when it checks unified or not setup). Similarly,
cg_pidref_get_unit() assumes all processes are part of a unit. So carry
out the test only when running on a systemd setup.
2025-03-12 10:31:23 +01:00
Michal Koutný ca82f0cbe2 test-cgroup-util: Check return values
The test is supposed to check a battery of cgroup helpers on each
process found but it doesn't literally check anything besides presence
of procfs. (One can visually check printed output only. Introduction in
aff38e74bd ("nspawn: suffix the nspawn cgroups with ".nspawn"").)

Make some assumptions about visible processes and turn the test into
testing that systemd helpers can deal with whatever process they find on
the SUT.

Reported by Coverity and
Fixes CID#1587767
2025-03-12 10:31:23 +01:00
Yu Watanabe 35d5defc4e hostname-setup: use strchr() to find wildcard character
Addresses https://github.com/systemd/systemd/pull/36647#discussion_r1990048751.
2025-03-12 06:48:57 +09:00
Yu Watanabe 851c706e74 test: add test cases for hostname_substitute_wildcards()
The function is indirectly tested through read_etc_hostname(), but let's
also test it directly.
2025-03-12 06:44:42 +09:00
Yu Watanabe 1f5d8a6132 hostname: fix typo
Follow-up for af9c45d5b6.
2025-03-12 06:26:56 +09:00
Yu Watanabe ced634a62d resolve question marks in /etc/hostname to characters hashed from machine ID (#36647)
So I have a bunch of particle os instances around, that I frequently
factory reset. and it's confusing, since they all have the same name.
Let's do something about this, and extend the hostname setup logic a bit
to deal better with "cattle" rather than "pet" deployments.
Specifically: if a hostname in /etc/hostname contains a bunch of
question marks we'll replace it with hex chars hashed from the machine
id.

This allows us to do something like this:

hostnamectl set-hostname --static 'funky-????-????-???'

and we'll end up with a hostname like `funky-baf4-b653-e230`
2025-03-12 04:50:33 +09:00
Yu Watanabe f3580b6807 mountfsd: add complete varlink introspection comments (#36703) 2025-03-12 04:48:12 +09:00
Yu Watanabe 1ac2fc4984 run: check if the start job is finished on PropertiesChanged signal and so on
Otherwise, if systemd-run is disconnected from bus before JobRemoved
signal, then c->start_job will never freed, thus run_context_check_done()
will never call sd_event_exit() even after the service is finished.

This drops monitoring JobRemoved signal, and make systemd-run check if
the start job is started when PropertiesChanged signal is received.

Follow-up for b7ba8d55b8.

Fixes #36679.
2025-03-12 04:33:46 +09:00
Yu Watanabe 07355061db TEST-74-AUX-UTILS: fail earlier when systemd-run fail to reconnect to bus
Note, the default timeout for systemctl daemon-reload is 270 seconds.
Hence, 300 seconds should be enough.
2025-03-12 04:33:46 +09:00
Yu Watanabe 9670922d44 ci/mkosi: enable sanitizers on Fedora 41
It seems the recent update of LLVM package in Fedora rawhide breaks
sanitizers, and udevd freezes after false-positive (I guess) issue is
detected:

systemd-udevd[2646]: =================================================================
systemd-udevd[2646]: ==2646==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffc3a642660 at pc 0x555627ac022b bp 0x7ffc3a6422b0 sp 0x7ffc3a6422a8
systemd-udevd[2646]: READ of size 8 at 0x7ffc3a642660 thread T0 ((udev-worker))

llvm-19.1.7-11.fc43 worked fine, but llvm-20.1.0-1.fc43 does not.
To avoid the issue, let's enable sanitizer on Fedora 41, and disable it
on Fedora rawhide.

Closes #36678.
2025-03-12 04:33:46 +09:00
Yu Watanabe e5e7cc9a98 TEST-23-UNIT-FILE: skip verifying masked unit
This fixes the following failure:
TEST-23-UNIT-FILE.sh[2408]: + systemd-analyze --recursive-errors=no --man=no verify /usr/lib/systemd/system/sysinit.target.wants/systemd-hwdb-update.service
systemd-analyze[2737]: sys-kernel-config.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: proc-sys-fs-binfmt_misc.automount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: dev-hugepages.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-kernel-tracing.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-kernel-debug.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-fs-fuse-connections.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: dev-mqueue.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: Unit systemd-hwdb-update.service is masked.
TEST-23-UNIT-FILE.sh[166]: + :
TEST-23-UNIT-FILE.sh[166]: + kill -0 2408
TEST-23-UNIT-FILE.sh[166]: + wait 2408
TEST-23-UNIT-FILE.sh[166]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed'
TEST-23-UNIT-FILE.sh[166]: Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed
2025-03-12 04:33:46 +09:00
Lennart Poettering 5721b9bc46 update TODO 2025-03-11 18:20:31 +01:00
Lennart Poettering 0ecfcc9790 mountfsd: also return suggested mount point paths for the returned partitions
When mounting a disk image we return a bunch of mount fds referencing
the various partitions in the disk, along with some metadata about them.
One key metadata field is the "designator" which is supposed to tell
clients what is what, and where to mount it.

Let's make this more explicit: let's also include the literal relative
path where each mount shall be placed, to simplify implementations of
clients that do not care about the concept of designators.
2025-03-11 18:20:31 +01:00
Lennart Poettering 00c17ad5cf mountfsd: complete varlink introspection comments 2025-03-11 18:20:31 +01:00
Lennart Poettering 16771b505e update TODO 2025-03-11 18:19:24 +01:00
Lennart Poettering 06967d4049 update TODO 2025-03-11 18:01:42 +01:00
Lennart Poettering f1bc816c09 test: add test checking if pattern based hostnames work 2025-03-11 18:01:42 +01:00
Lennart Poettering af9c45d5b6 hostname: support that /etc/hostname contains ??? as wildcards to be replaced by hash value from /etc/machine-id 2025-03-11 18:01:42 +01:00
Lennart Poettering 98b7c5e2f2 basic: move gethostname_full() from basic/hostname-util.c → shared/hostname-setup.c
In one of the next commits we'd like to introduce a concept of
optionally hashing the hostname from the machine ID. For that we we need
to optionally back gethostname_full() by code involving sd-id128, hence
let's move it from src/basic/ to src/shared/, since only there we are
allowed to use our public APIs.
2025-03-11 17:54:44 +01:00
Lennart Poettering 338553715b update TODO 2025-03-11 17:19:32 +01:00
David Tardon 536c18e5c3 bus-polkit: shortcut auth. after first denial
A D-Bus/Varlink method can issue PolicyKit auth. requests for multiple
actions; in this case the method is expected to fail on the first one
that is not allowed. This is enforced by asserts in
async_polkit_read_reply(), but that's a wrong place for the check for
two reasons:

1. it doesn't allow to get a meaningful stack trace;
2. sending the query to polkit is already a pointless exercise.

Let's do the check in *_verify_polkit_async_full() and don't send
anything to PolicyKit in that case.

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=2349594 .
2025-03-11 17:18:12 +01:00
Ivan Kruglov cd20d48c69 docs: clarify userns mapping when /proc/sys is rw 2025-03-11 13:25:54 +01:00
Lennart Poettering a9178dbdd9 cgroup-util: Handle capsule@ paths like user@ paths (#36664)
The capsule instances are related to user instances, so treat them
equally to user@.service when handling cgroup paths. This also saves us
from polluting public libsystemd API with variant for capsules too.

Fix: https://github.com/systemd/systemd/issues/36098
2025-03-11 12:03:57 +01:00
Lennart Poettering f8a09ace1d core/service: introduce sd_notify() RESTART_RESET=1 for resetting restart counter (#36698) 2025-03-11 12:03:12 +01:00
Mike Yuan fce19eb67f core/main: fix logging of /sbin/init exec failure
Follow-up for 93e19483dc

While at it, avoid duplicate manager_status_printf()
(error_message will be shown in main()).
2025-03-11 12:02:57 +01:00
Yu Watanabe b8790a875e tmpfiles: ignore ENOENT when file is removed during setting parmission and friends
After a file matches with a glob pattern, the file may be removed or
renamed before opening it. Let's ignore the error in such case.

Fixes #30938.
2025-03-11 18:52:28 +09:00
Lennart Poettering a0d8484eeb update TODO 2025-03-11 10:48:40 +01:00
Yu Watanabe 2373397c41 udev: reread partition table and trigger synthetic change events in child process (#36685) 2025-03-11 18:43:43 +09:00
Michal Koutný 6c5703f9bc cgroup-util: Handle capsule@ paths like user@ paths
The capsule instances are related to user instances, so treat them
equally to user@.service when handling cgroup paths. This also saves us
from polluting public libsystemd API with variant for capsules too.

Fix: #36098
2025-03-11 10:37:19 +01:00
Mike Yuan c139ac7f53 TODO: support RESTART_RESET=1 in journal-upload 2025-03-11 00:44:44 +01:00
Mike Yuan 406aeb5da6 core/service: introduce sd_notify() RESTART_RESET=1 for resetting restart counter
We have RestartMaxDelaySec= + RestartSteps= to exponentially increase
auto restart durations, but it currently cannot be reset by the service
itself, which makes it sometimes awkward to use. A typical pattern
in real life is that a service was once down (e.g. due to temporary
network interruption) and multiple restarts were attempted. Then,
future restarts would always wait for increated amount of time based on
RestartMaxDelaySec=, even after the original problem got resolved.
Such "persistence" could result in longer unavailablity than there
should be for failures that come later.
(C.f. https://utcc.utoronto.ca/~cks/space/blog/linux/SystemdResettingUnitBackoff)

Let's introduce a new sd_notify() notification for resetting the restart
counter. There were discussions about making this timer-based, but I think
it's more flexible to leave the decision-making to the service. This enables
them to do a combination of N successful requests + uptime check for instance.
2025-03-11 00:44:44 +01:00
Mike Yuan a364ebd46d core/unit: disable unit debug invocation in generic unit_reset_failed() 2025-03-10 23:59:31 +01:00
Yu Watanabe bb3ad7b2f1 udev: use ERRNO_IS_NEG_* where appropriate (#36690)
Follow-up for f8825c1364.
2025-03-10 23:51:41 +01:00
Yu Watanabe 9c47b1527e udev: scan partitions and trigger synthetic change events in child process
Rereading partition table may take longer on slow disk. The main process
should not be blocked by the operation. Let's fork a child process and
do that on the child.

Prompted by #36624 and #36269.
2025-03-11 05:55:51 +09:00
Yu Watanabe ee9ff3902b udev: split out synthesize_change_all() from synthesize_change()
No functional change. Preparation for later change.
2025-03-11 05:55:51 +09:00
Antonio Alvarez Feijoo cef2181cda umount: do not move busy network mounts
If a network mount returns EBUSY on umount, the logic introduced in
6dc68a00cf causes shutdown to hang indefinitely on
`fstatat()` (i.e., within `is_dir(m->path, true)`). Hence, skip this logic for
network mounts (following the same motivation we use to skip read-only mounts in
this kind of file systems).

Fixes 6dc68a00cf
2025-03-11 05:53:31 +09:00
Yu Watanabe 63b331517e nsresourced,vmspawn,mountfsd: various smaller fixes (#36689) 2025-03-11 05:50:04 +09:00
Yu Watanabe c24148451a event-util: move event_source_hash_ops to event-util 2025-03-11 05:48:19 +09:00
Lennart Poettering abec5cdd56 nsresourced,mountfsd: set userdata pointer via varlink_server_new() 2025-03-10 16:41:45 +01:00
Lennart Poettering 0d4f38732b vmspawn: properly exit in vmspawn child on failure 2025-03-10 16:41:43 +01:00
Lennart Poettering e267f42d91 nsresourced: fix initialization of netns_fd_idx 2025-03-10 16:41:40 +01:00