diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md index 30c987f8341..b6e59144fbd 100644 --- a/docs/ENVIRONMENT.md +++ b/docs/ENVIRONMENT.md @@ -596,6 +596,13 @@ SYSTEMD_HOME_DEBUG_SUFFIX=foo \ parts of the session continue running. Thus, we highly recommend that this variable isn't used unless necessary. Defaults to true. +`homectl`: + +* `$SYSTEMD_HOME_FIRSTBOOT_OVERRIDE` – if set to "1" will make `homectl + firstboot --prompt-new-user` interactively ask for user creation, even if + there already exists at least one regular user on the system. If set to "0" + will make the tool skip any such query. + `kernel-install`: * `$KERNEL_INSTALL_BYPASS` – If set to "1", execution of kernel-install is skipped diff --git a/src/home/homectl.c b/src/home/homectl.c index ad372c84202..cc2f0735827 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -2697,12 +2697,20 @@ static int verb_firstboot(int argc, char *argv[], void *userdata) { if (r > 0) /* Already created users from credentials */ return 0; - r = has_regular_user(); - if (r < 0) - return r; - if (r > 0) { - log_info("Regular user already present in user database, skipping user creation."); + r = getenv_bool("SYSTEMD_HOME_FIRSTBOOT_OVERRIDE"); + if (r == 0) return 0; + if (r < 0) { + if (r != -ENXIO) + log_warning_errno(r, "Failed to parse $SYSTEMD_HOME_FIRSTBOOT_OVERRIDE, ignoring: %m"); + + r = has_regular_user(); + if (r < 0) + return r; + if (r > 0) { + log_info("Regular user already present in user database, skipping user creation."); + return 0; + } } return create_interactively();