1
0
mirror of https://github.com/systemd/systemd synced 2024-07-05 17:39:42 +00:00
Commit Graph

1622 Commits

Author SHA1 Message Date
Daan De Meyer
d6518003f8 tpm2-setup: Don't fail if we can't access the TPM due to authorization failure
The TPM might be password/pin protected for various reasons even if
there is no SRK yet. Let's handle those cases gracefully instead of
failing the unit as it is enabled by default.
2024-06-12 18:31:21 +09:00
Daan De Meyer
4861eace12 presets: Don't enable systemd-homed-firstboot.service by default
Enabling this service by default means every CI image without a
regular user now gets stuck on first boot due to the password prompt
from systemd-homed-firstboot.service. Let's not enable the service
by default but instead require users to enable it explicitly if they
want its behavior.

Fixes #33249
2024-06-08 11:29:55 +01:00
Luca Boccassi
d6243ebedd journald: enable persistent FD Store to fix logging during soft-reboot
A unit with StandardOutput=journal (the default) will get its stdout/stderr sockets
disconnected when journald stops, as the file descriptors on journald's side are
not preserved (it works on restart, as the FD Store keeps them open during restarts).
Set FileDescriptorStorePreserve=yes so that the journal FD's stay open during a soft
reboot, and applications don't get broken stdout/stderr.
2024-06-03 16:30:54 +01:00
Zbigniew Jędrzejewski-Szmek
a37454bd90 man: update links to "API File Systems" 2024-05-28 14:48:56 +02:00
Zbigniew Jędrzejewski-Szmek
d5c17aceb3 various: update links to more wiki pages 2024-05-28 14:48:53 +02:00
Yu Watanabe
7ae27cefd7 unit: also stop systemd-journal-flush.service on soft-reboot
After soft-reboot, /var/log/journal may be initially read-only,
and becomes writable a bit later. In such case, runtime journal is
initially opened by journald. Hence, we need to flush to /var when it is
ready.
2024-05-26 03:11:24 +09:00
Yu Watanabe
37143fdf5a units: stop systemd-journald before systemd-soft-reboot.service
Typically, soft-reboot.target is never reached. So, without this change,
systemd-journald may be killed by PID1 on soft-reboot, and may cause
journal corruption.
2024-05-23 00:08:14 +09:00
Yu Watanabe
03a41c41ee Revert "units: do not soft-reboot before soft-reboot.target reached"
This reverts commit 4263d7617f.

Still I think this is the way to go. But the change was merged after -rc2,
and still discussion is continued. So, at least now let's revert it,
and do that after v256-final is released if approved.
2024-05-23 00:06:30 +09:00
Yu Watanabe
1cd904bbe0 units: add JobTimeoutAction= to exit.target and friends
For consistency with other targets, e.g. poweroff.target or
reboot.target.
2024-05-18 01:28:14 +09:00
Yu Watanabe
4263d7617f units: do not soft-reboot before soft-reboot.target reached
Otherwise, at the time systemd-soft-reboot.service succeeds,
services which has Conflicts= and Before=soft-reboot.target may
not be stopped yet, and may be SIGKILLed.

Especially, systemd-journald.service has the dependencies, thus
journal may be corrupted. See #32223.

Follow-up for 13ffc60749.

Fixes #32834.
2024-05-17 12:31:00 +09:00
Yu Watanabe
11a55b15bf units: drop dependencies of soft-reboot.target from systemd-journald@.service
The service deos not have DefaultDependencies=no. Hence it has dependencies
of shutdown.target, and dependencies of soft-reboot.target are not
necessary.

Follow-up for f89985ca49.
2024-05-17 11:57:53 +09:00
Yu Watanabe
61628287bd journal: explicitly sync namespaced journals before stopping socket units
Otherwise, if a service unit that requests LogNamespace= stopped before
systemd-journald@.service is started, logs generated by the service will be
lost, as systemd-journald@.socket is stopped and
systemd-journald@.service will never started.

To prevent the issue, let's introduce another implicit dependency to
a oneshot service that explicitly synchronizes a namespaced journal file
when the log namespace is not needed anymore.

Fixes #32604.
2024-05-02 19:41:01 +02:00
Dmitry V. Levin
c309b9e9c3 treewide: fix a few typos in NEWS, docs, comments, and log messages 2024-04-27 12:11:13 +02:00
Luca Boccassi
1ac79a1937 units: add Before=shutdown.target to systemd-networkd-persistent-storage.service
It's ordered with networkd, but just in case. Lintian complains:

W: systemd: systemd-service-file-shutdown-problems [usr/lib/systemd/system/systemd-networkd-persistent-storage.service]

Follow-up for 91676b6458
2024-04-26 22:16:33 +02:00
Lennart Poettering
ad7ac02035 units: merge two After= lines 2024-04-22 15:15:05 +02:00
Lennart Poettering
a6e9c37f5e tpm2-setup-early: order against pcrphase-initrd
Right now systemd-tpm2-setup-early and systemd-pcrphase-initrd.service
are not ordered against each other. However, they require the same slow
resource to operate: the TPM2. If we allow them to access the device
simultaneously, the kernel resource manager like has to save/restore TPM
state while they operate, slowing things down further.

hence, let's avoid all this mess, and just order them against each other
so that the shared resource is first used in full by one and then by the
other.

I opted to order systemd-pcrphase-initrd before
systemd-tpm2-setup-early, since there's value in having the former as
early as possible in userspace, to be a good marker for the transition
from kernel to first userspace. I can see no benefit in the opposite
order however.
2024-04-22 14:47:58 +02:00
Yu Watanabe
5700e755a9 units: introduce systemd-udev-load-credentials.service 2024-04-16 09:45:43 +09:00
Lennart Poettering
27dd678d2d units: order repart after systemd-tpm2-setup-early.service
This mimics what we do for systemd-cryptsetup@.service (see
src/shared/generator.c), and makes sense since repart might lock up the
root volume against a TPM, which ideally has its SRK already set up by
then.

More importantly though, this ensures that we ordered correctly after
tpm2.target (which systemd-tpm2-setup-early.service has a dependency
on), for systems where the TPM drivers are not compiled into the kernel.

See: https://lists.freedesktop.org/archives/systemd-devel/2024-April/050201.html
2024-04-15 22:33:45 +02:00
Mike Yuan
40611863e4
units/systemd-boot-check-no-failures.service: drop unneeded dep on shutdown.target 2024-04-10 23:40:53 +08:00
Lennart Poettering
702a52f4b5 mountfsd: add new systemd-mountfsd component 2024-04-06 16:08:24 +02:00
Lennart Poettering
8aee931e7a nsresourced: add new daemon for granting clients user namespaces and assigning resources to them
This adds a small, socket-activated Varlink daemon that can delegate UID
ranges for user namespaces to clients asking for it.

The primary call is AllocateUserRange() where the user passes in an
uninitialized userns fd, which is then set up.

There are other calls that allow assigning a mount fd to a userns
allocated that way, to set up permissions for a cgroup subtree, and to
allocate a veth for such a user namespace.

Since the UID assignments are supposed to be transitive, i.e. not
permanent, care is taken to ensure that users cannot create inodes owned
by these UIDs, so that persistancy cannot be acquired. This is
implemented via a BPF-LSM module that ensures that any member of a
userns allocated that way cannot create files unless the mount it
operates on is owned by the userns itself, or is explicitly
allowelisted.

BPF LSM program with contributions from Alexei Starovoitov.
2024-04-06 16:08:24 +02:00
Mike Yuan
dfad86b838
units: introduce systemd-hibernate-clear.service that clears
stale HibernateLocation EFI variable

Currently, if the HibernateLocation EFI variable exists,
but we failed to resume from it, the boot carries on
without clearing the stale variable. Therefore, the subsequent
boots would still be waiting for the device timeout,
unless the variable is purged manually.

There's no point to keep trying to resume after a successful
switch-root, because the hibernation image state
would have been invalidated by then. OTOH, we don't
want to clear the variable prematurely either,
i.e. in initrd, since if the resume device is the same
as root one, the boot won't succeed and the user might
be able to try resuming again. So, let's introduce a
unit that only runs after switch-root and clears the var.

Fixes #32021
2024-04-03 22:07:43 +08:00
Mike Yuan
4f156b1078
units: remove implicit RequiresMountsFor= 2024-04-01 19:44:51 +08:00
Yu Watanabe
d30d0b04ae
Merge pull request #31951 from bluca/resolve_reload
resolved: support reloading configuration at runtime
2024-03-27 02:37:52 +09:00
Luca Boccassi
14a5217679 resolved: support reloading configuration at runtime
Drop connections and caches and reload config from files, to allow
for low-interruptions updates, and hook up to the usual SIGHUP and
ExecReload=. Mark servers and services configured directly via D-Bus
so that they can be kept around, and only the configuration file
settings are dropped and reloaded.

Fixes https://github.com/systemd/systemd/issues/17503
Fixes https://github.com/systemd/systemd/issues/20604
2024-03-26 13:36:42 +00:00
Mike Yuan
20ce9fecaa
units: sort lists in meson.build 2024-03-26 21:08:49 +08:00
Zbigniew Jędrzejewski-Szmek
c38e4e2fda
Merge pull request #29721 from poettering/systemd-project
New capsule@.service feature
2024-03-26 13:19:33 +01:00
Zbigniew Jędrzejewski-Szmek
d1f3cd7aaa units: add one more equivalency of '-' in '_' on kernel cmdline
c0aeff4b99 added this in one unit file, but the
same problem occurs here. (There are no other files where this would apply.)
I think we should solve this systematically somehow, but it's not clear how to
do that, so until we have that better solution, let's apply the manual solution
so that our units work as expected.
2024-03-19 13:06:44 +00:00
Yu Watanabe
a9e7894d38 unit/network: use ProtectSystem=strict again
Now, networkd accesses the state directory through the file descriptor
passed from systemd-networkd-persistent-storage.service.
Hence, the networkd itself does not need to access the state directory
through its path, and we can use more stronger mode for ProtectSystem=.
2024-03-19 15:15:32 +09:00
Daan De Meyer
966e05af04 tpm2-setup: Add --graceful
Currently the associated units fail if full tpm support is not available
on the system. Similar to systemd-pcrextend, let's add a --graceful option
that exits gracefully if no full TPM support is detected and use it in both
units.
2024-03-17 13:34:51 +01:00
Daan De Meyer
c0aeff4b99 units: Accept modules_load and rd.modules_load in systemd-modules-load.service
The service will use either, so let's make sure either of them starts
the service as well.
2024-03-17 13:33:45 +01:00
Yu Watanabe
7b799b870f units: use relative path 2024-03-16 05:31:44 +09:00
Zbigniew Jędrzejewski-Szmek
c78e86ab8d
Merge pull request #31777 from keszybz/unit-retitling-and-comments
Unit retitling and comments
2024-03-15 15:57:10 +01:00
Lennart Poettering
95be59f907 ssh-generator: introduce ssh-access.target
This new passive target is supposed to be pulled in by SSH
implementations and should be reached when remote SSH access is
possible. The idea is that this target can be used as indicator for
other components to determine if and when SSH access is possible.

One specific usecase for this is the new sd_notify() logic in PID 1 that
sends its own supervisor notifications whenever target units are
reached. This can be used to precisely schedule SSH connections from
host to VM/container, or just to identify systems where SSH is even
available.
2024-03-14 17:23:28 +01:00
Lennart Poettering
9b94ae834b units: add systemd-capsule@.service 2024-03-14 11:34:04 +01:00
Zbigniew Jędrzejewski-Szmek
25e98e331d units: retitle systemd-bootctl*.{service,socket}
"Starting Boot Control…" would be a fairly confusing message in the boot logs.
Use "… Service" to mirror what we have in other services like
systemd-{hostnamed,timedated,portabled,machined,…}.service.
2024-03-14 11:15:55 +01:00
Zbigniew Jędrzejewski-Szmek
3986aa6d08 units: drop "(Varlink)"
We generally don't specify the protocol implementation in unit descriptions.

For journald, we have:
  $ git grep Description 'units/*journald*'
  units/systemd-journald-audit.socket:Description=Journal Audit Socket
  units/systemd-journald-dev-log.socket:Description=Journal Socket (/dev/log)
  units/systemd-journald-varlink@.socket:Description=Journal Varlink Socket for Namespace %i
  units/systemd-journald.service.in:Description=Journal Service
  units/systemd-journald.socket:Description=Journal Sockets
  units/systemd-journald@.service.in:Description=Journal Service for Namespace %i
  units/systemd-journald@.socket:Description=Journal Sockets for Namespace %i
so we need to keep "Varlink" in the name. But also use "Sockets" (plural)
for the "main" socket unit, since it opens multiple sockets.
2024-03-14 11:14:10 +01:00
Zbigniew Jędrzejewski-Szmek
4fd9ed3e41 units/systemd-machine-id-commit: retitle
Our docs say that the Description should be capitalized.
Also, change "commit" to "save" to make this more accessible.
2024-03-14 10:26:45 +01:00
Zbigniew Jędrzejewski-Szmek
3719dcb0bc units: retitle systemd-pcrextend.{service,socket}, change TPM2→TPM
I was looking at the logs in some bug and saw this:

Mar 13 15:55:12 fedora systemd[1]: systemd-pcrmachine.service - TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
Mar 13 15:55:12 fedora systemd[1]: Starting systemd-remount-fs.service - Remount Root and Kernel File Systems...
Mar 13 15:55:12 fedora systemd[1]: systemd-tpm2-setup-early.service - TPM2 SRK Setup (Early) was skipped because of an unmet condition check (ConditionSecurity=measured-uki).

This is overly technical, for most units we don't provide this level of
detail about the implementation. So retitle the units to be more accessible.

Also, the fact that it's a v. 2 of the TPM is not that important. We don't
support TPM 1.2, but computers without TPM v2 are getting rare. For other
units we don't advertise the version of hardware, and let's not do this here,
to reduce some complexity.
2024-03-14 10:26:45 +01:00
Mike Yuan
d4923a13b7
units: make systemd-journald@.socket installable 2024-03-14 14:25:52 +08:00
Daan De Meyer
ffc2773804 units: Bump various oneshot unit timeouts to 90s
In mkosi, we've been having CI failures caused by
systemd-machine-id-commit.service timing out. Let's bump the timeout
for it and systemd-rfkill.service to 90s which we also use for other
oneshot services to avoid transient failures on slower systems.
2024-03-14 00:10:48 +09:00
Yu Watanabe
6f9148bab9 unit: do not trigger automount for /boot and/or /efi
ProtectSystem=full remounts /boot and/or /efi read-only, but that
may trigger automount for the paths and delay the service being started.
===
systemd[1]: boot.automount: Got automount request for /boot, triggered by 720 ((networkd))
===
The service does not need to access the paths, so let's hide them.

Follow-up for f90eb08627.

Fixes #31742.
2024-03-13 10:23:18 +09:00
Yu Watanabe
7d6efb777e unit: sort option 2024-03-13 10:22:49 +09:00
Yu Watanabe
91676b6458 networkctl: introduce "persistent-storage" command
Then, this introduces systemd-networkd-persistent-storage.service.

systemd-networkd.service is an early starting service. So, at the time
it is started, the persistent storage for the service may not be ready,
and we cannot use StateDirectory=systemd/network in
systemd-networkd.service.

The newly added systemd-networkd-persistent-storage.service creates the
state directory for networkd, and notify systemd-networkd that the
directory is usable.
2024-03-12 01:57:16 +09:00
Yu Watanabe
f90eb08627 network/varlink: introduce io.systemd.Network.SetPersistentStorage method
And make the networkd use state directory.

Currently, the state directory and the method are not used, but will be used later.
2024-03-12 01:57:11 +09:00
Mike Yuan
af720f38d9
units: make quota services bind to corresponding mount units
Follow-up for a628d933cc

systemd-growfs@.service does the same.
2024-03-10 22:57:22 +08:00
Thomas Blume
fc5c6eccb4 units: make templates for quotaon and systemd-quotacheck service 2024-03-09 19:32:09 +00:00
Lennart Poettering
78266a54f1 tree-wide: use "_" rather than "-" as separator in kernel cmdline options
Most of our kernel cmdline options use underscores as word separators in
kernel cmdline options, but there were some exceptions. Let's fix those,
and also use underscores.

Since our /proc/cmdline parsers don't distinguish between the two
characters anyway this should not break anything, but makes sure our own
codebase (and in particular docs and log messages) are internally
consistent.
2024-02-28 15:33:51 +01:00
Adrian Vovk
c3d50255fc homed: Create & advertise blob directory
This ensures that a user-specific blob directory exists in
/var/cache/systemd/homed for as long as the user exists, and gets
deleted if the user gets deleted.

It also advertises this blob directory via the user record, so that
clients can find and use it.
2024-02-19 11:18:11 +00:00
Luca Boccassi
92d1419eb8
Merge pull request #31218 from CodethinkLabs/vmspawn/journal_forwarding
vmspawn: support journal forwarding
2024-02-16 12:09:52 +00:00