sysext: provide systemd-{sysext,confext}-sysroot.service services (#41161)

This should pretty much close #38985

The new services are used to activate system and configuration
extensions for the main system from the initrd, this allows to overcome
the limitation that sysext/confext cannot be used to update the
resources which are required in the earliest boot of the system (before
systemd-sysext/systemd-confext start).

To make it possible to disable sysext/confext merging logic,
`systemd.sysext=0`, `systemd.confext=0`, `rd.systemd.sysext=0`,
`rd.systemd.confext=0` kernel cmdline options are introduced.

Closes #38985
This commit is contained in:
Lennart Poettering
2026-04-08 11:30:20 +02:00
committed by GitHub
15 changed files with 169 additions and 23 deletions
+17
View File
@@ -51,6 +51,7 @@
#include "path-util.h"
#include "pidref.h"
#include "pretty-print.h"
#include "proc-cmdline.h"
#include "process-util.h"
#include "rm-rf.h"
#include "runtime-scope.h"
@@ -3038,6 +3039,22 @@ static int run(int argc, char *argv[]) {
if (r <= 0)
return r;
/* PROC_CMDLINE_STRIP_RD_PREFIX cannot be used here as we need to be able to distinguish between
* rd.systemd.{sysext,confext} and systemd.{sysext,confext} in the initrd where they are both used
* and have different meaning. */
const char *string_class = image_class_to_string(arg_image_class);
const char *cmdline_opt = strjoina(in_initrd() && !arg_root ? "rd." : "", "systemd.", string_class);
bool enabled;
r = proc_cmdline_get_bool(cmdline_opt, PROC_CMDLINE_TRUE_WHEN_MISSING, &enabled);
if (r < 0)
log_debug_errno(r, "Failed to check '%s=' kernel command line option, proceeding: %m", cmdline_opt);
else if (!enabled && invoked_by_systemd()) {
/* Kernel command line option should not affect manual invocation. */
log_notice("Disabled by the kernel command line option '%s=', skipping execution.", cmdline_opt);
return 0;
}
/* Parse configuration file after argv because it needs --root=.
* The config entries will not overwrite values set already by
* env/argv because we track initialization. */