diff options
author | Felix Yan <felixonmars@archlinux.org> | 2022-02-18 13:35:43 +0000 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2022-06-09 00:56:41 +0200 |
commit | 0c61761f33b2cb7613720596ed9373ab0872df31 (patch) | |
tree | 75bc78fe3af5bf5ca3eee20d76a34daad1a45a63 /mkarchroot.in | |
parent | c2f163b6408fb69c2b85da17d7656cd75ac5449d (diff) | |
download | devtools-0c61761f33b2cb7613720596ed9373ab0872df31.tar.xz |
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
Diffstat (limited to 'mkarchroot.in')
-rw-r--r-- | mkarchroot.in | 2 |
1 files changed, 1 insertions, 1 deletions
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" |