Commit Graph
57393 Commits
Author SHA1 Message Date
Yu Watanabe d065fdd337 bus-wait-for-jobs: fix failed job logging (#40043)
Follow-ups for 0d91a204cb.
Fixes #40030.
2025-12-10 19:00:39 +09:00
David Tardon 085c2a2338 manager-serialize: add logging for ENOMEM 2025-12-10 18:59:44 +09:00
David Tardon 94446e4f5a tree-wide: flatten nested error checks 2025-12-10 18:59:44 +09:00
Zbigniew Jędrzejewski-Szmek 13a74f350e tar-util: allow to build without acl support (#39965)
This adds minimal definitions provided by libacl to make tar-util built
without libacl support.
Fixes the following compile error:
```
../src/shared/tar-util.c:62:9: error: unknown type name 'acl_t'
   62 |         acl_t acl_access, acl_default;
      |         ^~~~~
```

Follow-up for 4ded7f7a43.
Fixes #39928.
Replaces #39954.
2025-12-10 09:42:50 +01:00
Yu Watanabe fc7aca10c9 bus-wait-for-jobs: assign unique error code from service result 2025-12-10 17:22:35 +09:00
Pasquale van Heumen ca1d2ae5d6 resolve: always read /etc/resolv.conf on reload systemd-resolved
When systemd-resolved is used in resolv.conf foreign mode, reloading the
systemd-resolved daemon does not read resolv.conf when not touched since
the last time resolved read the file. Since the DNS servers list is
flushed during a reload, resolved forgets about the servers
in /etc/resolv.conf

When reloading the daemon it is expected that all configuration is
reloaded regardless of the disk timestamps.
2025-12-10 04:56:23 +09:00
Ricardo Salveti a40f4ba1a8 boot: handle empty initrd files (#40040)
Commit f8fa4222c9 added extra logic to
account for the size of the initrds before allocating the required memory pages,
but missed checking if the initrds were empty before allocating memory.

Extend the initrd options only when the initrd is valid, and add extra
check for validating that there is at least one valid initrd file before
allocating memory, fixing the following crash when booting with empty
initrd files:

src/boot/log.c:30@efi_assert: systemd-boot: Assertion
 'BS->AllocatePages(type, memory_type, n_pages, &addr) == EFI_SUCCESS'
failed at /usr/src/debug/systemd-boot/257.8/src/boot/util.h:95@xmalloc_pages, halting.

Fixes: f8fa4222c9
("boot: Make initrd_prepare() semantically equivalent to combine_initrds()")
2025-12-10 04:55:57 +09:00
Yu Watanabe 286527a1c1 bus-wait-for-jobs: do not say "Unexpected job result" when job is simply failed 2025-12-10 04:20:39 +09:00
Yu Watanabe 473f427757 bus-wait-for-jobs: use SYNTHETIC_ERRNO()
Since 0d91a204cb, we always logs
something. Hence, we can use SYNTHETIC_ERRNO().
2025-12-10 04:16:25 +09:00
Yu Watanabe 0fe1de0812 bus-wait-for-jobs: fix quiet argument for log_job_error_with_service_result()
The argument 'quiet' is a boolean, not a integrer and not a log level.

Follow-up for 0d91a204cb.
Fixes #40030.
2025-12-10 04:16:21 +09:00
Yu Watanabe cbe34b4e73 tar-util: allow to build without libacl support
Fixes #39928.
Follow-up for 4ded7f7a43.
2025-12-10 00:49:27 +09:00
Yu Watanabe f75c49916b tar-util: allocate ACL entry only when necessary
Follow-up for 4ded7f7a43.
2025-12-10 00:49:27 +09:00
Yu Watanabe 4976d6e9ac acl-util: define minimal types and constants even when acl support is disabled 2025-12-10 00:48:37 +09:00
Jeremy Kerr b10b4303c6 udev-builtin-net_id: fix construction of USB specifier-based names
Commit 0bac1ed242 ("tree-wide: Fix constness issues with newer glibc")
split a temporary var in get_usb_specifier to const and non-const
versions, but missed converting a couple of uses. This means we get
names of with components of:

 port: uN
 config: cC.I
 interface: iC.I

instead of:

 port: uN
 config: cC
 interface: iI

This results in net names like enu1c1.0i1.0, as we also no longer hit
the config==1 and interf==0 elision cases.

Change the config portion handling to start from the correct position,
and the earlier check for NULL.
2025-12-10 00:24:01 +09:00
Lukáš Zaoral 1e5498e237 ukify: prefer compression.zstd when available
Python 3.14 introduced support for zstd in the standard library [1].  Therefore,
let's prefer it when available to decrease the number of necessary  external
dependencies.

[1] https://docs.python.org/3/whatsnew/3.14.html#whatsnew314-zstandard
2025-12-09 14:37:22 +09:00
David Tardon 7cfd4f3f51 find-esp: consistently quote paths in log messages 2025-12-09 14:36:31 +09:00
David Tardon 50482aced5 find-esp: replace assert by a runtime check
The path--as a whole--is no longer being opened with O_DIRECTORY, hence
the assertion is not valid.

Reproducer:
 # SYSTEMD_RELAX_ESP_CHECKS=1 bootctl list --esp-path=`pwd`/README
 Assertion 'S_ISDIR(sxa.stx_mode)' failed at src/shared/find-esp.c:295, function verify_fsroot_dir(). Aborting.

Follow-up-for: 63105f33ed

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2417917
2025-12-09 14:36:31 +09:00
Luca Boccassi 28c68dbea0 portabled: list new methods in D-Bus policy
Access to these methods is also managed via polkit,
but they were never added to the access list in the
D-Bus policy.

Follow-up for 907952bbc9
2025-12-09 12:00:59 +09:00
Daan De Meyer 1075316a4b machine: Fix hardcoded /var/lib/machines paths 2025-12-08 14:56:39 +01:00
q66 c39238bdc8 import: include unistd.h for pipe2
This is needed for e.g. pipe2 and unlinkat and a build failure
is reproducible when libarchive support is disabled.
2025-12-08 08:33:56 +09:00
Yu Watanabe 80cfe9abf2 test: several fixlets/workarounds for supporting postmarketOS (#39905) 2025-12-07 10:16:58 +09:00
Morgan 97887d09a8 logind: fix initial button state is not fetched when device is registered late (#39978)
If buttons that are not initialized from manager_startup() due to still
being processed by udev, the initial state is not checked. (commit
405be62f05)

This caused a problem which initial "close" state being not recognized
if lid switch of some system getting initialized later.
2025-12-07 09:48:49 +09:00
Yu Watanabe f117629f28 test: skip several test cases when built with musl 2025-12-07 09:09:03 +09:00
Yu Watanabe 355bcc243c test: support coreutils built with --enable-single-binary=symlinks
Alpine/postmarketOS build coreutils with --enable-single-binary=symlinks.
In that case, all commands provided by coreutils are symlink to
/usr/bin/coreutils, and it calls prctl(PR_SET_NAME, argv[0]), hence the comm
will be the path to the symlink.

This also makes not kill sleep command with SIGKILL in TEST-17-UDEV, that is
totally unnecessary.
2025-12-07 09:09:03 +09:00
Yu Watanabe 3672e24e75 test-seccomp: do not fail when already MemoryDenyWriteExecute= is enabled 2025-12-07 09:09:03 +09:00
David Tardon d23a7eb4c0 udev-rules: use the right variable
We carefully prepare a copy of a local buffer to save in device cache
and then save the buffer there instead... This leads to abort in free()
on exit (also, copied is leaked).

Reproducer:
 # udevadm test /sys/block/sr0

Follow-up-for: a9559ebcbc

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2406118
2025-12-06 02:29:24 +09:00
Luca Boccassi fdb9ad1a44 pid1: do not fail if dlopen of libmount fails because it is not compiled in
It is now possible to build and run without libmount. But if support
is compiled in, then we need to be able to load it. Hence gracefully
skip it when support is not compiled in, but fail otherwise.
2025-12-06 01:36:43 +09:00
Luca Boccassi 64ba571576 Reapply "pid1: pull in libmount unconditionally"
It was actually intended to load libmount very early, as it is
needed by more than just mount units, such as umount_recursive(),
bind_remount_recursive(), get_sub_mounts(), etc.

Fixes https://github.com/systemd/systemd/issues/39994

This reverts commit 46b4b33c25.
2025-12-06 01:36:43 +09:00
Zbigniew Jędrzejewski-Szmek 12391431c2 machined: add description to varlink server, unify error messages
manager_varlink_init_resolve_hook and manager_varlink_init_userdb are very
similar, but one didn't set a description and the other one had an error
message which didn't print the offending path.

Define constants for the paths, and also change other similar constants
to have slightly shorter names. (It's an "address" and "path", but we don't
need to have both parts in the name, esp. that it makes the name very long.)
2025-12-05 12:17:06 +01:00
Zbigniew Jędrzejewski-Szmek 9454927c76 sd-netlink: read error message for NFNL_MSG_BATCH_BEGIN (#39967)
Before:
```
$ unshare --user --map-users=0:$(id -u):1 --map-groups=0:$(id -g):1 build/test-firewall-util
/* test_v6 */
src/test/test-firewall-util.c:34: Assertion failed: "r = fw_nftables_add_masquerade(nfnl, true, AF_INET6, &u1, 128)" failed with unexpected error: -110/ETIMEDOUT
Aborted (core dumped)
```

After:
```
$ unshare --user --map-users=0:$(id -u):1 --map-groups=0:$(id -g):1 /var/build/test-firewall-util
/* test_v6 */
test-firewall-util: Failed to add IPv6 masquerade, skipping tests: Operation not permitted
/* test_v4 */
test-firewall-util: Failed to add IPv4 masquerade, skipping tests: Operation not permitted
```
2025-12-05 12:12:03 +01:00
Colin Walters 3c85d99c79 man: Clarify secure-boot-enroll defaults
Clarify in the docs that `if-safe` is the default by noting
that in the text for it, but also moving it to the first mentioned
option.

Make explicit in `man systemd-boot` that the `secure-boot-enroll`
option is specified in the `loader.conf`

Update an outdated comment in boot.c around the same.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-05 11:57:18 +01:00
Luca Boccassi eb98ddd8b8 sysupdate: also mention patterns to match in error log on failure
The gpt uuid is not the only thing that needs to match, the pattern
does as well, so mention it in the error log if present
2025-12-05 10:09:38 +00:00
Zbigniew Jędrzejewski-Szmek d9e894ef72 Fix systemctl start --verbose off-by-one logs (#39927) 2025-12-05 11:09:14 +01:00
Yu Watanabe 53f5aa3fd2 musl: introduce wrappers for getopt() and getopt_long()
musl's getopt_long() behaves something different in handling optional arguments:
```
$ journalctl _PID=1 _COMM=systemd --since 19:19:01 -n all --follow
Failed to add match 'all': Invalid argument
```
This introduces getopt_long_fix() that reorders the passed arguments to make
getopt_long() provided by musl works as what we expect.

Also, musl's getopt() always behaves POSIXLY_CORRECT mode, and stops parsing
arguments when a non-option string found. Let's always use getopt_long().
2025-12-05 11:01:09 +01:00
Yu Watanabe 26b2085d54 include: update kernel headers from v6.18 2025-12-04 11:10:03 +00:00
Yu Watanabe 84990e08e5 test-firewall-util: allow to run test-firewall-util
Now fw_nftables_add_masquerade() should return EOPNOTSUPP or so if
unprivileged. It is not necessary to skip whole tests earlier.
2025-12-04 08:24:28 +09:00
Yu Watanabe 691d63dbdd sd-netlink: also read the reply for NFNL_MSG_BATCH_BEGIN message
When we send a batch of nfnl messages, but e.g. without sufficient
privilege, the kernel may only return an error message for
NFNL_MSG_BATCH_BEGIN and ignore all later messages.
So, we need to read the response for the NFNL_MSG_BATCH_BEGIN,
and if it is an error ignore the replies for the rest.
2025-12-04 08:24:28 +09:00
Yu Watanabe ea97ca9a06 sd-netlink: drop unused ret_messages argument
This is not only unused, the kernel never provide any meaningful reply
for batch message. Let's drop it.
2025-12-04 08:24:28 +09:00
Yu Watanabe 991703009e sd-netlink: introduce sd_netlink_ignore_serial()
When we send a message with NLM_F_ACK, but if later we are not
interested in the reply and do not want to call sd_netlink_read(),
the reply will be stored in the rqueue forever.

Let's introduce a way to ignore received message without waiting reply.
2025-12-04 08:24:28 +09:00
Yu Watanabe 32682ba02d sd-netlink: introduce netlink_now() and move timespan_to_timestamp()
When sd-event is attached to the sd-netlink object, use the timestamp of
the current event, otherwise call now().

This mostly change nothing. Preparation for later change.
2025-12-04 08:24:28 +09:00
Yu Watanabe 69646ac0e2 include: fix typo
Follow-up for ec32732043.
2025-12-04 07:50:26 +09:00
Daan De Meyer 2253b4c35d dissect: Stop refusing external verity settings for mountfsd
These are supported now so no point in refusing them in systemd-dissect
2025-12-03 22:13:48 +00:00
Antonio Alvarez Feijoo a308e97ad2 run-generator: use generator_add_symlink() 2025-12-03 15:52:55 +01:00
Antonio Álvarez Feijoo 4ae16cf9b7 kernel-install: exit with option --json=help (#39974)
In that case, `parse_json_argument()` returns 0.

Follow-up for bdd36c003d (v255).
2025-12-03 01:56:01 +09:00
Luca Boccassi ce3acf9acb cryptsetup: downgrade dlopen not compiled message to debug
Every other log in this function is debug level, so downgrade this too.
Otherwise compiling without libcryptsetup means sd-executor logs at
error level when starting any service, regardless of whether it is
needed or not.

Fixes https://github.com/systemd/systemd/issues/39968

Follow-up for efaf5a763d
2025-12-02 16:52:24 +00:00
Yu Watanabe 929ce35f8d meson: rework include_directories() and finding of tools (#39956)
This is a cleanup in preparation for later additions.
2025-12-02 20:07:37 +09:00
Lennart Poettering 722dc73699 machined: in --user mode, restrict register access to our own UID, and that's it
This is a follow-up for 119d332d9c and
ensures the check only is applied to the system instance of machined. It
doesn't really apply to the per-user instance, because we never want to
permit differently privileged clients access anyway.

(The process_is_owned_by_uid() call might fail if invoked unpriv, hence
there's value in not calling it if machined runs in --user mode, it's
what makes machined actually work)
2025-12-02 13:34:20 +09:00
Lennart Poettering 81e79ee499 exec-invoke: fix type for gid 2025-12-02 13:34:05 +09:00
Luca Boccassi a3b6ad69ab cgroup-util: fix cg_pid_get_user_unit() to actually query user units
Refactor switched to the wrong implementation for this inline,
breaking querying for user units

Fixes https://github.com/systemd/systemd/issues/39949

Follow-up for 015025cba2
2025-12-02 10:50:41 +09:00
Zbigniew Jędrzejewski-Szmek 322f6adbcd meson: add tools/meson.build
Previously, we looked for scripts in the tools/ directory ad hoc,
wherever they were needed. Let's do those checks in one place.
The main meson.build file is shrunk somewhat, which is always nice.
2025-12-01 16:18:11 +01:00