base-files: upgrade: try umount lvm and loop devices
authorDaniel Golle <daniel@makrotopia.org>
Wed, 4 Aug 2021 18:03:16 +0000 (19:03 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 4 Aug 2021 18:12:34 +0000 (19:12 +0100)
Try umount on device mapper and loop devices still mounted, so the
subsequent call to disactivate all physical volumes and delete all
loop devices is more likely to succeed.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
package/base-files/files/lib/upgrade/stage2

index 30ad19f7f1b3e64f044eafaceda90745093789a3..45fb98d88969890d277b16dda94568b0189e5ac8 100755 (executable)
@@ -64,6 +64,10 @@ switch_to_ramfs() {
        /bin/mount -o remount,ro /mnt
        /bin/umount -l /mnt
 
+       grep -e "^/dev/dm-.*" -e "^/dev/loop.*" /proc/mounts | while read bdev mp _r; do
+               umount $mp
+       done
+
        [ "$RAMFS_COPY_LOSETUP" ] && losetup -D
        [ "$RAMFS_COPY_LVM" ] && {
                mkdir -p /tmp/lvm/cache