I am using a rather complicated, yet likely (if dm-crypt becomes more widely used) setup. /home is on a lvm2-volume (/dev/mapper/vgbase-home) Inside this volume is a file which is attached to a loop device (/dev/loop7). However, instead of directly mounting this file, I am accesing it through dm-crypt (/dev/mapper/crypt-home). Since it isn't directly mounted, the loop-device handling in halt.sh fails to detect and detach this loop-device. As a consequence, /home can not be unmounted and vgbase-home and crypt-home cannot be deactivated. Following is a fix I was able to create. It needs to be placed in halt.sh before regular unmounting. # get a list of all dm-mappings on top of loop devices. Based on # the assumption that loop devices always use major number 7. # umount filesystem, remove mapping and loop device if [ -f "/sbin/dmsetup" ] then for i in `/sbin/dmsetup deps | grep \(7\, | awk '{ print $1}'| sed s/\:/\/` do # get minor number of loop device LN=`/sbin/dmsetup deps $i | awk '{ print $5}' | sed s/\)/\/` umount /dev/mapper/${i} /sbin/dmsetup remove ${i} /sbin/losetup -d /dev/loop${LN} unset LN done fi Reproducible: Always Steps to Reproduce: 1. Create a loop based device-mapping inside another device-mapping (encrpted or not should not matter) 2. mount it 3. shutdown or reboot Actual Results: base device /home fails to umount, mapping and loop device are not detached
Created attachment 32655 [details] Revised fix This version avoids potentially dangerous sed replacements. It still lacks a proper check to find out if actually mounted, but uses a hack to prevent error.
For simple loop mounts (eg squashfs) mounted correctly by bootscripts, but with binds on them, the stopscript "forgets" to first unmount the binds before wanting to unmount the loop filesystem. Because of this it always says, it can't unmount the loop filesystems. Here the relevant part of /etc/fstab ... /home/squashfs.sqfs /mnt/myloopfs squashfs loop 0 0 /mnt/otherfs /mnt/myloopfs/somefolder bind bind 0 0 ... My baselayout version: sys-apps/baselayout-1.9.4-r6
marc is this still a problem? please reopen if so.