From 0c61761f33b2cb7613720596ed9373ab0872df31 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Fri, 18 Feb 2022 13:35:43 +0000 Subject: mkarchroot: unshare mount namespace to avoid broken root chroot creation While `extra-x86_64-build -c` is running `pacstrap` and has `/var/lib/archbuild/extra-x86_64/root/run` mounted, another user logs in, thus creating a new mountpoint `/run/user/$uid` that propagates into `/var/lib/archbuild/extra-x86_64/root/run/user/$uid` leading to a broken root chroot. Successive `extra-x86_64-build -c` calls will result in cleanup errors: ``` $ extra-x86_64-build -c ==> Creating chroot for [extra] (x86_64)... -> Deleting chroot copy 'root'... rm: skipping '/var/lib/archbuild/extra-x86_64/root/run', since it's on a different device rm: skipping '/var/lib/archbuild/extra-x86_64/root/run', since it's on a different device ==> ERROR: Working directory '/var/lib/archbuild/extra-x86_64/root' already exists ==> ERROR: Aborting... ``` Reported by and patch adjusted from archlinuxcn. Fixes FS#64698 --- mkarchroot.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mkarchroot.in') diff --git a/mkarchroot.in b/mkarchroot.in index 3e08af2..8fb52ac 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -81,7 +81,7 @@ for file in "${files[@]}"; do cp "$file" "$working_dir$file" done -pacstrap -${umode}Mcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ +unshare --mount pacstrap -${umode}Mcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen" -- cgit v1.2.3-70-g09d2