Skip to content

mkarchroot: unshare mount namespace to avoid broken root chroot creation (FS#64698)

Copied from the bug report:

* run extra-x86_64-build -c
* while it's 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
* run extra-x86_64-build -c again later, you'll see the error:

$ 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...

Patch adjusted from https://github.com/archlinuxcn/repo/blob/3e8b62651d8bc8cba93ac1c269f1b5adb6e97e65/archlinuxcn/devtools-archlinuxcn/unshare-pacstrap.patch

Merge request reports