From: Daan De Meyer Date: Mon, 15 Dec 2025 20:24:15 +0000 (+0100) Subject: sandbox: Add better error reporting for overlayfs X-Git-Tag: v26~7^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2338b9a86cf61ab3d2c393ad49afecd5da8fb72;p=thirdparty%2Fmkosi.git sandbox: Add better error reporting for overlayfs Let's do some basic checks up front so we catch trivial errors ourselves instead of having to debug obscure errors we get back from the kernel when calling mount(). --- diff --git a/mkosi/sandbox.py b/mkosi/sandbox.py index bb10902ae..22829b90d 100755 --- a/mkosi/sandbox.py +++ b/mkosi/sandbox.py @@ -946,6 +946,16 @@ class OverlayOperation(FSOperation): workdir = chase(oldroot, self.workdir) if self.workdir else None dst = chase(newroot, self.dst) + for p in lowerdirs: + if not os.path.exists(p): + oserror("mount", p, ENOENT) + + if upperdir and upperdir != "tmpfs" and upperdir != dst and not os.path.exists(upperdir): + oserror("mount", upperdir, ENOENT) + + if workdir and not os.path.exists(workdir): + oserror("mount", workdir, ENOENT) + with umask(~0o755): os.makedirs(os.path.dirname(dst), exist_ok=True)