From: Daan De Meyer Date: Mon, 29 Aug 2022 17:19:02 +0000 (+0200) Subject: debian/ubuntu: Ignore apt config from the host system X-Git-Tag: v14~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54a9563dceab4742b2f1bcec3b9ae260ecfc397b;p=thirdparty%2Fmkosi.git debian/ubuntu: Ignore apt config from the host system We only want to consider the apt config from the target system. Because apt is rather inflexible and only parses the Dir option we pass via the CLI after parsing all the config files from the host, we have to resort to bind mounting an empty directory over /etc/apt on the host to prevent it from reading configuration from there. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 6af6059c7..5cd0e631c 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2447,7 +2447,9 @@ def invoke_apt( INITRD="No", ) - with mount_api_vfs(args, root): + # Overmount /etc/apt on the host with an empty directory, so that apt doesn't parse any configuration + # from it. + with mount_bind(workspace(root) / "apt", Path("/") / "etc/apt"), mount_api_vfs(args, root): return run(cmdline, env=env, text=True, **kwargs)