diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml index b0cc3fea01..8a899aee56 100644 --- a/man/kernel-command-line.xml +++ b/man/kernel-command-line.xml @@ -433,8 +433,11 @@ Takes a boolean argument, defaults to on. If off, systemd-firstboot.service8 - will not query the user for basic system settings, even if the system boots up for the first time and the - relevant settings are not initialized yet. + will not query the user for basic system settings, even if the system boots up for the first time and + the relevant settings are not initialized yet. Not to be confused with + systemd.condition-first-boot= (see below), which overrides the result of the + ConditionFirstBoot= unit file condition, and thus controls more than just + systemd-firstboot.service behaviour. @@ -445,6 +448,17 @@ systemd.unit5 for details. + + + systemd.condition-first-boot= + + Takes a boolean argument. If specified, overrides the result of + ConditionFirstBoot= unit condition checks. See + systemd.unit5 for + details. Not to be confused with systemd.firstboot= which only controls behaviour + of the systemd-firstboot.service system service but has no effect on the + condition check (see above). + diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index e8563bcc0a..fa8ed1b47b 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -1312,6 +1312,10 @@ (specifically: an /etc with no /etc/machine-id). This may be used to populate /etc on the first boot after factory reset, or when a new system instance boots up for the first time. + + If the systemd.condition-first-boot= option is specified on the kernel + command line (taking a boolean), it will override the result of this condition check, taking + precedence over /etc/machine-id existence checks. diff --git a/src/shared/condition.c b/src/shared/condition.c index b17403855a..bf3b5fa162 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -627,11 +627,18 @@ static int condition_test_needs_update(Condition *c, char **env) { static int condition_test_first_boot(Condition *c, char **env) { int r, q; + bool b; assert(c); assert(c->parameter); assert(c->type == CONDITION_FIRST_BOOT); + r = proc_cmdline_get_bool("systemd.condition-first-boot", &b); + if (r < 0) + log_debug_errno(r, "Failed to parse systemd.condition-first-boot= kernel command line argument, ignoring: %m"); + if (r > 0) + return b == !!r; + r = parse_boolean(c->parameter); if (r < 0) return r;