Cannot delete device /dev/loop0
Are you sure that the device isn't busy? Have you ever tried fuser to determine an possible PID?
Precautionary get all possible information:
fuser -c /dev/loop0fuser -d /dev/loop0fuser -f /dev/loop0
Try to stop the process, which could use /dev/loop0. If necessary use kill -9
or try fuser -k
to send the kill signal -> look at man fuser
.
I had a similar issue with an SD card and Aaoron Flin's suggestion to use dmsetup worked for me.
Specifically, you should be able to ls
/dev/mapper to see if any loop0pX
partitions exist.
If so, you can use dmsetup remove /dev/mapper/loop0p2
to get rid of any unnecessary partitions. This can be useful if you want to keep some mappings attached.