From: Antonio Alvarez Feijoo Date: Fri, 28 Mar 2025 09:19:48 +0000 (+0100) Subject: mkosi-initrd: fix misleading "mkosi not found" error message X-Git-Tag: v26~288 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=708c2cac3121ad2bb61469e220e0caa250945c8c;p=thirdparty%2Fmkosi.git mkosi-initrd: fix misleading "mkosi not found" error message 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. ``` --- diff --git a/mkosi/run.py b/mkosi/run.py index deb18f90d..092a3e339 100644 --- a/mkosi/run.py +++ b/mkosi/run.py @@ -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.