Commit Graph

84736 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
238bb65c0f meson: make persistent journal the default 2025-11-13 00:08:31 +01:00
Zbigniew Jędrzejewski-Szmek
7af88c1e1e journald: allow default storage mode to be configured
So far the idea was that the default is 'auto', and if appropriate, the
distribution will create /var/log/journal/ to tell journald to use persistent
mode. This doesn't work well with factory resets, because after a factory reset
obviously /var/log is gone. That old default was useful when journald was new
and people were reluctant to enable persistent mode and instead relied on
rsyslog and such for the persistent storage. But nowadays that is rarer, and
anyway various features like user journals only work with persistent storage,
so we want people to enable this by default. Add an option to flip the default
and distributions can opt in. The default default value remains unchanged.

(I also tested using tmpfiles to instead change this, since we already set
access mode for /var/log/journal through tmpfiles. Unfortunately, tmpfiles runs
too late, after journald has already started, so if tmpfiles creates the
directory, it'll only be used after a reboot. This probably could be made to
work by adding a new service to flush the journal, but that becomes complicated
and we lose the main advantage of simplicity.)

Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1387796.
2025-11-13 00:08:31 +01:00
Zbigniew Jędrzejewski-Szmek
7e9a787a86 man: stop inventing custom entity names for docbook
For some reason, the entity names configured in custom-entities.ent
used abbreviated names. This just creates unnecessary confusion, so update
to use the same name as the config dict.

Reword some surrounding sentences while at it.
2025-11-13 00:08:27 +01:00
Zbigniew Jędrzejewski-Szmek
e601bed945 meson: make journald.conf templated
A noop, in preparation for subsequent changes.
2025-11-13 00:07:12 +01:00
Zbigniew Jędrzejewski-Szmek
e1ddcb1125 man: fedora 43 is the latest stable 2025-11-12 23:01:48 +00:00
Zbigniew Jędrzejewski-Szmek
aff5c0af8b docs/BACKPORTS: update
We now keep stable branches in the main repo. Update the description
to match current practice.

Closes https://github.com/systemd/systemd/issues/35846.
2025-11-12 23:01:35 +00:00
Luca Boccassi
56d19b633d boot: coding style cleanups 2025-11-12 23:44:06 +01:00
Yu Watanabe
43e4c91fc0 musl: avoid conflict between fcntl.h and basic-forward.h
glibc defines AT_FDCWD as -100, but musl defines it as (-100).
In basic-forward.h, we also define AT_FDCWD as -100, hence musl's fcntl.h
conflicts with forward.h. This is for avoiding the conflict.
2025-11-12 23:28:01 +01:00
Yu Watanabe
fe6e6cb6a0 time-util: several fixlets/workarounds for supporting musl (#39688) 2025-11-13 05:18:25 +09:00
Yu Watanabe
d278d5bc3d sd-journal: fix relative path handling (#38681)
Fixes #38667.
2025-11-13 05:12:00 +09:00
Yu Watanabe
ca3933bf49 core/dbus-service: validate type of received ExecContext fds (#39680) 2025-11-13 05:11:07 +09:00
Yu Watanabe
7ebfcfc17b meson: add musl support (#39686) 2025-11-13 05:10:22 +09:00
Yu Watanabe
7dad0db2ee musl: meson: gracefully disable gshadow, nss, and idn support
- musl does not support gshadow, and does not provide gshadow.h,
- musl does not support nss, and does not provide nss.h which is necessary
  for each nss modules,
- musl does not provide NI_IDN.
2025-11-13 04:44:32 +09:00
Yu Watanabe
17e343b58b musl: meson: check existence of renameat2()
musl-1.2.5 does not provide renameat2(). Note, it is added by
05ce67fea9,
hence hopefully it will be provided by musl-1.2.6 or newer.
2025-11-13 04:44:00 +09:00
Yu Watanabe
0736854da9 musl: meson: make musl not define wchar_t in their header
Otherwise, musl defines wchar_t as int, which conflicts with the
assumption by sd-boot, i.e. wchar_t is 2 bytes.

Fixes the following build error:
```
In file included from ../src/boot/efi-log.h:4,
                 from ../src/boot/linux_x86.c:13:
../src/boot/efi.h:19:24: error: conflicting types for 'wchar_t'; have 'short unsigned int'
   19 | typedef __WCHAR_TYPE__ wchar_t;
      |                        ^~~~~~~
In file included from /usr/include/stddef.h:19,
                 from ../src/boot/efi.h:9:
/usr/include/bits/alltypes.h:10:13: note: previous declaration of 'wchar_t' with type 'wchar_t' {aka 'int'}
   10 | typedef int wchar_t;
      |             ^~~~~~~
```
2025-11-13 04:44:00 +09:00
Yu Watanabe
fb33d20c07 musl: meson: explicitly set _LARGEFILE64_SOURCE
glibc sets it when _GNU_SOURCE is defined, however, musl does not.
Let's explicitly define it to make getdents64() and struct dirent64
available even when building with musl.
2025-11-13 04:44:00 +09:00
Yu Watanabe
bd19ffd9cb musl: meson: explicitly link with libintl when necessary
On some musl based distributions dgettext() may be provided by libintl.so.
Hence, we need to add dependency in that case.
2025-11-13 04:44:00 +09:00
Yu Watanabe
a4c45279a7 musl: meson: allow to choose libc implementation
This also introduces skeleton directories for storing musl specific code.
2025-11-13 04:44:00 +09:00
Daan De Meyer
e182d66faa test-varlink: Migrate to new assertion macros 2025-11-12 19:59:05 +01:00
Daan De Meyer
3150c34270 run0: Never ask --empower sessions for polkit auth
A --empower session is effectively root without being UID 0, so it
doesn't make sense to enforce polkit authentication in those. Let's
add the empower group, add --empower sessions to that group and ship
a polkit rule to skip authentication for all users in the empower
group.

(As a side-effect this will also allow users to add themselves to this
group outside of 'run0 --empower' to mimick NOPASSWD from sudo)
2025-11-12 19:55:35 +01:00
Yu Watanabe
f8a3ae1be6 musl: test-time-util: skip parsing back when currently unused timezone is set 2025-11-13 03:13:59 +09:00
Yu Watanabe
8d5b306bb9 musl: time-util: skip tm.tm_wday check
musl does not set tm_wday when it is explicitly requested.
The check is not necessary at all, it is just for safety.
Let's skip it when built with musl.
2025-11-13 03:13:59 +09:00
Yu Watanabe
6431f2e072 musl: time-util: introduce get_tzname() helper function
musl leaves the DST timezone name unset if there is no DST.
The helper function maps that back to no DST.
2025-11-13 03:13:55 +09:00
Yu Watanabe
3ac4d68498 musl: time-util: make parse_gmtoff() accept extended timezone offset format
musl v1.2.5 does not support %z specifier in strptime(). Since
fced99e93d
%z is supported, but it only supports strict RFC-822/ISO 8601 format,
that is, 4 digits with sign (e.g. +0900 or -1400), but does not support
extended format: 2 digits or colon separated 4 digits (e.g. +09 or -14:00).
Let's add fallback logic to make it support the extended timezone spec.
2025-11-13 02:40:32 +09:00
Daan De Meyer
d82d500b40 Migrate various tests to new assertion macros (#39691)
Split out of #39608
2025-11-12 16:17:38 +01:00
Mike Yuan
8be3780699 core/dbus-service: validate type of received ExecContext fds 2025-11-12 15:44:51 +01:00
Mike Yuan
51bb3a0932 logind-session-dbus: use fd_vet_accmode() where appropriate 2025-11-12 15:44:50 +01:00
Mike Yuan
2c5d73660e test-fd-util: add unit test for fd_vet_accmode()
Co-authored-by: Chris Down <chris@chrisdown.name>
2025-11-12 15:44:50 +01:00
Mike Yuan
7cf4f07567 fd-util: introduce fd_vet_accmode()
Inspired by #39674
2025-11-12 15:44:50 +01:00
Yu Watanabe
733c5c98ad sd-journal: resolve paths passed to sd_journal_open_files() and friends
Fixes #38667.
2025-11-12 15:18:40 +01:00
Yu Watanabe
09811f99f4 sd-journal: use -EBADF for invalidated file descriptor 2025-11-12 15:18:40 +01:00
Daan De Meyer
e81dc81a5c test-rm-rf: Migrate to new assertion macros 2025-11-12 14:24:14 +01:00
Daan De Meyer
13027e040a test-bus-chat: Migrate to TEST() and new assertion macros
- Also contains various other small cleanups
2025-11-12 14:24:14 +01:00
Daan De Meyer
e59ed77e13 test-bus-watch-bind: Migrate to new assertion macros 2025-11-12 14:24:14 +01:00
Daan De Meyer
0fd7280fbc test-bus-server: Migrate to new assertion macros 2025-11-12 14:24:14 +01:00
Daan De Meyer
4fd7bec2c9 test-bus-peersockaddr: Migrate to new assertion macros 2025-11-12 14:24:12 +01:00
Daan De Meyer
491706368b test-bus-objects: Migrate to new assertion macros 2025-11-12 14:20:24 +01:00
Daan De Meyer
6b136bcd02 test-event: Migrate to new assertion macros 2025-11-12 14:20:24 +01:00
Daan De Meyer
0d21ab7377 tests: Return result from some ASSERT() macros 2025-11-12 14:20:24 +01:00
Zbigniew Jędrzejewski-Szmek
3b3113b87c locale-util: two fixlets for supporting musl (#39689) 2025-11-12 10:38:29 +01:00
Yu Watanabe
6b656a5b40 test-bus-error: use STRERROR() at several more places 2025-11-12 14:17:44 +08:00
Yu Watanabe
9b55c4b859 tree-wide: drop redundant inclusion of linux/prctl.h
sys/prctl.h anyway includes linux/prctl.h and actually these .c files
includes sys/prctl.h. Hence, it is not necessary to explicitly include
linux/prctl.h.
2025-11-12 14:17:44 +08:00
Yu Watanabe
907ce9c315 libc: drop unnecessary __THROW attribute
It is for C++, not necessary for us.
2025-11-12 14:17:44 +08:00
Yu Watanabe
361beb82a5 musl: locale-util: explicitly check existence of locale file
musl's newlocale() always provides a locale object even the requested
locale does not exist. Let's explicitly check the existence of the
requested locale file.
2025-11-12 11:43:13 +09:00
Yu Watanabe
b2a2f670ae musl: locale-util: introduce musl specific locale enumerator
Both add_locales_from_archive() and add_locales_from_libdir() are glibc
specific, and the logic cannot be applied when built with musl.
2025-11-12 11:43:13 +09:00
Yu Watanabe
a2366debce core/exec-credentials: port to new mount API, ensure atomicity for creds installation (#39637) 2025-11-12 09:00:23 +09:00
Yu Watanabe
19db9a99e6 systemctl: fix edit and cat verbs with --global flag (#39606)
The --global flag has been broken since commit 
d77d42ed3a, which added a
blanket restriction on acquiring D-Bus connections when
arg_runtime_scope is RUNTIME_SCOPE_GLOBAL. This was done to prevent
crashes, but inadvertently broke legitimate use cases like 'systemctl
edit --global' and 'systemctl cat --global'.

The issue is that verb_edit() and verb_cat() were unconditionally
calling acquire_bus(), which triggers the restriction and fails with
"--global is not supported for this operation."

This commit fixes the issue by making bus acquisition conditional,
following the same pattern used in verb_enable():

- Only acquire the bus when install_client_side() returns NO (i.e., for
system and user scopes)
- For client-side operations (--global, --root, etc.), skip bus
acquisition and use mangle_names() instead of expand_unit_names()
- Update find_paths_to_edit() and verb_cat() to handle NULL bus by
forcing client-side path lookups
- Skip bus-dependent checks (unit_is_masked, need_daemon_reload) when
bus is NULL

This allows both 'systemctl edit --global' and 'systemctl cat --global'
to work correctly by performing all operations client-side without
requiring a connection to the system or user manager.

Fixes #31272
2025-11-12 08:59:06 +09:00
Yu Watanabe
a1cb4fae86 sd-path: add new type SD_PATH_SEARCH_SYSCTL (#38680)
Aim of this patches set, is to add a new type SD_PATH_SEARCH_SYSCTL for
sd_path_lookup() and sd_path_lookup_strv(). This new type is used to get the
directories list used by systemd-sysctl:

-  /etc/sysctl.d/
-  /run/sysctl.d/
-  /usr/local/lib/sysctl.d/
-  /usr/lib/sysctl.d/

This implements the change in libsystemd, systemd-path, and systemd-sysctl.
2025-11-12 08:54:09 +09:00
Goffredo Baroncelli
f379784550 systemd-sysctl: add SD_PATH_SEARCH_SYSCTL
Update systemd-sysctl to use libsystemd with the new type
SD_PATH_SEARCH_SYSCTL to get the directories list from which
load the .conf files.
2025-11-12 08:49:55 +09:00
Dimitri John Ledkov
31b4dea5f0 bootctl: calculate secureboot state taking MokSBStateRT into account (#39298)
shim is often used as part of the EFI boot chain with Linux kernels.

shim has an option to disable all verification of binaries it loads.
This can be performed by end-user using mokutil / mokmanager EFI app,
which set BootServices only variable MokSBState. shim honors that, and
mirrors it as readonly MokSBStateRT for the post-ExitBootService access.

Thus presense of MokSBStateRT is an indicator that shim was used during
boot chain.

Some OEM vendors are known to set MokSBState variable, without user
having done so.

When verification is disabled, one should assume secureboot is insecure,
because any EFI binary was allowed to run, including but not limited to
unsigned or revoked:
- grub
- systemd-boot
- UKI
- linux kernel

Linux kernel also has code to check this variable, and correctly report
that Secure Boot is disabled, see:
-
3a86608788/drivers/firmware/efi/libstub/secureboot.c (L57)

With this change bootctl output changes like this:
```diff
 System:
       Firmware: n/a (n/a)
  Firmware Arch: x64
-   Secure Boot: enabled (user)
+   Secure Boot: disabled (insecure)
   TPM2 Support: yes
   Measured UKI: no
   Boot into FW: supported
```

This implementation is trying to mimic mokutil behaviour like this one:
```
$ mokutil --sb-state
SecureBoot enabled
SecureBoot validation is disabled in shim
```

As well as the linux kernel behavior of:
```
$ journalctl -b | grep 'Secure boot disabled'
kernel: Secure boot disabled
```

Note that MokSBState is extended into PCR7 as well as also into PCR14.
For more details see https://github.com/rhboot/shim/blob/main/README.tpm
2025-11-12 08:47:44 +09:00