Depending on whether bwrap is installed setuid or not it might try
to not create a user namespace. Let's explicitly tell it to create
one if we're not invoking it as root to make sure one is always
created.
# We mounted a subdirectory of TMPDIR to /var/tmp so we unset TMPDIR so that /tmp or /var/tmp are used instead.
"--unsetenv", "TMPDIR",
]
+
+ # Make sure that bubblewrap uses a user namespace even if it's installed as setuid.
+ if os.getuid() != 0:
+ cmdline += ["--unshare-user"]
+
mounts += [Mount(tools / "usr", "/usr", ro=True)]
if relaxed: