repart: Don't fail on boot if we can't find the root block device

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.
This commit is contained in:
Daan De Meyer 2023-09-22 13:47:14 +02:00 committed by Luca Boccassi
parent 8bf1d14112
commit 021b0ff405
2 changed files with 5 additions and 0 deletions

View 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;

View 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