From: Daan De Meyer Date: Thu, 8 Sep 2022 08:24:04 +0000 (+0200) Subject: Make sure nspawn doesn't try to start a container in nspawn_knows_arg() X-Git-Tag: v14~42^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1176%2Fhead;p=thirdparty%2Fmkosi.git Make sure nspawn doesn't try to start a container in nspawn_knows_arg() --- diff --git a/mkosi/backend.py b/mkosi/backend.py index b1debc2d2..d5c31b347 100644 --- a/mkosi/backend.py +++ b/mkosi/backend.py @@ -654,8 +654,12 @@ def var_tmp(root: Path) -> Path: def nspawn_knows_arg(arg: str) -> bool: - return "unrecognized option" not in run([nspawn_executable(), arg], stdout=subprocess.DEVNULL, - stderr=subprocess.PIPE, check=False, text=True).stderr + # Specify some extra incompatible options so nspawn doesn't try to boot a container in the current + # directory if it has a compatible layout. + return "unrecognized option" not in run([nspawn_executable(), arg, + "--directory", "/dev/null", "--image", "/dev/null"], + stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, check=False, + text=True).stderr def format_rlimit(rlimit: int) -> str: