1
0
mirror of https://github.com/systemd/systemd synced 2025-10-06 00:13:24 +02:00
Commit Graph

83892 Commits

Author SHA1 Message Date
Pascal Bachor
9b5f1a6112 bash-completion: update systemd-sysext, systemd-confext 2025-09-26 20:20:49 +02:00
Pascal Bachor
b85887ead1 sysext: support --mutable=help 2025-09-26 20:20:31 +02:00
Sebastian Gross
582a1e1877 network-generator: ip: do not fail on ntp value
linux https://www.kernel.org/doc/html/latest/admin-guide/nfs/nfsroot.html
states `ntp0-ip` as parameter to `ip=` command line.

Until now systemd-network-generator would fail if ntp was provided with
-EINVAL due to trailing arguments.

Stay in line with kernel doc and handle ntp value properly.
2025-09-26 21:11:11 +09:00
Daan De Meyer
4feade85d7 dissect: Add more debug logging (#39125) 2025-09-26 11:53:35 +02:00
Daan De Meyer
f9b46986e1 dissect: Add more debug logging 2025-09-26 11:53:05 +02:00
Daan De Meyer
677785c8f8 ssh-proxy: Add support for per user machined
Let's check both the per user machined and the system machined instead
of only the system machined. We give preference to the per user machined
and fall back to the system machined.
2025-09-26 11:13:32 +02:00
Lennart Poettering
bd4c39a384 mute console kernel log/pid1 status output while firstboot is running (#39101)
This is also preparation for the installer later, split out of #38764.
It makes the experience a lot nicer if our nice little tools aren't
constantly interrupted by log spew from the kernel.

Fixes: #34448
2025-09-26 11:12:24 +02:00
Lennart Poettering
83b6ef9b62 libselinux: turn into dlopen() dep 2025-09-26 11:12:04 +02:00
Lennart Poettering
26cde6f0ce update TODO 2025-09-26 10:03:12 +02:00
Itxaka
1e9c9773b9 Parse a new profile key in Type 1 boot entries
This allows Type 1 entries to take advantage of multiprofile efi files
by allowing the configuration of the profile associated with that entry.

It will now parse the profile key in a Type 1 config to select that
profile when booting that efi file instead of relaying in the cmdline

Signed-off-by: Itxaka <itxaka@kairos.io>
2025-09-26 10:00:43 +02:00
Lennart Poettering
971637c47d firstboot: get rid of pointless strjoina() 2025-09-26 09:43:45 +02:00
Lennart Poettering
82a48eb1db test: add simple test case for mute-console service 2025-09-26 09:42:13 +02:00
Lennart Poettering
2eb0820d86 varlinkctl: send READY=1 for --more calls once we received first reply 2025-09-26 09:42:13 +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
40e742be3c prompt-util: add client helper for muting the console 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
45c04464dc shutdown: move printk changing code int generic code 2025-09-26 09:39:00 +02:00
Daan De Meyer
a93593df2f dissect: Add full stop to debug log messages in dissect_image() 2025-09-26 09:26:06 +02:00
Yu Watanabe
97940e77a9 mkosi: bump fedora from 42 to 43
It seems
- the address sanitizer on fedora 42 reports false-positive, or
- probing partitions in libblkid 2.40.4 has a bug.

Not sure which causes the issue, but anyway the address sanitizer
kills udev-worker when sym_blkid_partition_get_name() is called
in udev-builtin-blkid.c.
```
systemd-udevd[488]: ==488==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffdd716e020 at pc 0x563e3ca66fcb bp 0x7ffdd716d970 sp 0x7ffdd716d968
systemd-udevd[488]: READ of size 8 at 0x7ffdd716e020 thread T0 ((udev-worker))
(snip)
systemd-udevd[488]: HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
systemd-udevd[488]:       (longjmp and C++ exceptions *are* supported)
systemd-udevd[488]: SUMMARY: AddressSanitizer: stack-buffer-underflow (/usr/bin/udevadm+0x187fca) (BuildId: 1fb56dbdf0447aba1185d6e34560b782b76098be)
(snip)
systemd-udevd[488]: Command: (udev-worker)
systemd-udevd[488]: ==488==ABORTING
```

Let's bump fedora from 42 to 43.

Fixes mkosi fedora 42 job failures after c349edfe49.
2025-09-26 09:14:13 +02:00
Anton Tiurin
59d946ee6b networkd: fia xRequiredOperationalStateForOnline serializtion
In integration tests (for example TEST-85-NETWORK-NetworkctlTests)

LINK_OPERSTATE_RANGE_INVALID and required_for_online == -1 are serialized as
```
"RequiredForOnline": "true",
"RequiredOperationalStateForOnline": [null, null]
```
Such link should be reported as required_for_online=False and not
serialize nulls.
2025-09-26 14:55:50 +09:00
Anton Tiurin
9893859beb networkctl: change bitrate format from 'bps' to 'Bps' 2025-09-26 14:41:20 +09:00
Luca Boccassi
996e6d0d89 nspawn: free D-Bus error before fallback (#39131)
Otherwise the next call fails:

Got message type=error sender=:1.5 destination=:1.470 path=n/a 
    interface=n/a member=n/a cookie=151 reply_cookie=3 signature=s
    error-name=org.freedesktop.DBus.Error.UnknownMethod
    error-message=Unknown method CreateMachineEx or interface
    org.freedesktop.machine1.Manager. Assertion
'!bus_error_is_dirty(reterr_error)' failed at
    src/libsystemd/sd-bus/sd-bus.c:2396, function sd_bus_call(). Aborting.

Follow-up for d80af3b97b
2025-09-26 14:00:48 +09:00
Yu Watanabe
0f44a6c64a core: assorted fixes and cleanups for cgroup (#39094) 2025-09-26 13:56:25 +09:00
Yu Watanabe
10b2d19219 timer: fix unexpected triggering of service immediately after restart of a timer (#38868)
Fixes: #31231
Fixes: #35805
2025-09-26 09:51:36 +09:00
Yu Watanabe
e8a5cda471 core/bpf-firewall: replace unnecessary unit_setup_cgroup_runtime() with unit_get_cgroup_runtime()
Except for the test, bpf_firewall_compile() is only called by the following:
  cgroup_context_apply() -> cgroup_apply_firewall() -> bpf_firewall_compile()
and in the early stage of cgroup_context_apply(), it checks if the cgroup
runtime exists. Hence, it is not necessary to try to allocate the
runtime in bpf_firewall_compile().
2025-09-26 09:28:12 +09:00
Yu Watanabe
13b0e7fc6d core/bpf-firewall: make failures in loading custom BPF program not critical
All other resource control features work as 'best-effort', and failures
in applying them are handled gracefully. However, unlike the other features,
we tested if the BPF programs can be loaded and refuse execution on failure.

Moreover, the previous behavior of testing loading BPF programs had
inconsistency: the test was silently skipped if the cgroup for the unit does
not exist yet, but tested when the cgroup already exists.

Let's not handle failures in loading custom BPF programs as critical, but
gracefully ignore them, like we do for the other resource control features.

Follow-up for fab347489f.
2025-09-26 09:28:12 +09:00
Yu Watanabe
8b4ee3d68d core/unit: fail earlier before spawning executor when we failed to realize cgroup
Before 23ac08115a, even if we failed to
create the cgroup for a unit, a cgroup runtime object for the cgroup is
created with the cgroup path. Hence, the creation of cgroup is failed,
execution of the unit will fail in posix_spawn_wrapper() and logged
something like the following:
```
systemd[1]: testservice.service: Failed to create cgroup /testslice.slice/testservice.service: Cannot allocate memory
systemd[1]: testservice.service: Failed to spawn executor: No such file or directory
systemd[1]: testservice.service: Failed to spawn 'start' task: No such file or directory
systemd[1]: testservice.service: Failed with result 'resources'.
systemd[1]: Failed to start testservice.service.
```

However, after the commit, when we failed to create the cgroup, a cgroup
runtime object is not created, hence NULL will be assigned to
ExecParameters.cgroup_path in unit_set_exec_params().
Hence, the unit process will be invoked in the init.scope.
```
systemd[1]: testservice.service: Failed to create cgroup /testslice.slice/testservice.service: Cannot allocate memory
systemd[1]: Starting testservice.service...
cat[1094]: 0::/init.scope
systemd[1]: testservice.service: Deactivated successfully.
systemd[1]: Finished testservice.service.
```
where the test service calls 'cat /proc/self/cgroup'.

To fix the issue, let's fail earlier when we failed to create cgroup.

Follow-up for 23ac08115a (v258).
2025-09-26 09:28:12 +09:00
Lennart Poettering
b3243f4bee libmount: make dlopen() dependency 2025-09-26 08:29:37 +09:00
Yu Watanabe
b97b8fd4e3 machined: introduce per-user instance (#39123)
This is the first part of #38728, just the machined stuff, no the
importd stuff.

This definitely makes sense of its own, hence let's get this in first.

The original PR contains a tescase that tests machined + importd in
combination. This PR here hence is without a testcase, but it's there,
just in the other PR.

This looks large and is large, but do note that much of the machined
changes are very repetitive: they conditionalize PK checks to the system
version, as PK doesn't make sense in the use rversion.
2025-09-26 08:16:18 +09:00
Yu Watanabe
a925cea9f2 core/cgroup: make sure deserialized accounting data is not voided (#39130) 2025-09-26 07:54:48 +09:00
Yu Watanabe
22fc89f54d man: fix typo
Follow-up for 73ee723aa7.
2025-09-26 07:24:17 +09:00
Yu Watanabe
5c60d3011f integration tests: do not adjust log level in the test script
We passes log level through kernel command line. It is not necessary to
set to debug level at the beginning, and set to info at the end.
This is important when a test has several subtests. If a subtest sets
log level to info at the end, then subsequent tests may not generate any
useful logs.
2025-09-26 07:20:04 +09:00
Matteo Croce
ba8801a076 libseccomp: fix build error
When HAVE_SECCOMP is not set, a build error happens:

../src/analyze/analyze-security.c: In function ‘get_security_info’:
../src/analyze/analyze-security.c:2449:13: error: unused variable ‘r’ [-Werror=unused-variable]
 2449 |         int r;
      |             ^
cc1: some warnings being treated as errors

Fix it by removing the sometimes unused variable.
2025-09-26 07:19:29 +09:00
Mike Yuan
055a5a236c core/cgroup: make sure deserialized accounting data is not voided
Currently, cgroup_path is (de-)serialized after all the cached
accounting data. This is bogus though, since unit_set_cgroup_path()
destroys the CGroupRuntime object and starts afresh, discarding
all deserialized values. This matters especially for IP accounting,
whose BPF maps get recreated on reload/reexec and the previous values
are exclusively retrievable from deserialization. Let's hence swap things
around and serialize cgroup_path first, accounting data only afterwards.
2025-09-25 22:55:14 +02:00
Mike Yuan
e99f741cdf core/cgroup: realign macro line continuation 2025-09-25 22:55:14 +02:00
Lennart Poettering
d9c5566c0f machined: make image locking runtime scope aware, too
We cannot create an image lock in /run if we are unpriv, hence create it
in $XDG_RUNTIME_DIR instead.
2025-09-25 22:43:59 +02:00
Lennart Poettering
1966baf2d6 machinectl: add support for user-scoped operation 2025-09-25 22:43:59 +02:00
Lennart Poettering
f5fa86f9f8 machined: allow running in --user mode 2025-09-25 22:43:59 +02:00
Lennart Poettering
e1b3319b6c discover-image: support runtime scope also for .nspawn settings files and the pool dir
discover-image.[ch] largely already supports per-scope operations, let's
extend this however to also cover finding .nspawn settings files and
managing the pool dir.
2025-09-25 22:43:59 +02:00
Lennart Poettering
b7f6bdbbd3 service-util: add generic parser for runtime scope 2025-09-25 22:43:59 +02:00
Lennart Poettering
0011ecd6fa path-lookup: add runtime_directory_generic() helper 2025-09-25 22:43:59 +02:00
Lennart Poettering
abf518a8dc runtime-scope: add runtime_scope_to_socket_mode() helper 2025-09-25 22:43:59 +02:00
Yu Watanabe
3b6288f6be osc-context: fix typo: 8003 -> 3008
Follow-up for dadbb34919 (v258).
2025-09-26 05:42:04 +09:00
Luca Boccassi
c5e48e3a66 machined: do not allow unprivileged users to shell into the root namespace
We intend to make self-registering machines an unprivileged operation,
but currently that would allow an unprivileged user to register a
process they own in the root namespace, and then login as any
user they like, including root, which is not ideal.

Forbid non-root from shelling into a machine that is running in
the root user namespace.
2025-09-25 22:13:05 +02:00
Mantas Mikulėnas
6cae201ca1 resolve: undo change to return code of next_search_domain() (#39119)
This caused resolved to only consider the 1st search domain of every
interface and ignore the rest.

Fixes a regression caused by 81ae2237c1 (v258).
Fixes #39118.
2025-09-26 04:52:18 +09:00
Lennart Poettering
aaca6bd5d9 libseccomp: turn into dlopen() dependency 2025-09-26 03:30:11 +09:00
Yu Watanabe
04e434cedb find-esp: fix error handling
Follow-up for 4b2b2f3ab7.
2025-09-25 20:08:13 +02:00
Daan De Meyer
946cc446c0 gpt: Introduce function to convert verity hash or sig to data partition
Let's rename the existing partition_verity_to_data() to
partition_verity_hash_to_data() and make a new partition_verity_to_data() that
handles both verity hash and verity signature partitions.

Rename other functions to match the new naming.
2025-09-25 20:06:11 +02:00
Luca Boccassi
d5eb732724 mkosi: pull in bsdutils for script, used by various integration tests
4971s TEST-74-AUX-UTILS.sh[1212]: + script -ec 'networkctl edit --runtime "$NETWORK_NAME"' /dev/null
4971s TEST-74-AUX-UTILS.sh[1269]: .//usr/lib/systemd/tests/testdata/units/TEST-74-AUX-UTILS.networkctl.sh: line 55: script: command not found

Currently works due to a transitive dependency somewhere else
that is being dropped, pull it in directly given the tool is
used by the tests
2025-09-25 15:11:17 +01:00
Daan De Meyer
2c4263f987 dissect: Add more debug logging
Currently it's next to impossible to find out why dissect_image()
has failed with EADDRNOTAVAIL, so let's add debug logging and use
EREMOTE for the different architectures error to help out with
debugging a bit.
2025-09-25 14:11:36 +02:00