Commit Graph
53667 Commits
Author SHA1 Message Date
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
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 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
Lennart Poettering 5dc4a3f4c2 nsresourced: clear up some type confusion
We settle on the types the backend implementation in
userns-registry.[ch] uses too. i.e. uid_t/gid_t for the bases, and
uint32_t for the uid range sizes.
2025-03-10 16:41:38 +01:00
Lennart Poettering b74a554def nsresourced: permit numeric uid/gid also be specified as strings 2025-03-10 16:41:36 +01:00
Lennart Poettering 869bf7282b nsresourced: fix offset
Follow-up for: ee6fd7ef82
2025-03-10 16:41:33 +01:00
Yu Watanabe a5c11722e6 run: declare ARG_STDIO_XYZ like a flag
Then, we can easily handle the assignment when both --pipe and
--pty/--pty-late are specified.
No functional change, just a refactoring.
2025-03-10 22:34:52 +09:00
Yu Watanabe ad338e0fd5 vmspawn: fix typo
Follow-up for ef430b84e9.
2025-03-10 18:12:51 +09:00
Yu Watanabe 2792b1181f meson: bump required minimum version to 0.62.0 (#36610)
- bump the requred minimum version of meson to 0.62.0,
- use install_symlink(), which is supported since meson-0.61.0,
- use more features provided by newer meson with careful
conditionalization.

Follow-up for 8442ac9c02.
Closes #35967.
2025-03-10 07:51:28 +09:00
Matteo Croce f06e6d19c0 network: add log messages when a route can't be updated
Sometimes networkd removes a route, based on route_can_update() verdict.
Add some debug messages to better understand whi this decision has been made.
2025-03-10 05:39:49 +09:00
Lennart Poettering ef430b84e9 vmspawn: optionally grow image 2025-03-10 03:57:46 +09:00
Yu Watanabe c0cc01de8a meson: use install_symlink() where applicable
Now our baseline of meson is 0.62, hence install_symlink() can be used.

Note, install_symlink() implies install_emptydir() for specified
install_dir. Hence, this also drops several unnecessary
install_emptydir() calls.

Note, the function currently does not support 'relative' and 'force' flags,
so several 'ln -frsT' inline calls cannot be replaced.
2025-03-10 02:41:40 +09:00
Yu Watanabe a5ede71f49 mount-setup: two trivial cleanups (#36668) 2025-03-09 09:42:41 +09:00
Mike Yuan 590e0e3bac core/main: correct retval for reexec/switch-root/soft-reboot
For these objectives we ought to execve() at the end, i.e. if we
ever hit the return path something went wrong in do_reexecute().
Let's properly report that via retval.
2025-03-08 20:49:30 +01:00
Mike Yuan 93e19483dc core/main: preemptively check existence of init only if we're switching root
Follow-up for aaa27e2e21

The commit described about system potentially becoming undebuggable
after switching into broken root or whatnot. But notably we can never
activate emergency.target after do_reexecute() failure, since the Manager
has been destructed. Plus, for a normal reexecution the fallback shell logic
triggered on non-existent /sbin/init is kinda useful. Let's hence guard
the extra check behind switch-root.

Also, move the check below /run/nextroot/ detection.
2025-03-08 20:49:30 +01:00
Mike Yuan 550f4718bc core/main: assign mac_init() retval to r
If it fails, we'd submit the errno to supervisor via sd_notify() later.
2025-03-08 20:40:24 +01:00
Mike Yuan eda75b2cb2 core/main: log about save_env() error 2025-03-08 20:40:24 +01:00
Mike Yuan 0ddf4acab4 core/main: port to log_syntax_parse_error() 2025-03-08 20:40:24 +01:00
Mike Yuan fafb05451f core: move CrashAction enum def to crash-handler.[ch] 2025-03-08 20:40:23 +01:00
Mike Yuan 568bafca50 core/meson: move efi-random.c out of libcore
It's used only in core/main.c
2025-03-08 20:40:23 +01:00
Mike Yuan 5fe2b509aa core/main: remove unused include 2025-03-08 20:40:23 +01:00
Mike Yuan b05c495eed mount-setup: tune down log level if usrquota is not supported, apply usrquota when smack is in use too
Follow-up for 8f5131fb9e
2025-03-08 19:16:17 +01:00
Mike Yuan 80b7f60d2e mount-setup: drop outdated comment 2025-03-08 19:16:17 +01:00
Matteo Croce bd0d22c2a5 network: remove useless loop (#36648)
In route_metric_can_update() the loop iterates over the metrics, but
skips all indices except for RTAX_MTU.

Replace it with a simple compare.
2025-03-08 17:39:09 +01:00
Luca Boccassi d9208ff9a4 keyutil: support adding content into PKCS#7 signature (#36663)
Support including the data that was signed inside the PKCS#7 signature.
This creates a self-contained file where the signature of the data can
be verified without any other information, since the file contains the
data, signature, and certificate (which contains the public key used for
the signing).

One use case of this is IPE which requires a PKCS#7 signature that is
not "detached", i.e. includes the IPE configuration that has been
signed.

This also slightly adjusts the test case to use the x509 certificate
inside the PKCS#7 signature instead of supplying it externally during
verification.
2025-03-08 01:42:20 +00:00
Dan Streetman f80bb317f6 keyutil: support adding content into PKCS#7 signature 2025-03-07 18:36:23 -05:00
Lennart Poettering f09e8ccb0b homed: add key management toolchain (#36513)
if Lennart shall dogfood ParticleOS he needs acceptable tooling for
making his homed home dir accessible from his legacy fedora install, and
from local and remote particleos. Let's add explicit support for
scenarios like this:

1. add high level support for enrolling the account signing key from the
fedora install
2. add high level support for "adopting" a local but foreign .home file
on a system
3. add high level support for "registering" a remote user account on a
different system

(this lacks test cases and some docs, hence marked as wip)
2025-03-07 22:19:33 +01:00
Lennart Poettering 36be5dc81c virt: detect "linux,dummy-virt" devicetree VMs (#36655) 2025-03-07 18:24:24 +01:00
Lennart Poettering 2efffd036e homectl: rearrange --help text with sections
We support so many verbs now, help the user with some structure
2025-03-07 18:15:07 +01:00
Lennart Poettering 0e1ede4b4b homectl: add interface for controlling storage for negative machine ID matches 2025-03-07 18:15:04 +01:00
Lennart Poettering c7a4216509 homed: re-establish inotify watches on SIGUSR1
Let's define a clean way how we can reestablish file watches in homed.
This is a relevant in case we overmount /home/ as a whole. It's very
useful for our testcase in particular.
2025-03-07 18:15:01 +01:00
Lennart Poettering c3f54fcd3b homed: suppress warning if quota is not on on /var/ and elsewhere 2025-03-07 18:14:58 +01:00
Lennart Poettering efe2ce7277 homed: rescan /home/ in more occasions automatically
When unregistering a home there's a chance this "reveals" another home
by the same name in /home/, hence immediately schedule a rescan, the
same way we already schedule it in on remove.

Also, drop the conditionalization when scheduling a rescan during
remove, for the same reasons: a remove might reveal another home, and we
cannot check for that ahead of time. Trying to check is kinda a
pointless optimization anyway, since this is not a frequent operation
and rescanning is not the end of the world.
2025-03-07 18:14:55 +01:00
Lennart Poettering 17f48a8cc7 homectl: making stripping of signatures from user records optional 2025-03-07 18:14:52 +01:00
Lennart Poettering cc14c14782 homectl: also support registering (rather than creating) home directories via system credentials 2025-03-07 18:14:48 +01:00
Lennart Poettering e8801cc5b3 homectl: expose "register" verb to register a user record locally 2025-03-07 18:14:45 +01:00