]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
generator: add root=off to explicitly turn search for rootfs off
authorLennart Poettering <lennart@poettering.net>
Fri, 14 Mar 2025 14:57:03 +0000 (15:57 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 3 Apr 2025 09:08:57 +0000 (11:08 +0200)
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

src/fstab-generator/fstab-generator.c
src/shared/generator.c

index 51df843f122967a638458ed2966804a730475c07..ab009e8b212ce39b3514ac545788a72cddafb6f0 100644 (file)
@@ -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);
index 0fa7dca86721d02d4ba67e6f2d09c1420aa9d581..d1c643b9231cd0f02ecbe1959a4128ba513583f0 100644 (file)
@@ -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;
 }