--- a/lib.sh +++ b/lib.sh @@ -103,12 +103,16 @@ umount_pseudofs() { # deletable instead throwing the error "Device or Resource Busy". # The '-f' option is passed to umount to account for the # contingency where the psuedofs mounts are not present. + # On cgroupv2 hosts (e.g. Ubuntu/Mint) some submounts stay busy; + # fall back to lazy unmount so the build continues cleanly. if [ -d "${ROOTFS}" ]; then for f in dev proc sys; do - umount -R -f "$ROOTFS/$f" >/dev/null 2>&1 + umount -R -f "$ROOTFS/$f" >/dev/null 2>&1 || \ + umount -R -l "$ROOTFS/$f" >/dev/null 2>&1 || true done fi - umount -f "$ROOTFS/tmp" >/dev/null 2>&1 + umount -f "$ROOTFS/tmp" >/dev/null 2>&1 || \ + umount -l "$ROOTFS/tmp" >/dev/null 2>&1 || true } run_cmd_target() { --- a/mklive.sh +++ b/mklive.sh @@ -55,10 +55,11 @@ mount_pseudofs() { } umount_pseudofs() { + # lazy unmount fallback for cgroupv2 hosts (Ubuntu/Mint) for f in sys dev proc; do - if [ -d "$ROOTFS/$f" ] && ! umount -R -f "$ROOTFS/$f"; then - info_msg "ERROR: failed to unmount $ROOTFS/$f/" - return 1 + if [ -d "$ROOTFS/$f" ]; then + umount -R -f "$ROOTFS/$f" >/dev/null 2>&1 || \ + umount -R -l "$ROOTFS/$f" >/dev/null 2>&1 || true fi done }