From 1c1cfc9d47147e93a37e831560754e3990fb0d75 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 8 Sep 2022 10:24:04 +0200 Subject: [PATCH] Make sure nspawn doesn't try to start a container in nspawn_knows_arg() --- mkosi/backend.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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: -- 2.47.2