chroot_teardown: umount: race condition
When I run mkarchiso
having in profiledef.sh
the variable airootfs_image_type="erofs"
, the process fails at pacstrap
with:
umount: _BUILD/x86_64/airootfs/sys/firmware/efi/efivars: target is busy.
umount: _BUILD/x86_64/airootfs/sys: target is busy.
The root cause is that at pacstrap
the function chroot_teardown
tries to unmount everything at once, being that sys
is a mount within efivars
.
Unmounting lazily solves it:
chroot_teardown() {
if (( ${#CHROOT_ACTIVE_MOUNTS[@]} )); then
umount -l "${CHROOT_ACTIVE_MOUNTS[@]}"
fi
unset CHROOT_ACTIVE_MOUNTS
}
Edited by Alberto Salvia Novella