1
0
mirror of https://github.com/systemd/systemd synced 2025-10-05 16:03:15 +02:00

83976 Commits

Author SHA1 Message Date
Lennart Poettering
875a618ed3 firstboot: modernize --help output 2025-09-24 15:46:30 +02:00
Lennart Poettering
73ee723aa7 firstboot: show blue "chrome" bar at top 2025-09-24 15:46:30 +02:00
Lennart Poettering
8191bbd23c prompt-util: add helpers that paint some "chrome" on top/bottom of screen
We'll soon have three different kind of interactive "wizard"-like console
UIs: systemd-firstboot, homectl firstboot and soon systemd-sysinstall.
Let's give them a limited, recognizable visual identity, to distinguish
them from the usual console output: let's add a bit of "chrome" to the
top and bottom of the screen, that we show during ther wizards, but hide
again afterwards.

This makes use of the DECSTBM sequence that reduces the scrolling area
by chopping off blocks from the top or bottom of the screen. The
sequence is quite standard, given it has been part of VT100 already.
xterm, vte, Linux console all support it just fine.
2025-09-24 15:46:30 +02:00
Lennart Poettering
71f3f1818f macro: add simple DEFER_VOID_CALL() helper 2025-09-24 15:46:30 +02:00
Lennart Poettering
32e0af0835 pretty-print: add WITH_BUFFERED_STDOUT() helper 2025-09-24 15:46:30 +02:00
Lennart Poettering
30aeab7883 terminal-util: add terminal_get_cursor_position() helper 2025-09-24 15:46:30 +02:00
Lennart Poettering
fa350969ab prompt-util: add generic prompt loop implementation
This is a generalization of the logic in systemd-firstboot. This also
ports over firstboot.c to make use of the new generalization.
2025-09-24 15:46:30 +02:00
Lennart Poettering
74b8ab014b glyph-util: add more emojis 2025-09-24 15:45:28 +02:00
Luca Boccassi
d80af3b97b machined: add PIDFD D-Bus variants for registering/creating machines
Current methods take a numeric PID, but we know that is unreliable for
the usual reasons. Add variants that take a PIDFD instead, or a
PID + PIDFDID combination for remote users.
2025-09-24 14:11:59 +01:00
Lennart Poettering
4284ef2f95 sd-boot: terminal handling tweaks (#39026)
Let's make sd-boot's terminal handling a bit cleaner, to the point that
uefi's weird handling allows this.
2025-09-24 14:40:38 +02:00
Lennart Poettering
e27a530919 boot: let's make the one space we output early on invisible
let's place the cursor at the beginning of the line before/after, so we
know it's the first char we overwrite, and we return to the front again
right after.
2025-09-24 12:33:59 +02:00
Lennart Poettering
f417a984c9 boot: return to beginning of line when enrolling 2025-09-24 12:33:59 +02:00
Lennart Poettering
8d36341cef boot: work around ansi color issues between sd-boot, uefi and terminals
So, UEFI's color texting is a bit weird. It translates everything to
ANSI sequences, but unlike ANSI sequences it has no understanding of a
distinct "default" bg/fg color, it assumes the ansi color "0" is always
equal to white on black, but that's of course not really true, most
terminal emulators at the very least support white background too.

tianocore then also tries to be smart and suppresses ANSI color changes
from a color to itself. But if the understanding of the color is wrong
in the first place, then any color change suppression like this hurts
more than it helps.

Then in addition there are certain terminal tools that will reset the bg
color on every line break ("less" for example) to the default.

Let's deal with that and improve the situation on all fronts:

1. force out color changes by doing two color changes whenever we really
   want it.

2. on every newline force out the color change again.

with this in place, using sd-boot on a terminal emulator is a lot nicer.
2025-09-24 12:33:59 +02:00
Yu Watanabe
d88ecd2bca libacl → turn into dlopen() dependency (#39087) 2025-09-24 18:25:20 +09:00
Yu Watanabe
63dd548fb4 boot: rename ENROLL_TIMEOUT_TYPE_MAX -> ENROLL_TIMEOUT_MAX
To make it consistent with ENROLL_TIMEOUT_MIN.

Follow-up for 64376936c7.
2025-09-24 18:22:12 +09:00
Yu Watanabe
2e3c792baf boot: use correct format specifier for timeout
This also drops space between number and 's', like we do in format_timespan(),
and fixes spurious type mismatch between timeout_sec and timeout_remain.
2025-09-24 18:20:10 +09:00
Yu Watanabe
a359d92547 measure: strip tpm 1.x remnants and make GetActivePcrBanks() work (#39089)
Let's never bother with old TPM 1.x structures, they are not mentioned
in the TCG for TPM2 spec at all. However, the spec does say we should
check the Size field of the relevant structs, before accessing them,
hence do that.

Use that to determine the version of the protocol, before accessing
GetActiveBanks().

Alternative to: #39034
Fixes: #38932
Follow-up to: 6eab4cd44c
2025-09-24 18:14:09 +09:00
Yu Watanabe
01598d644f udev-builtin-net_id: Add DeviceTree-based names for WLAN devices (#39060)
Add support for generating names like wldN based on DeviceTree aliases.

DeviceTree alias names follow de facto conventions. As of writing, there
are so far two ways WLAN devices are represented in DeviceTree aliases
in upstream Linux DTS files:

- Firstly, as wifi0, used for example in t600x-j314-j316.dtsi
- Secondly, as ethernet0 or ethernet1, used for example in
sun8i-q8-common.dtsi, with a comment saying the reason is to "Make
u-boot set mac-address for wifi without an eeprom"

So we need to handle both while generating names. Refactor most of the
logic in names_devicetree() into a helper
names_devicetree_alias_prefix() that takes an alias_prefix instead of
hardcoding "ethernet", and, in the new names_devicetree():

- For prefix "en", use alias_prefix "ethernet"
- For prefix "wl", try alias_prefix "wifi" first, and if that was not
found, fall back to alias_prefix "ethernet"

Since this is a naming scheme change, also gate this behind
NAMING_DEVICETREE_ALIASES_WLAN and NAMING_V259, and document this
change.
2025-09-24 18:10:27 +09:00
Frantisek Sumsal
5730a400fd test: restarting elapsed timer shouldn't trigger the corresponding service
Provides coverage for:
  - https://github.com/systemd/systemd/issues/31231
  - https://github.com/systemd/systemd/issues/35805
2025-09-24 09:52:36 +02:00
Frantisek Sumsal
953c347fb6 test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER
And split the existing test into a separate subtest.
2025-09-24 09:52:36 +02:00
Lennart Poettering
7c3a7f925f acl: turn libacl dep into a dlopen() one
I initially didn't think it would be worth doing this, but I changed my
mind. People out there quite successfully build systemd without ACL
support, and that suggests life without it is quite possible. Moreover
we only use it as very specific places:

1. in udev/logind for "uaccess" mgmt
2. in tmpfiles to implement explicitly configured acl changes
3. in journald/coredump/pstore to manage access to unpriv users
4. in pid1 to manage access to credential files
5. when shifting UIDs of container trees

I specific container environments it should be entirely fine to live without all
of these, hence let's pull this in on demand only.
2025-09-24 09:47:41 +02:00
Lennart Poettering
ab2b430487 tree-wide: drop deps on libacl
test-shift-uid.c doesn't actually use anything from libacl. It all goes
through shared/, and the dep there is enough.

Same for the coredump stuffi, logind and core/.

And pstore doesn't use it at all, neither directly or indirectly.
2025-09-24 09:47:30 +02:00
Lennart Poettering
31a66a1126 cleanup: add cleanup func macro that renames the function
This is useful when having to add a "sym_" prefix to functions
2025-09-24 09:41:21 +02:00
Lennart Poettering
b388fa20c7 boot: check protocol version before assuming GetActiveBanks() exists
Alternative to: #39034
Fixes: #38932
Follow-up to: 6eab4cd44c
2025-09-24 08:57:11 +02:00
Lennart Poettering
496489c2a7 measure: strip tpm 1.x remnants
Let's never bother with old TPM 1.x structures, they are not mentioned
in the TCG for TPM2 spec at all. However, the spec does say we should
check the Size field of the relevant structs, before accessing them,
hence do that.
2025-09-24 08:49:23 +02:00
Luca Boccassi
696b1263dc fs-util: prefer glibc's fchmodat() if possible
Since v2.39 glibc's fchmodat() will call into the kernel's fchmodat2()
if flags are passed:

https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=65341f7bbea824d2ff9d37db15d8be162df42bd3;hp=c52c2c32db15aba8bbe1a0b4d3235f97d9c1a525

On older versions, if the flag is anything other than AT_SYMLINK_NOFOLLOW,
it returns EINVAL, so we can detect it and call the kernel syscall directly
ourselves.

Using the glibc wrappers when possible is prefereable so that programs
like fakeroot can intercept its calls and redirect them.

Follow-up for adecfb3bc0
2025-09-24 08:48:42 +02:00
Lennart Poettering
264608e8c3 docs: add a governance document
Since there have been disagreements on certain aspects of the technical
direction, let's clear things up, and introduce a governance document,
taking inspiration from:

https://github.com/uapi-group/uapi-group.github.io/blob/main/content/_index.md#governance
2025-09-24 08:48:17 +02:00
Luca Boccassi
2183d881b9 mkosi: update debian commit reference to 49dd9371a0c0dd08c7847c5885722eab88ac279f
* 49dd9371a0 d/rules: Ubuntu moved vmlinux.h too
* c81ce364eb Install new files for upstream build
* 35abaf33bc Override more Lintian warnings about appstream
* a3d3690c45 Override Lintian warning for appstream-metadata-missing-modalias-provide
* 1bcda1fd90 Override Lintian warning for binaries-have-file-conflict
* c597c00ffc Drop versioned conflicts added for bullseye upgrades
* 9cd845af25 Override lintian warnings for conflicts-with-version
* 359da95d09 Override Lintian warning for spare-manual-page
* 3ef8c31cb2 Override Lintian warning for groff-message
* dbe51582a9 Update changelog for 258-1 release
* ffd971a27d autopkgtest: ensure /usr/sbin is in the PATH for unit-tests job
* f086b8e881 autopkgtest: enable debug logs for unit-tests job
* 02142b9eae autopkgest: install dosfstools for test-loop-block
* 0319d890bd salsa-ci: enable ppc64el builds
* 645b1fa318 autopkgtest: use -20 instead of -22 for zstd compression
* b8dc9b0ce7 salsa-ci: switch to recommended entry point yml
* 152a2b3140 autopkgtest: set default_device_timeout_sec=240
* 6d46436878 autopkgtest: manually compress logs on failure
* c6c70bbb0c Update changelog for 258~rc4-1 release
* 2695112df7 Update changelog for 258~rc3-1 release
* 2c293cb2be systemd-boot: update version for rm_conffile
2025-09-24 00:38:40 +01:00
dramforever
20693ffcd8 udev-builtin-net_id: Add DeviceTree-based names for WLAN devices
Add support for generating names like wldN based on DeviceTree aliases.

DeviceTree alias names follow de facto conventions. As of writing, there
are so far two ways WLAN devices are represented in DeviceTree aliases
in upstream Linux DTS files:

- Firstly, as wifi0, used for example in t600x-j314-j316.dtsi
- Secondly, as ethernet0 or ethernet1, used for example in
  sun8i-q8-common.dtsi, with a comment saying the reason is to "Make
  u-boot set mac-address for wifi without an eeprom"

Therefore for prefix "wl", try alias_prefix "wifi" first, and if that
was not found, fall back to alias_prefix "ethernet"

Since this is a naming scheme change, also gate this behind
NAMING_DEVICETREE_ALIASES_WLAN and NAMING_V259, and document this
change.
2025-09-24 03:13:32 +08:00
dramforever
d096f80b27 udev-builtin-net_id: Refactor names_devicetree() to avoid hardcoding
Refactor most of the logic in names_devicetree() into a helper
names_devicetree_alias_prefix() that takes an alias_prefix instead of
hardcoding "ethernet".

The return value names_devicetree_alias_prefix() will be used in further
commits to allow for alias_prefix fallback.
2025-09-24 03:13:26 +08:00
Yu Watanabe
e2c5e9c011 test: use relative paths to executables
This also makes shebang always use env command, and drops unnecessary
'bash -c' or 'sh -c' when a signle command is invoked in the shell,
like sleep or echo.
2025-09-23 15:48:53 +01:00
Lennart Poettering
daf99b00b5 udev,login: update ACL on static device nodes (#39071)
Fixes regression caused by #36444.
Fixes #39043.
2025-09-23 14:27:36 +02:00
Yu Watanabe
2c762d90cf login: update ACL on static device nodes again
In the commit c960ca2be1, the logic of
updating ACL on device node was moved from logind to udevd, but at that
time, mistakenly removed the logic for static nodes.

Fixes a regression caused by c960ca2be1 (v258).
Fixes #39043.
2025-09-23 19:57:25 +09:00
Yu Watanabe
41c4a69653 udev: move devnode_acl() back to libshared
This effectively reverts 1abb592f2f.
No functional change, preparation for the next commit.
2025-09-23 19:53:39 +09:00
Igor Opaniuk
64376936c7 boot: add support for overriding key enrollement timeout
Currently, a 15-second timeout is hardcoded for the key enrollment
process while waiting for user confirmation. Make this value configurable
to allow the option of disabling user input, such as during automatic key
provisioning at the factory.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
2025-09-23 12:13:10 +02:00
Joshua Krusell
e216876fc6 Fix sd_bus_can_send signature in manpage 2025-09-23 11:04:42 +01:00
Lennart Poettering
4d74637310 repart: add a very basic varlink interface (#39072)
This is split out of https://github.com/systemd/systemd/pull/38764.

It adds a very basic Varlink API to repart. Not the actual
repartitioning APIs, but simply a call to get a list of candidate
devices.

A very basic test case is added too.

Other commits from #38764 add the repartitioning API, but let's do that
in a separate PR.
2025-09-23 10:46:50 +02:00
Lennart Poettering
347a3c925c test: add simple testcase for io.systemd.Repart.ListCandidateDevices 2025-09-23 09:25:11 +02:00
Lennart Poettering
ba793df4b9 blockdev-list,repart: optionally hide zero-size block devices
Block devices with removable media (e.g. SD card readers) indicate a
missing medium with a zero size. Optionally ignore such block devices
that carry no medium currently.
2025-09-23 09:25:11 +02:00
Lennart Poettering
ed90a0cdc9 blockdev-list,repart: optionally, filter list of candidate block device and remove OS root disk 2025-09-23 09:23:55 +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
Lennart Poettering
e863e2dbb5 blockdev-list: also pick up block device size 2025-09-23 09:18:21 +02:00
Lennart Poettering
9f6b2745ea blockdev-list: optionally return finds as list instead of writing it to stdout 2025-09-23 09:13:13 +02:00
Lennart Poettering
cb06a80482 sd-device: add device_get_sysattr_u64() helper 2025-09-23 09:13:13 +02:00
Luca Boccassi
4f21c3d9b7 Two follow-ups for dlopen()-ification (#39078) 2025-09-23 00:13:13 +01:00
Mike Yuan
278953167d core/systemd.pc: do not add new non-underscored vars
Follow-up for 346b7b6b49

The old style was deprecated in
4908de44b0.
2025-09-23 03:46:55 +09:00
Mike Yuan
1fbe44d013 pam-util,libaudit-util: strip "lib" prefix from dlopen "feature" field
As per our usual coding style.
2025-09-22 20:08:45 +02:00
Mike Yuan
f497a3f1c3 pam-util: fix build without PAM
Follow-up for 882c9ce040
Prompted by #39077

Note that HAVE_PAM ifdeffery in pam-util.c is removed,
since its build as a whole is conditioned out if
!HAVE_PAM in shared/meson.build.
2025-09-22 20:08:44 +02:00
Yu Watanabe
6c3c7a8bb7 journal: fix two recent regressions in config handling (#39069)
Fixes #39046.
Fixes #39057.
2025-09-23 02:43:03 +09:00
Antonio Alvarez Feijoo
f784a63cfa libaudit-util: fix build with audit disabled
```
In file included from ../src/test/test-dlopen-so.c:21:
../src/test/test-dlopen-so.c: In function ‘run’:
../src/test/test-dlopen-so.c:53:23: error: implicit declaration of function ‘dlopen_libaudit’; did you mean ‘dlopen_libfido2’? [-Werror=implicit-function-declaration]
   53 |         ASSERT_DLOPEN(dlopen_libaudit, HAVE_AUDIT);
      |                       ^~~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
  181 |                 typeof(expr) _result = (expr);                                                                  \
      |                        ^~~~
../src/test/test-dlopen-so.c:53:9: note: in expansion of macro ‘ASSERT_DLOPEN’
   53 |         ASSERT_DLOPEN(dlopen_libaudit, HAVE_AUDIT);
      |         ^~~~~~~~~~~~~
../src/test/test-dlopen-so.c:53:23: warning: nested extern declaration of ‘dlopen_libaudit’ [-Wnested-externs]
   53 |         ASSERT_DLOPEN(dlopen_libaudit, HAVE_AUDIT);
      |                       ^~~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
  181 |                 typeof(expr) _result = (expr);                                                                  \
      |                        ^~~~
../src/test/test-dlopen-so.c:53:9: note: in expansion of macro ‘ASSERT_DLOPEN’
   53 |         ASSERT_DLOPEN(dlopen_libaudit, HAVE_AUDIT);
      |         ^~~~~~~~~~~~~

```

Follow-up for 4d8c5c657a
2025-09-22 18:17:52 +01:00