]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Don't fail on boot if we can't find the root block device
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 22 Sep 2023 11:47:14 +0000 (13:47 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 22 Sep 2023 15:01:12 +0000 (16:01 +0100)
When booting from virtiofs, we won't be able to find a root block
device. Let's gracefully handle this similar to how we don't fail
if we can't find a GPT partition table.

src/partition/repart.c
units/systemd-repart.service.in

index 6cadc5f66835478837a098fb367953fc365b7439..2cc4881ada24cf39d492f346d67e458d813d6adf 100644 (file)
@@ -7344,6 +7344,9 @@ static int run(int argc, char *argv[]) {
                 return r;
 
         r = find_root(context);
+        if (r == -ENODEV)
+                return 76; /* Special return value which means "Root block device not found, so not doing
+                            * anything". This isn't really an error when called at boot. */
         if (r < 0)
                 return r;
 
index b1322a159befd3c380939967c9220fd84a6dec09..2b57b93ca874878575af15138a826449dac4f705 100644 (file)
@@ -31,5 +31,7 @@ Type=oneshot
 RemainAfterExit=yes
 ExecStart={{BINDIR}}/systemd-repart --dry-run=no
 
+# The tool returns 76 if it can't find the root block device
+SuccessExitStatus=76
 # The tool returns 77 if there's no existing GPT partition table
 SuccessExitStatus=77