Commit Graph

1774 Commits

Author SHA1 Message Date
Lennart Poettering
5ba49cc834 units: let's set a socket name for networkd rtnl socket
Let's make our networkd sockets recognizable purely by name. It hink
already for debugging it's a good idea to always set socket names, in
particular for services that have multiple sockets they listen on.

This adds a name to the rtnl socket, which so far missed one. Note that
the C code won't look for it, for compat with older versions, but at
least things are a bit more debuggable.
2025-11-15 07:52:42 +01:00
Lennart Poettering
a7fa29b1b5 networkd: add support for resolved hook for DHCP server
Let's synthesize DNS RRs for leases handed out by our DHCP server. This
way local VMs can have resolvable hostnames locally.

This does not implement reverse look ups for now. We can add this
later in similar fashion.
2025-11-15 07:52:42 +01:00
Lennart Poettering
d51599bbed units: systemd-pcrproduct.service measures into an NvPCR, fix that in Description=
Follow-up for: 0196abbd10
2025-11-14 22:22:39 +01:00
Lennart Poettering
867e64737a units: measure a separator event into PCR 9 after completing NvPCR initialization
We do this in a separate service (rather than inside of
systemd-tpm2-setup), since we want failures of this measurement to
result in an instant reboot, like for most our measurements.

Failures to initialize nvpcrs, or allocate an SRK are somewhat OK (and
more likely), as long as this separator communicates clearly where they
have to have taken place, if they worked.
2025-11-14 22:22:39 +01:00
Lennart Poettering
8a6e77f1a8 tpm2-setup: measure "anchor" extension early at boot into nvpcrs 2025-11-02 21:14:35 +01:00
Lennart Poettering
0196abbd10 pcrextend: automatically measure SMBIOS product ID at boot
Now that PCRs are not that expensive anymore, let's use them to measure
the SMBIOS product ID to one.
2025-11-02 21:14:35 +01:00
Lennart Poettering
f7c72e8725 importd: properly support operation in per-user mode 2025-10-21 23:09:50 +02:00
Lennart Poettering
15fec4b646 units: use Title Case for network generator description string
We use Title Case for all other units, do so here too.
2025-10-20 18:17:47 +02:00
Lennart Poettering
1f3f40f0ff networkd: call networkd a "network management" rather "network configuration" tool
This has irked me for a while. For me network configuration is the stuff
we store on disk in configuration file. And networkd then *applies* the
configuration. But the units so far claimed that networkd was the
"configuration" itself. Which I guess might make sense to some, but to
me sounds a bit unprecise. Let's clean this up, and call what networkd
is doing "Network Management".
2025-10-20 18:17:29 +02:00
Lennart Poettering
9f69ff69f7 mountfsd: make MountDirectory() work with systemd-homed
systemd-homed already applies an idmap to its mounts, hence we need to
undo it before we can create our own.
2025-10-15 10:21:59 +02:00
Mike Yuan
3dbb2fa239 system-systemd\x2dmute\x2dconsole.slice: do not disable default deps
The only default dep for slice units is exactly what's outlined
here: Conflicts= + Before=shutdown.target. Hence just drop
custom deps.
2025-10-07 13:38:21 +02:00
Mike Yuan
60e1c11dc8 units: enable MaxConnectionsPerSource= for all our Accept=yes units (-ng)
Apply 5d1e8cd3e0 on newly-added sockets.
2025-10-07 13:38:11 +02:00
Zbigniew Jędrzejewski-Szmek
29832663dc meson: drop remaining target names
Most of those were dropped in 7d247d3cb8. I left
behind the few cases where the 'output' name was different from the target name.
But we actually don't need those either, so get rid of those. (And one case
where I missed the name argument.)

No functional change, except that e.g. 'ninja -C build update-man-rules-impl'
doesn't work, but I hope nobody was using that.
2025-10-04 18:13:27 +02:00
Mike Yuan
e8d5badc5f units/systemd-battery-check.service: split [Unit] options into groups 2025-09-30 16:34:54 +02:00
Mike Yuan
997717e274 units/systemd-battery-check.service: prettify Description=
Addresses https://github.com/systemd/systemd/pull/39170#issuecomment-3348997894
2025-09-30 16:34:44 +02:00
Yu Watanabe
2c883d7591 units: move FailureAction= to the correct section
FailureAction= in [Service] is still supported but deprecated.

Follow-up for e3d4148d50.
2025-09-29 22:47:24 +02:00
Lennart Poettering
aa27bec194 firstboot: optionally, don't query for keymap unless connected to a real VT
The keymap only really matters if there's local access to a system, i.e.
if there's actually a physical kbd directly connected to it, to apply it
to. If during firstboot we are not talked to via a VT (but via SSH,
container, or hypervisor console or so instead), then it's very unlikely
we ever are. Hence, don't ask for a keymap, and let#s shortcut the
questions asked at boot.
2025-09-26 16:40:14 +02:00
Lennart Poettering
0cfaea3619 homectl: mute console while running firstboot prompts 2025-09-26 16:19:43 +02:00
Lennart Poettering
6d40d0773c homectl: make querying for shell+aux groups optional in firstboot mode 2025-09-26 16:19:43 +02:00
Lennart Poettering
0d2cc656c8 firstboot: mute console while running on the console at boot
Fixes: #34448
2025-09-26 09:42:13 +02:00
Lennart Poettering
ac63a04bd6 mute-console: add simple varlink service that can disable log/status spew to kernel console
For "wizard" style interactive tools it's very annoying if they are
interrupted by kernel log output or PID1's status output. let's add some
infra to disable this temporarily. I decided to implement this as an IPC
service so that we can make this robust: if the client request the
muting dies we can automatically unmute again.

This is hence a tiny varlink service, but it can also be started
directly from the cmdline.
2025-09-26 09:42:13 +02:00
Lennart Poettering
f5fa86f9f8 machined: allow running in --user mode 2025-09-25 22:43:59 +02:00
Lennart Poettering
d7b966ad13 firstboot: don't call this thing a "wizard"
It isn't really, it's an initial setup tool, which is what GNOME calls
their equivalent too.
2025-09-24 15:46:30 +02:00
Lennart Poettering
19f2baccce repart: add basic Varlink support, for now only with a ListCandidateDevices() call 2025-09-23 09:22:04 +02:00
Luca Boccassi
defa0148b8 units: add missing Documentation=
The initrd units are described in the graphs in the bootup manpage,
so use that one for them.
2025-09-18 21:54:36 +01:00
Lennart Poettering
818bd1dfa1 mountfsd: uncomment CapabilityBoundingSet= line
Since mountfsd was added in 702a52f4b5 the
caps bounding set line was commented. That's an accident. Fix that. (We
need to add a bunch of caps to the list).
2025-09-18 21:30:51 +02:00
Lennart Poettering
1c9500c2b7 units: explicitly reset TTY before running stuff on console
This adds TTYReset=yes to all units which run directly on the TTY. We
already had this in place for the gettys, but this adds it for the rest
that basically has StandardInput=tty + StandardOutput=tty set.

Originally, for these tools it wasn't necessary to reset the TTY,
because we after all already reset /dev/console very very early on once,
during PID1's early initialization, and hence there's no real reason to
do it again for these early boot services. But that's actually not
right, because since #36666 the TTY we reset from PID 1 is typically
/dev/console but the TTY those services are invoked on is typically the
resolved version of that, i.e. wherever that points. Now you might
think: if one is just an alias to the other, why does it matter to reset
this again? Well, because it's only a half-assed alias, and as it turns
out WIOCSWINSZ is not propagated from one to the other, i.e the terminal
dimesions we initialize for /dev/console don't propagate to whatever
that points to.

One option to address that would be to immediately propagate this down
ourselves (or to fix the kernel for it), but it felt safer to simply do
the reset again before the use, after all these one one-off services,
and there's no point in optimizing much here. Moreover, its probably
safer to give the guarantee that when the firstboot stuff (which after
all queries for pws to set) runs it definitely certainly guaranteed has
a properly reset terminal.
2025-09-18 21:30:31 +02:00
nl6720
8ec3e769b5 systemd-boot-update.service: replace --no-variables with --variables=no
bbeeea4362 replaced the option in bootctl,
so systemd-boot-update.service should follow.
2025-09-18 17:00:49 +03:00
Franck Bui
204c34040a units: don't force the loading of the loop and dm_mod modules in systemd-repart.service
This avoids loading the aforementioned modules when systemd-repart is skipped
during the boot process, which is the case most of the time.
2025-09-18 08:46:34 +09:00
Zbigniew Jędrzejewski-Szmek
28021f6e88 Some post unmerged-usr cleanups (#38696)
I noticed in our NixOS packaging that we were working around the fact
that core/swap.c looks for swapon and swapoff in /sbin

Lets make it configurable just like all the other util-linux binaries
through meson and make it default to /usr/sbin/{swapon,swapoff}

This way mounts work on a systemd without the /sbin -> /usr/sbin
compatibility symlink. (And as a side-effect has NixOS be able to have
it in /nix/store too like the other util-linux tools).

Given that `unmerged-usr` support was dropped in 255 I think this is a
safe change?
2025-09-17 14:22:05 +02:00
Yu Watanabe
8c0cad97c7 units: portabled requires /dev/loop-control
Fixes #38692.
2025-08-29 14:49:26 +09:00
Arian van Putten
fa7e3a96e4 units/*getty*: use /usr/sbin/agetty
Same way that we do it for quotaon and debug-shell by
going through meson
2025-08-24 14:01:21 +02:00
Michal Sekletar
fb56da5b6e coredump: drop RestrictSUIDSGID= option (#38640)
systemd-coredump sandbox already has ProtectSystem=strict hence all non
API filesystems are made read-only, thus RestrictSUIDSGID= doesn't buy
us much.

On top of that systemd-coredump's EnterNamespace= feature requires
openat2() to work correctly and that is implicitly blocked by
RestrictSUIDSGID=.

Follow-up for 8f8148cb08
2025-08-20 11:42:30 +01:00
Mike Yuan
8c7dfa0ff4 units/ssh-access.target: enable StopWhenUnneeded=
This combines nicely with the X_SYSTEMD_UNIT_INACTIVE= notification
we send out, to ensure when all sshd units go down the actual
status is always reflected on the target.
2025-07-22 15:01:26 +01:00
Yu Watanabe
dba4fe9a60 quotacheck: add quotacheck.mode credential support 2025-07-16 05:47:38 +09:00
Yu Watanabe
fff4dcc6de man: fix reference to systemd-quotacheck@.service
Also this makes the man page mentions systemd-quotacheck-root.service.
2025-07-16 05:47:38 +09:00
Yu Watanabe
059afcadfd fsck: add fsck.mode and fsck.repair credentials support
Maybe useful when kernel command line is hard to change, e.g. when UKI
is used.
2025-07-16 05:47:38 +09:00
Yu Watanabe
e58ba80a40 units: drop runlevel[0-6].target 2025-07-13 05:49:09 +09:00
Yu Watanabe
dc1505555b utmp: drop setting runlevel entry in utmp
This removes systemd-update-utmp-runlevel.service and related command.
2025-07-13 05:49:00 +09:00
Yu Watanabe
8ba48d4bf8 core,initctl,systemctl: kill /dev/initctl support
This also kills support for controlling system state through
/sbin/init, initctl, and telinit.
2025-07-13 05:38:14 +09:00
Yu Watanabe
7c208a64ba units: check if kmod command exists
We already check existences of quotaon in quotaon@.service and
quotacheck in systemd-quotacheck@.service.
Let's also check if kmod command exists.

Closes #38179.
2025-07-12 07:18:17 +02:00
Mike Yuan
f22187bd7e units/machines.target: fix typo
Follow-up for 48cb009afc
2025-07-11 21:38:58 +02:00
Lennart Poettering
b2f23bd2b1 Support global sysext/confext in systemd-stub/systemd-sysext (#38113)
Systemd-stub supports loading addons, credentials, system and
configuration
extensions from ESP and while addons and credentials can be both global
and
per-UKI, sysext/confext are only per-UKI. 

Add support for global sysext/confext to systemd-stub/systemd-sysext.

Fixes #37993
2025-07-11 21:10:51 +02:00
Lennart Poettering
3405b84d8c units: systems might take a while to boot
vmspawn systems might take quite a while to boot in particular if they
go through uefi and wait for a network lease. Hence let's increase the
start timeout to 2min (from 45s). We'll do that for both nspawn and
vmspawn, even though the UEFI thing certainly doesn't apply there (but
the DHCP thing still does).
2025-07-11 18:17:04 +02:00
Lennart Poettering
48cb009afc units: add units for vmspawn/nspawn in --user mode too 2025-07-11 18:17:04 +02:00
Vitaly Kuznetsov
8d07a8d6b1 sysext: Support global sysext/confext
Load global sysext/confext from /.extra/global_{sysext,confext} which
systemd-stub puts there from ESP/loader/credentials/*.{sysext,confext}.raw.
Global extensions are handled the exact same way as per-UKI ones.
2025-07-11 13:08:26 +02:00
Ubuntu
df5b3426f6 journald: support reloading configuration at runtime 2025-07-10 21:38:36 +02:00
DaanDeMeyer
cc43510a13 userdb: Add userdb.transient credentials
To implement --bind-user in systemd-vmspawn, we need a transient
version of these credentials. These are useful when the home directory
of the user is mounted into the container/vm and every trace of the user
will be (mostly) gone again when the container/vm is shut down.
2025-07-10 21:36:09 +02:00
Yu Watanabe
1cf5b39d64 core: add 'DefaultRestrictSUIDSGID' config option (#38126)
closes #37602, see there for extra motivation and considered
alternatives.

On typical systems, only few services need to create SUID/SGID files.
This often is limited to the user explicitly setting suid/sgid, the
`systemd-tmpfiles*` services, and the package manager. Allowing a
default to globally restrict creation of suid/sgid files makes it easier
to apply this restriction precisely.

## testing done
- built on aarch64-linux and x86_64-linux
- ran a VM test on x86_64-linux, checking for:
    - VM system boots successfully
    - defaults apply (both `yes`, `no`, and undefined)
    - systemd tmpfiles can set suid/sgid on journal log path
- Other services explicitly defining `RestrictSUIDSGID=no` can create
suid files
2025-07-10 13:30:07 +09:00
Grimmauld
fd3b207011 units/systemd-tmpfiles-setup.service: explicitly set RestrictSUIDSGID=no
The tmpfiles service is used to set file permissions, e.g. for setting
suid bit on the journal log directory [1].

[1] 48e0f7bc2f/tmpfiles.d/systemd.conf.in (L24-L25)
2025-07-09 11:08:31 +02:00