From: Lennart Poettering Date: Fri, 14 Mar 2025 14:57:03 +0000 (+0100) Subject: generator: add root=off to explicitly turn search for rootfs off X-Git-Tag: v258-rc1~923^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c05a132fef0e9843b499b40fca3af49fe2cc9a4b;p=thirdparty%2Fsystemd.git generator: add root=off to explicitly turn search for rootfs off This is useful when booting into storage target mode, where we do not want to enter a root fs, we just want to stay forever in the initrd, and hence there's value in not even generating and jobs to find the rootfs --- diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 51df843f122..ab009e8b212 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -1132,6 +1132,11 @@ static bool validate_root_or_usr_mount_source(const char *what, const char *swit return false; } + if (streq(what, "off")) { + log_debug("Skipping %s directory handling, as this was explicitly turned off.", switch_name); + return false; + } + if (parse_gpt_auto_root(what) > 0) { /* This is handled by gpt-auto-generator */ log_debug("Skipping %s directory handling, as gpt-auto was requested.", switch_name); diff --git a/src/shared/generator.c b/src/shared/generator.c index 0fa7dca8672..d1c643b9231 100644 --- a/src/shared/generator.c +++ b/src/shared/generator.c @@ -1114,6 +1114,10 @@ GptAutoRoot parse_gpt_auto_root(const char *value) { return GPT_AUTO_ROOT_DISSECT_FORCE; } - log_debug("Disabling root partition auto-detection, root= is neither unset, nor set to 'gpt-auto', 'gpt-auto-force', 'dissect' or 'dissect-force'."); + if (streq(value, "off")) + log_debug("Disabling root partition auto-detection, root= handling is explicitly turned off."); + else + log_debug("Disabling root partition auto-detection, root= is neither unset, nor set to 'gpt-auto', 'gpt-auto-force', 'dissect' or 'dissect-force'."); + return GPT_AUTO_ROOT_OFF; }