]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
13 months agoman: fix advertised filename of the PCR public key 34385/head
Lennart Poettering [Thu, 12 Sep 2024 07:31:29 +0000 (09:31 +0200)] 
man: fix advertised filename of the PCR public key

13 months agoman: systemd-stub places PCR public key in file 'tpm2-pcr-public-key.pem', stick...
Lennart Poettering [Wed, 11 Sep 2024 16:22:54 +0000 (18:22 +0200)] 
man: systemd-stub places PCR public key in file 'tpm2-pcr-public-key.pem', stick to that name across the board

systemd-stub provides the signing key for TPM2 signed PCR policies in a
file tpm2-pcr-public-key.pem to userspace. Hence, to clarify that this
is the same key as used when signing via "systemd-measure", let's rename
it in the docs like that.

Also rename the private key to tpm2-pcr-private-key.pem, to keep the
symmetry.

With this we should universally stick to this nomenclature:

1. tpm2-pcr-public-key.pem   ← public part of signing key
2. tpm2-pcr-private-key.pem  ← private part of signing key
3. tpm2-pcr-signature.json   ← signature file made with key pair

Inspired by: #34069

13 months agoupdate TODO
Lennart Poettering [Thu, 12 Sep 2024 07:38:27 +0000 (09:38 +0200)] 
update TODO

13 months agonetwork/wireguard: refuse default key if all zero
Mike Yuan [Wed, 11 Sep 2024 19:49:00 +0000 (21:49 +0200)] 
network/wireguard: refuse default key if all zero

Follow-up for fa724cd52c1335d6b3225b74c1a9c801389997ba

We attempt to retrieve default key if eqzero(Wireguard.private_key),
but a all zero default key should be refused too.

13 months agoresolvectl: rework StatusMode handling into a switch/case statement
Lennart Poettering [Wed, 11 Sep 2024 14:08:23 +0000 (16:08 +0200)] 
resolvectl: rework StatusMode handling into a switch/case statement

13 months agoresolvectl: rename shallow destructors …_done()
Lennart Poettering [Wed, 11 Sep 2024 14:06:57 +0000 (16:06 +0200)] 
resolvectl: rename shallow destructors …_done()

13 months agoMerge pull request #34373 from poettering/resolved-dnssd-move-out
Daan De Meyer [Wed, 11 Sep 2024 19:36:24 +0000 (21:36 +0200)] 
Merge pull request #34373 from poettering/resolved-dnssd-move-out

move dnssd configuration file parsing from generic code into dnssd source files

13 months agoresolved: simplify dns_scope_get_n_dns_servers(), don't count each time
Lennart Poettering [Tue, 3 Sep 2024 08:46:52 +0000 (10:46 +0200)] 
resolved: simplify dns_scope_get_n_dns_servers(), don't count each time

13 months agoresolved: use dns_scope_ifindex() at more places
Lennart Poettering [Tue, 3 Sep 2024 08:49:42 +0000 (10:49 +0200)] 
resolved: use dns_scope_ifindex() at more places

And add a mirroring dns_scope_ifname()

13 months agoresolved: simplify initialization of DnsScope
Lennart Poettering [Tue, 3 Sep 2024 08:45:26 +0000 (10:45 +0200)] 
resolved: simplify initialization of DnsScope

13 months agopcrlock: remove empty components from our list
Lennart Poettering [Wed, 11 Sep 2024 09:14:33 +0000 (11:14 +0200)] 
pcrlock: remove empty components from our list

This is a rework of e7a93e75219b22424bab95fe45982f5eef21d581: instead of
handling components with n_variants being zero at every step of the way, we instead
remove it from our list after loading all components, given that such a
component simply makes not sense for the rest of our logic.

13 months agoresolved: use unlinkat() where appropriate
Lennart Poettering [Tue, 3 Sep 2024 08:52:16 +0000 (10:52 +0200)] 
resolved: use unlinkat() where appropriate

13 months agoMerge pull request #34377 from DaanDeMeyer/symlinks
Daan De Meyer [Wed, 11 Sep 2024 19:34:37 +0000 (21:34 +0200)] 
Merge pull request #34377 from DaanDeMeyer/symlinks

repart: Add MakeSymlinks=

13 months agoresolvectl: show DefaultRoute state in per-link DNS staus info too
Lennart Poettering [Wed, 11 Sep 2024 14:11:43 +0000 (16:11 +0200)] 
resolvectl: show DefaultRoute state in per-link DNS staus info too

13 months agopcrlock: correct --help text regarding recovery pin
Lennart Poettering [Wed, 11 Sep 2024 15:13:09 +0000 (17:13 +0200)] 
pcrlock: correct --help text regarding recovery pin

Fixes: #33917
13 months agocryptenroll: don't try to get PCR bank if we know the device key
Lennart Poettering [Wed, 11 Sep 2024 15:28:43 +0000 (17:28 +0200)] 
cryptenroll: don't try to get PCR bank if we know the device key

If we operate in "offline" mode, i.e. know the device key, then we will
not have a TPM2 connection, hence don't try to read the PCR bank to use form
it.

We don't need it anyway because we are not going to test unseal things.

Fixes: #33855
13 months agorepart: Add MakeSymlinks= 34377/head
Daan De Meyer [Wed, 11 Sep 2024 15:11:45 +0000 (17:11 +0200)] 
repart: Add MakeSymlinks=

Similar to MakeDirectories=, but creates symlinks in the filesystem.

13 months agorepart: Add missing parameter comment
Daan De Meyer [Wed, 11 Sep 2024 16:44:44 +0000 (18:44 +0200)] 
repart: Add missing parameter comment

13 months agorepart: Fix memory corruption
Daan De Meyer [Wed, 11 Sep 2024 15:51:20 +0000 (17:51 +0200)] 
repart: Fix memory corruption

13 months ago hwdb.d/60-keyboard.hwdb: add Clevo mic mute quirk for V5x iGPU, NV41PZ
Filip Lewiński [Fri, 30 Aug 2024 07:38:46 +0000 (09:38 +0200)] 
 hwdb.d/60-keyboard.hwdb: add Clevo mic mute quirk for V5x iGPU, NV41PZ

Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
13 months agoudev: allow persistent storage rules for zram devices
Karel Zak [Wed, 11 Sep 2024 09:27:09 +0000 (11:27 +0200)] 
udev: allow persistent storage rules for zram devices

The /dev/zramN devices can be used as regular block devices. They are
typically used for swap areas, but it would be beneficial to have
LABEL and UUID in the udev database to make it more user-friendly for
tools such as lsblk or mount (if used with other filesystems).

13 months agoresolved: move dnssd parsers to resolved-dnssd.c 34373/head
Lennart Poettering [Tue, 3 Sep 2024 14:05:48 +0000 (16:05 +0200)] 
resolved: move dnssd parsers to resolved-dnssd.c

Let's keep only the parsers for the main config in resolved-conf.c

13 months agoresolved: move resolved_dnssd_gperf_lookup() prototype definition to resolved-dnssd.h
Lennart Poettering [Tue, 3 Sep 2024 11:11:51 +0000 (13:11 +0200)] 
resolved: move resolved_dnssd_gperf_lookup() prototype definition to resolved-dnssd.h

13 months agorepart: Reuse partition_needs_populate() more
Daan De Meyer [Wed, 11 Sep 2024 14:36:47 +0000 (16:36 +0200)] 
repart: Reuse partition_needs_populate() more

13 months agoman: fix help text for systemd-creds tool's "list" verb
Lennart Poettering [Wed, 11 Sep 2024 08:55:52 +0000 (10:55 +0200)] 
man: fix help text for systemd-creds tool's "list" verb

I guess this was copy/pasted from sysupdate? Weird though. Fix it. And
also reword "cat" help text to make it more precise.

13 months agopcrlock: log if we generate an "empty" policy
Lennart Poettering [Wed, 11 Sep 2024 09:44:02 +0000 (11:44 +0200)] 
pcrlock: log if we generate an "empty" policy

Such a policy won't provide any protection, but it's still entirely fine
to have it like this in various contexts, for example at OS install
time, to allocate the nvindex and reference it in enrollments. However,
it does deserve mention, hence log about it at LOG_NOTICE level.

This is based on a similar patch by Arnaud Patard
<arnaud.patard@collabora.com> proposed at #33663.

13 months agoman: Correct flag description of systemd-cat
sinus-x [Mon, 9 Sep 2024 19:06:58 +0000 (21:06 +0200)] 
man: Correct flag description of systemd-cat

It is not true that "no string" is written to journal; the binary
name is used when run via `systemd-cat command`, or `cat` is used
when run via `command | systemd-cat`.

13 months agotest: fix TEST_SKIP for test cases with subtests
Luca Boccassi [Wed, 11 Sep 2024 10:01:55 +0000 (12:01 +0200)] 
test: fix TEST_SKIP for test cases with subtests

TEST-64-UDEV-STORAGE is invoked with the subtest appended, so TEST_SKIP=TEST-64-UDEV-STORAGE
does not work. Fix it by using TEST_SKIP as a partial match.

Follow-up for ddc91af4eaa32511f92c83b2c24d9cc0425fd5f5

13 months agotpm2-util: fix whitespace
Lennart Poettering [Wed, 11 Sep 2024 08:28:36 +0000 (10:28 +0200)] 
tpm2-util: fix whitespace

13 months agoMerge pull request #34353 from yuwata/timesync-bus-document
Lennart Poettering [Wed, 11 Sep 2024 08:15:30 +0000 (10:15 +0200)] 
Merge pull request #34353 from yuwata/timesync-bus-document

timesync: add document for org.freedesktop.timesync1

13 months agoMerge pull request #34348 from poettering/stub-efivar-tweaks
Lennart Poettering [Wed, 11 Sep 2024 08:09:53 +0000 (10:09 +0200)] 
Merge pull request #34348 from poettering/stub-efivar-tweaks

sd-stub: report stub location in efi vars

13 months agoChange OS X to macOS in BOOT.md (#34358)
Skye Chappelle [Wed, 11 Sep 2024 07:15:39 +0000 (03:15 -0400)] 
Change OS X to macOS in BOOT.md (#34358)

13 months agostub: add StubDevicePartUUID/StubImageIdentifier 34348/head
Lennart Poettering [Mon, 15 Jul 2024 14:11:31 +0000 (16:11 +0200)] 
stub: add StubDevicePartUUID/StubImageIdentifier

These variables closely mirror the existing
LoaderDevicePartUUID/LoaderImageIdentifier variables. But the Stub…
variables indicate the location of the stub/UKI (i.e. of systemd-stub),
while the Loader… variables indicate the location of the boot loader
(i.e. of systemd-boot). (Except of course, there is no boot loader used,
in which case both sets point to the stub/UKI, as a special case).

This actually matters, as we support that sd-boot runs off the ESP,
while a UKI then runs off XBOOTLDR, i.e. two distinct partitions.

13 months agostub: tweak setting of common Loader* EFI vars
Lennart Poettering [Mon, 15 Jul 2024 14:07:51 +0000 (16:07 +0200)] 
stub: tweak setting of common Loader* EFI vars

Let's always check if we have data to set *first*, and only then check
if an EFI var is already set.

Checking for the EFI var is more expensive after all.

13 months agoman: fix documentation for LoaderDevicePathUUID + LoaderImageIdentifier, in systemd...
Lennart Poettering [Mon, 15 Jul 2024 14:06:40 +0000 (16:06 +0200)] 
man: fix documentation for LoaderDevicePathUUID + LoaderImageIdentifier, in systemd-stub man page too

Let's fix the version here too, and also clarify that this is usually
not necessarily the ESP.

13 months agoman: fix LoaderDevicePathUUID + LoaderImageIdentifier descriptions
Lennart Poettering [Mon, 15 Jul 2024 13:48:42 +0000 (15:48 +0200)] 
man: fix LoaderDevicePathUUID + LoaderImageIdentifier descriptions

First of all, these were always set, i.e. since sd-boot was merged into
our tree, i.e. v220. Let's say so explicitly.

Also, let's be more accurate, regarding which partition this referes to:
it's usually "the" ESP, but given that you can make firmware boot from
arbitrary disks, it could be any other partition too. Hence, be
explicit on this.

Also, clarify tha sd-stub will set this too, if sd-boot never set it.

13 months agobootctl: show new sd-boot/sd-stub feature flags
Lennart Poettering [Tue, 2 Jul 2024 08:49:35 +0000 (10:49 +0200)] 
bootctl: show new sd-boot/sd-stub feature flags

13 months agosrc/sysext: Use versioned names when logging extensions used for merge operation
Maanya Goenka [Mon, 9 Sep 2024 16:25:32 +0000 (16:25 +0000)] 
src/sysext: Use versioned names when logging extensions used for merge operation

If this is not done, and there are two images, image_1.raw and image_2.raw under
an image.raw.v folder, then the log will say "Using extensions image" instead of
using "Using extensions image_2.raw" which is the desired behavior for v-picked extensions.

13 months agotmpfiles: add separate fragment for stuff we copy from .extra/ into /run/systemd
Lennart Poettering [Tue, 2 Jul 2024 14:01:47 +0000 (16:01 +0200)] 
tmpfiles: add separate fragment for stuff we copy from .extra/ into /run/systemd

Let's move copying out the PCR signature/key into its own tmpfiles
snippet.

And then let's add support for copying out the profile + os-release
information systemd-stub now places in the invoked initrd.

That way these four pieces of information are available even after the
initrd→host transition.

13 months agomeson: increase default number of available sections for the stub
Lennart Poettering [Wed, 10 Jul 2024 08:46:39 +0000 (10:46 +0200)] 
meson: increase default number of available sections for the stub

Now that we have multi-profile UKIs people likely want to stick more PE
sections into them than before. Hence, bump the number of available PE
section slots to 30 (up from 15). Also, make this configurable at build
time since some folks probably want even more, and others don't want
this at all.

(pre-allocating too many shouldn't matter too much btw, I'd advise
everyone to overshoot, except maybe on the tiniest of embedded boards)

13 months agoman: add basic documents for org.freedesktop.timesync1 34353/head
Yu Watanabe [Tue, 10 Sep 2024 19:42:50 +0000 (04:42 +0900)] 
man: add basic documents for org.freedesktop.timesync1

Closes #34352.

13 months agotimesync: add support of basic command line options
Yu Watanabe [Tue, 10 Sep 2024 19:05:31 +0000 (04:05 +0900)] 
timesync: add support of basic command line options

13 months agotimesync: use BusObjectImplementation
Yu Watanabe [Tue, 10 Sep 2024 19:03:57 +0000 (04:03 +0900)] 
timesync: use BusObjectImplementation

13 months agodoc-sync: strip point release from version before uploading
Luca Boccassi [Tue, 10 Sep 2024 15:37:04 +0000 (17:37 +0200)] 
doc-sync: strip point release from version before uploading

We create subdirectories for each major release, but not for point releases
so strip the suffix if it is present

13 months agocryptsetup: use the new crypt_token_set_external_path() API if available
Lennart Poettering [Tue, 10 Sep 2024 13:40:12 +0000 (15:40 +0200)] 
cryptsetup: use the new crypt_token_set_external_path() API if available

Let's make use of libcryptsetup's new crypt_token_set_external_path()
API in place of the interposition stuff we have been doing before. Let's
kill it entirely, given that this was a developer feature only anyway
(and guarded by an appropriate ifdef).

Fixes: #30098
13 months agohomectl: when chainloading a shell, prefix "-" rather than overriding first char
Lennart Poettering [Tue, 10 Sep 2024 13:30:44 +0000 (15:30 +0200)] 
homectl: when chainloading a shell, prefix "-" rather than overriding first char

Login shells are supposed to marked via a dash as first char. We follow
that logic, but right now we simply overwrite the first char of the
shell. That might not be the right choice, given that this turns
"zsh" into "-sh", which suggests some bourne shell process.

Hence, let's correct things, and instead prefix a dash, which should be
safer.

Inspired by findings on https://github.com/systemd/systemd/issues/34153#issuecomment-2338104907

13 months agoMerge pull request #34339 from poettering/uki-with-many-boot
Lennart Poettering [Tue, 10 Sep 2024 14:25:34 +0000 (16:25 +0200)] 
Merge pull request #34339 from poettering/uki-with-many-boot

sd-boot: synthesize one menu entry for each profile of multi-profile UKIs

13 months agohwdb: death to tabs!
Lennart Poettering [Tue, 10 Sep 2024 08:09:24 +0000 (10:09 +0200)] 
hwdb: death to tabs!

Some tabs snuck in here, but we don't like tabs in our codebase. Fix
them.

13 months agoMerge pull request #34331 from yuwata/network-netdev-cleanups
Yu Watanabe [Tue, 10 Sep 2024 13:05:55 +0000 (22:05 +0900)] 
Merge pull request #34331 from yuwata/network-netdev-cleanups

network/netdev: several cleanups for attaching/detaching netdev, and setting/getting ifindex from netdev

13 months agoudev/ata_id: export read look-ahead values
Tomas Bzatek [Tue, 10 Sep 2024 10:26:02 +0000 (12:26 +0200)] 
udev/ata_id: export read look-ahead values

Indicates whether the ATA read look-ahead feature is supported
and enabled.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agoboot: don't hardcode drop-in paths at multiple places 34339/head
Lennart Poettering [Thu, 4 Jul 2024 15:09:06 +0000 (17:09 +0200)] 
boot: don't hardcode drop-in paths at multiple places

Instead, let's define them once, and pass them through as parameters
everywhere.

13 months agoboot: synthesize a separate menu entry from each .profile section
Lennart Poettering [Fri, 28 Jun 2024 18:12:39 +0000 (20:12 +0200)] 
boot: synthesize a separate menu entry from each .profile section

This iterates through the .profile sections a UKI provides and uses it
to generate multiple menu entries from them, one for each .profile
section.

13 months agotest-network: add test more cases for assigned units for each interface 34331/head
Yu Watanabe [Tue, 10 Sep 2024 07:37:55 +0000 (16:37 +0900)] 
test-network: add test more cases for assigned units for each interface

13 months agonetwork/state-file: save assigned .netdev file even if the interface is unmanaged
Yu Watanabe [Tue, 10 Sep 2024 07:35:27 +0000 (16:35 +0900)] 
network/state-file: save assigned .netdev file even if the interface is unmanaged

Follow-up for 2cf9b1a0eed7bcd85543e19ba6f0d26767fe1163.

13 months agonetwork/vxcan: also manage peer interface name by manager
Yu Watanabe [Mon, 9 Sep 2024 09:00:28 +0000 (18:00 +0900)] 
network/vxcan: also manage peer interface name by manager

Then, the Link object for the peer interface can have a reference to the
corresponding NetDev object.

13 months agonetwork/vxcan: refuse when peer and the main interface names are equivalent
Yu Watanabe [Mon, 9 Sep 2024 18:01:14 +0000 (03:01 +0900)] 
network/vxcan: refuse when peer and the main interface names are equivalent

13 months agonetwork/l2tp: manage l2tp session name by Manager
Yu Watanabe [Mon, 9 Sep 2024 08:54:01 +0000 (17:54 +0900)] 
network/l2tp: manage l2tp session name by Manager

Then, Link object for an L2TP session can have reference to the
corresponding NetDev object.

13 months agonetwork/l2tp: refuse duplicated session name
Yu Watanabe [Mon, 9 Sep 2024 18:18:19 +0000 (03:18 +0900)] 
network/l2tp: refuse duplicated session name

13 months agonetwork/l2tp: downgrade log level of several messages
Yu Watanabe [Mon, 9 Sep 2024 18:05:18 +0000 (03:05 +0900)] 
network/l2tp: downgrade log level of several messages

Also, use log_section_warning_errno() where applicable.

13 months agonetwork/veth: also manage peer name by Manager
Yu Watanabe [Mon, 9 Sep 2024 08:38:16 +0000 (17:38 +0900)] 
network/veth: also manage peer name by Manager

Then, the Link object for the peer interface can have a reference to the
corresponding NetDev object.

13 months agonetwork/veth: refuse when peer and the main interface names are equivalent
Yu Watanabe [Mon, 9 Sep 2024 18:00:09 +0000 (03:00 +0900)] 
network/veth: refuse when peer and the main interface names are equivalent

13 months agonetwork/netdev: add attach(), detach(), set_ifindex(), and get_ifindex() to netdev...
Yu Watanabe [Mon, 9 Sep 2024 08:37:42 +0000 (17:37 +0900)] 
network/netdev: add attach(), detach(), set_ifindex(), and get_ifindex() to netdev vtable

Currently no vtable sets these functions, but will be used later.

13 months agonetwork/netdev: allow to register the same NetDev object with multiple names
Yu Watanabe [Mon, 9 Sep 2024 14:55:46 +0000 (23:55 +0900)] 
network/netdev: allow to register the same NetDev object with multiple names

Preparation for later commits.

13 months agonetwork/netdev: split out netdev_set_ifindex_internal() and _impl()
Yu Watanabe [Mon, 9 Sep 2024 15:57:25 +0000 (00:57 +0900)] 
network/netdev: split out netdev_set_ifindex_internal() and _impl()

No functional change, just refactoring and preparation for later
commits.

13 months agonetwork/netdev: split out netdev_attach() and netdev_attach_name() from netdev_load_one()
Yu Watanabe [Mon, 9 Sep 2024 08:41:00 +0000 (17:41 +0900)] 
network/netdev: split out netdev_attach() and netdev_attach_name() from netdev_load_one()

No functional change, just refactoring and preparation for later
commits.

13 months agonetwork/netdev: use hashmap_remove_value() on detaching NetDev from manager
Yu Watanabe [Mon, 9 Sep 2024 06:17:54 +0000 (15:17 +0900)] 
network/netdev: use hashmap_remove_value() on detaching NetDev from manager

Then, it is not necessary to free NetDev.ifname when a conflicting
.netdev file is already loaded.

This also split out netdev_detach_name() and netdev_detach_impl().

No functional change, just refactoring.

13 months agonetwork/netdev: downgrade log level in netdev_set_ifindex()
Yu Watanabe [Mon, 9 Sep 2024 13:39:50 +0000 (22:39 +0900)] 
network/netdev: downgrade log level in netdev_set_ifindex()

This also makes netdev_enter_failed() called on caller side.

No functional change, just refactoring.

13 months agonetwork/netdev: check family of received NEWLINK message
Yu Watanabe [Mon, 9 Sep 2024 13:46:27 +0000 (22:46 +0900)] 
network/netdev: check family of received NEWLINK message

For safety. No functional change, just refactoring and preparation for
later commits.

13 months agonetwork/route: use NetDev object assigned to Link
Yu Watanabe [Mon, 9 Sep 2024 15:17:11 +0000 (00:17 +0900)] 
network/route: use NetDev object assigned to Link

13 months agonetwork/netdev: also check ifindex, iftype, and kind when assigning NetDev to Link
Yu Watanabe [Mon, 9 Sep 2024 15:12:41 +0000 (00:12 +0900)] 
network/netdev: also check ifindex, iftype, and kind when assigning NetDev to Link

Even when a NetDev object with the same name found, its iftype or kind
may be different. For safety, let's also check them.

13 months agoboot: only open type2 ukis once when parsing
Lennart Poettering [Mon, 1 Jul 2024 15:50:56 +0000 (17:50 +0200)] 
boot: only open type2 ukis once when parsing

13 months agoMerge pull request #34294 from poettering/uki-with-many-core
Lennart Poettering [Tue, 10 Sep 2024 06:59:53 +0000 (08:59 +0200)] 
Merge pull request #34294 from poettering/uki-with-many-core

multi-profile UKIs (systemd-stub hookup)

13 months agoMerge pull request #34318 from YHNdnzj/networkctl-edit-if-netdev
Yu Watanabe [Tue, 10 Sep 2024 05:32:28 +0000 (14:32 +0900)] 
Merge pull request #34318 from YHNdnzj/networkctl-edit-if-netdev

networkctl: support editing netdev files by link and cat ":all"

13 months agoMerge pull request #34336 from yuwata/nspawn-fuse-follow-ups
Yu Watanabe [Tue, 10 Sep 2024 05:32:09 +0000 (14:32 +0900)] 
Merge pull request #34336 from yuwata/nspawn-fuse-follow-ups

nspawn: follow-ups for FUSE support

13 months agostub: add ability to place multiple alternative PE sections of a specific type in... 34294/head
Lennart Poettering [Thu, 27 Jun 2024 20:21:58 +0000 (22:21 +0200)] 
stub: add ability to place multiple alternative PE sections of a specific type in the same UKI ("Multi-Profile UKIs")

This adds a ability to add alternative sections of a specific type in
the same UKI. The primary usecase is for supporting multiple different
kernel cmdlines that are baked into a UKI.

The mechanism is relatively simple (I think), in order to make it robust.

1. A new PE section ".profile" is introduced, that is a lot like
   ".osrel", but contains information about a specific "profile" to
   boot. The ".profile" section can appear multiple times in the same
   PE, and acts as delimiter indicating where a new profile starts.
   Everything before the first ".profile" is called the "base profile",
   and is shared among all other profiles, which can then override or
   add addition PE sections on top.

2. An UKI's command line can be prefixed with an argument such as "@0" or
   "@1" or "@2" which indicates the "profile" to boot. If no argument is
   specified the default is profile 0. Also, a UKI that lacks any
   .profile section is treated like one with only a profile 0, but with
   no data in that profile section.

3. The stub will first search for its usual set of PE sections
   (hereafter called "base sections"), and stop at the first .profile PE
   section if any. It will then find the .profile matching the selected
   profile by its index, and any sections found as part of that profile
   on top of the base sections.

And that's already it.

Example: let's say a distro wants to provide a single UKI that can be
invoked in one of three ways:

1. The regular profile that just boots the system
2. A profile that boots into storagetm
3. A profile that initiates factory reset and reboots.

For this it would define a classic UKI with sections .linux, .initrd,
.cmdline, and whatever else it needs. The .cmdline section would contain
the kernel command line for the regular profile.

It would then insert one ".profile" section, with a contents like the
following:

    ID=regular

This is the profile for profile 0. It would immediately afterwards add
another ".profile" section:

    ID=storagetm
    TITLE=Boot into Storage Target Mode

This would then followed with a .cmdline section that is just like the
basic one, but with "rd.systemd.unit=storage-target-mode.target"
suffixed. Then, another .profile section would be added:

    ID=factory-reset
    TITLE=Factory Reset

Which is then followed by one last PE section: a .cmdline one with
"systemd.unit=factory-reset.target" suffixed to te regular command line.

i.e. expressed in tabular form the above would be:

    The base profile:
          .linux
          .initrd
          .cmdline
          .osrel
    The regular boot profile:
          .profile
    The storagetm profile:
          .profile
          .cmdline
    The factory reset profile:
          .profile
          .cmdline

You might wonder why the first .cmdline in the list above is placed in
the base profile rather than in the regular boot profile, given that it
is overriden in all other profiles anyway. And you are right. The only
reason I'd place it in the base profile is that it makes the UKI more
nicely extensible if later profiles are added that want to replace
something else instead of the .cmdline, for example .ucode or so. But it
really doesn't matter much.

While the primary usecase is of course multiple alternative command
lines, the concept is more powerful than that: for various usecases it
might be valuable to offer multiple choices of devicetree, ucode or
initrds.

The .profile contents is also passed to the invoked kernel as a file in
/.extra/profile (via a synthetic initrd). Thus, this functionality can
even be useful without overriding any section at all, simply by means of
reading that file from userspace.

Design choices:

1. On purposes I used a special command line marker (i.e. the "@" thing,
   which maybe we should call the "profile selector"), that doesn't look
   like a regular kernel command line option.  This is because this is
   really not a regular kernel command line option – we process it in
   the stub, then remove it as prefix, and measure the unprefixed
   command line only after that. The kernel will not see the profile
   selector either. I think these special semantics are best
   communicated by making it look substantially different from regular
   options.

2. This moves around measurements a bit. Previously we measured our UKI
   sections right after finding them. Now we first parse the profile
   number from the command line, then search for the profile's sections,
   and only then measure the sections we actually end up using for this
   profile. I think that this logic makes most sense: measure what we
   are using, not what we are overriding. Or in other words, if you boot
   profile @3, then we'll measure .cmdline (assuming it exists) of
   profile 3, and *not* measure .cmdline of the base profile. Also note
   that if the user passes in a custom kernel command line via command
   line arguments we'll strip off the profile selector (i.e. the initial
   "@X" thing) before we pass it on.

3. The .profile stuff is supposed to be generic and extensible. For
   example we could use it in future to mark "dangerous" options such as
   factory reset, so that boot menus can ask for confirmation before
   booting into it. Or we could introduce match expressions against
   SMBIOS or other system identifiers, to filter out profiles on
   specific hw.

Note btw, that PE allows defining multiple sections that point to the
same offsets in the file. This allows sharing payload under different
names. For example, if profile @4 and @7 shall carry the same .ucode
section, they can define .ucode in each profile and then make it point to
the same offset.

Also note that that one can even "mask" a base section in a profile, by
inserting an empty section. For example, if the base .dtb section should
not be used for profile @4, then add a section .dtb right after the
fourth .profile with a zero size to the UKI, and you will get your wish
fulfilled.

This code only contains changes to sd-stub. A follow-up commit will
teach sd-boot to also find this profile PE sections to synthesize
additional menu entries from a single UKI.

A later commit will add support for gnerating this via ukify.

Fixes: #24539
13 months agoefi: teach PE parsing support for ".profile" sections
Lennart Poettering [Fri, 28 Jun 2024 17:54:46 +0000 (19:54 +0200)] 
efi: teach PE parsing support for ".profile" sections

This adds helpers for:

1. Returning the PE section table of open PE files or memory

2. Scanning PE section tables for the sections that belong to a specific
   profile

13 months agoefi: add free_and_xstrdup16() helper modelled after free_and_strdup() in userspace
Lennart Poettering [Mon, 9 Sep 2024 13:46:52 +0000 (15:46 +0200)] 
efi: add free_and_xstrdup16() helper modelled after free_and_strdup() in userspace

13 months agoMerge pull request #34297 from poettering/shell-prompt-extra
Lennart Poettering [Tue, 10 Sep 2024 04:42:31 +0000 (06:42 +0200)] 
Merge pull request #34297 from poettering/shell-prompt-extra

shell: define three system credentials we can propagate into shell prompts and welcome msgs

13 months agoMerge pull request #34328 from poettering/analyze-help-text
Lennart Poettering [Tue, 10 Sep 2024 04:42:03 +0000 (06:42 +0200)] 
Merge pull request #34328 from poettering/analyze-help-text

analyze: --help text improvements

13 months agoMerge pull request #34330 from poettering/shutdown-async-sync
Lennart Poettering [Tue, 10 Sep 2024 04:41:46 +0000 (06:41 +0200)] 
Merge pull request #34330 from poettering/shutdown-async-sync

shutdown: make all fsync()s asynchronous and apply timeout

13 months agonetworkctl: support editing netdev files by link and cat ":all" 34318/head
Mike Yuan [Sun, 8 Sep 2024 16:09:35 +0000 (18:09 +0200)] 
networkctl: support editing netdev files by link and cat ":all"

Also, don't abuse RET_GATHER in verb_cat(), where the failures
are most likely unrelated to each other.

Closes #34281

13 months agonetworkctl-status-link: show netdev files associated with link
Mike Yuan [Sat, 7 Sep 2024 18:12:04 +0000 (20:12 +0200)] 
networkctl-status-link: show netdev files associated with link

13 months agosd-network: introduce sd_network_link_get_netdev_file{,_dropins}
Mike Yuan [Sat, 7 Sep 2024 17:59:36 +0000 (19:59 +0200)] 
sd-network: introduce sd_network_link_get_netdev_file{,_dropins}

13 months agonetwork: store netdev drop-in paths and dump into state file
Mike Yuan [Sat, 7 Sep 2024 17:51:55 +0000 (19:51 +0200)] 
network: store netdev drop-in paths and dump into state file

13 months agonetworkd-state-file: use ASSERT_PTR where appropriate
Mike Yuan [Sat, 7 Sep 2024 17:49:11 +0000 (19:49 +0200)] 
networkd-state-file: use ASSERT_PTR where appropriate

13 months agonspawn: use ERRNO_IS_NEG_NOT_SUPPORTED() at one more place 34336/head
Yu Watanabe [Mon, 9 Sep 2024 18:44:50 +0000 (03:44 +0900)] 
nspawn: use ERRNO_IS_NEG_NOT_SUPPORTED() at one more place

Follow-up for dc3223919f663b7c8b8d8d1d6072b4487df7709b.
Addresses https://github.com/systemd/systemd/pull/34067#discussion_r1748061156.

Error codes other than ENOSYS may not come here, but if it comes, still
there is nothing we can do here, so let's not log the failure loudly.

13 months agonspawn: sync DeviceAllow= setting with systemd-nspawn@.service
Yu Watanabe [Mon, 9 Sep 2024 18:38:13 +0000 (03:38 +0900)] 
nspawn: sync DeviceAllow= setting with systemd-nspawn@.service

Follow-up for dc3223919f663b7c8b8d8d1d6072b4487df7709b.
Addresses https://github.com/systemd/systemd/pull/34067#discussion_r1748592958.

Otherwise, containers started with and without --keep-unit option run in
different device policies.

13 months agoshutdown: replace unbounded fsync() with bounded sync_with_progress() 34330/head
Lennart Poettering [Mon, 9 Sep 2024 15:53:03 +0000 (17:53 +0200)] 
shutdown: replace unbounded fsync() with bounded sync_with_progress()

Let's put a time-out on this syncing.

Inspired-by: #34289 #34283
13 months agoshutdown: teach sync_with_progress() to optionally sync a specific fd only
Lennart Poettering [Mon, 9 Sep 2024 15:49:33 +0000 (17:49 +0200)] 
shutdown: teach sync_with_progress() to optionally sync a specific fd only

This is preparation for reusing the logic for syncing DM and other
devices with a timeout applied.

13 months agomeson: tweak meson conditionalization for ssh{d,}_config drop-ins 34297/head
Lennart Poettering [Mon, 9 Sep 2024 11:59:10 +0000 (13:59 +0200)] 
meson: tweak meson conditionalization for ssh{d,}_config drop-ins

Let's make sure "no" is an acceptable setting for these paths.

13 months agoshell: define three system credentials we can propagate into shell prompts and welcom...
Lennart Poettering [Fri, 6 Sep 2024 14:30:54 +0000 (16:30 +0200)] 
shell: define three system credentials we can propagate into shell prompts and welcome messages

13 months agomachinectl: suppress redirection notice if --quiet is specified
Lennart Poettering [Fri, 31 May 2024 10:12:24 +0000 (12:12 +0200)] 
machinectl: suppress redirection notice if --quiet is specified

13 months agocore: Add support for PrivateUsers=identity
Daan De Meyer [Mon, 9 Sep 2024 10:25:28 +0000 (12:25 +0200)] 
core: Add support for PrivateUsers=identity

This configures an indentity mapping similar to
systemd-nspawn --private-users=identity.

13 months agoupdate keyboard hwdb to add acer Predator PHN16-72
Yanqing Jing [Mon, 9 Sep 2024 12:18:40 +0000 (20:18 +0800)] 
update keyboard hwdb to add acer Predator PHN16-72

13 months agoMerge pull request #34258 from yuwata/nspawn-volatile-u
Lennart Poettering [Mon, 9 Sep 2024 15:11:11 +0000 (17:11 +0200)] 
Merge pull request #34258 from yuwata/nspawn-volatile-u

nspawn: make --volatile work with -U

13 months agoanalyze: add some roughly useful subsections to --help text 34328/head
Lennart Poettering [Fri, 31 May 2024 10:42:02 +0000 (12:42 +0200)] 
analyze: add some roughly useful subsections to --help text

It's a long long list of verbs we support now, let's make it easier to
digest, like we did in systemctl --help and elsewhere.

13 months agoanalyze: add section underlining to --help text
Lennart Poettering [Fri, 31 May 2024 10:19:22 +0000 (12:19 +0200)] 
analyze: add section underlining to --help text

Do this like we usually do these days.

13 months agosysupdate: Add --transfer-source=
Daan De Meyer [Sun, 8 Sep 2024 14:09:19 +0000 (16:09 +0200)] 
sysupdate: Add --transfer-source=

In mkosi, I want to add a sysupdate verb to wrap systemd-sysupdate.
The definitions will be picked up from mkosi.sysupdate/ and passed
to systemd-sysupdate. I want users to be able to write transfer
definitions that are independent of the output directory used by
mkosi. To make this possible, it should be possible to specify the
directory that transfer sources should be looked up in on the sysupdate
command line. Let's allow this via a new --transfer-source= option.

Additionally, transfer sources that want to take advantage of this
feature should specify PathRelativeTo=directory to indicate the configured
Path= is interpreted relative to the tranfer source directory specified
on the CLI.

This allows for the following transfer definition to be put in
mkosi.sysupdate:

"""
[Transfer]
ProtectVersion=%A

[Source]
Type=regular-file
Path=/
PathRelativeTo=directory
MatchPattern=ParticleOS_@v.usr-%a.@u.raw

[Target]
Type=partition
Path=auto
MatchPattern=ParticleOS_@v
MatchPartitionType=usr
PartitionFlags=0
ReadOnly=1
"""

13 months agoMerge pull request #33833 from YHNdnzj/manager-reload-assert
Mike Yuan [Mon, 9 Sep 2024 12:21:57 +0000 (14:21 +0200)] 
Merge pull request #33833 from YHNdnzj/manager-reload-assert

core/manager: do not re-init Manager.lookup_paths when manager_reload(), minor assorted cleanups

13 months agorepart: Initialize split_name_format in copy_from_one()
Daan De Meyer [Sun, 8 Sep 2024 08:27:55 +0000 (10:27 +0200)] 
repart: Initialize split_name_format in copy_from_one()

Let's allow splitting the partitions from an existing disk image
by initializing split_name_format when using --copy-from=.