]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
mkosi-initrd: fix misleading "mkosi not found" error message
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Fri, 28 Mar 2025 09:19:48 +0000 (10:19 +0100)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Fri, 28 Mar 2025 10:31:47 +0000 (11:31 +0100)
There is a special handling when a script under /work fails with 127, which is
also reached when mkosi is called within mkosi-initrd.

```
‣ Running finalize script /etc/mkosi-initrd/mkosi.finalize…
/work/finalize: line 5: strip: command not found
‣ /work/finalize failed with non-zero exit code 127
‣ (Maybe a program was not found or the script interpreter (e.g. bash) is not installed?)
‣ mkosi not found.
```

mkosi/run.py

index deb18f90d08bbbc68fe9e7f925aa14522a2c32aa..092a3e339a59fc33a4baf2fd487ae7ff7f6a7ddb 100644 (file)
@@ -110,7 +110,7 @@ def log_process_failure(sandbox: Sequence[str], cmdline: Sequence[str], returnco
             f'"{shlex.join([*sandbox, *cmdline] if ARG_DEBUG.get() else cmdline)}"'
             f" was killed by {signal.Signals(-returncode).name} signal."
         )
-    elif returncode == 127:
+    elif returncode == 127 and cmdline[0] != "mkosi":
         # Anything invoked beneath /work is a script that we mount into place (so we know it exists). If one
         # of these scripts fails with exit code 127, it's either because the script interpreter was not
         # installed or because one of the commands in the script failed with exit code 127.