mount: could not find any free loop device

Sunday, February 28th, 2010 @ 12:31 pm | Howto, openSUSE

I got this error message when I was trying to mount an iso image to a derectory:
mount: could not find any free loop device

That was strange, since ‘mount’ showed that there was only one loop device mounted:

/ISO_images/SLED-11-DVD-i586-GM-DVD.iso on /path/SLED-11 type iso9660 (rw,loop=/dev/loop0)

Some googling and I found Losetup.

From ‘man losetup’: losetup – set up and control loop devices

First find out the loop device status:
losetup -a

/dev/loop0: [0821]:26001460 (/ISO_images/SLE-11-SDK-DVD-i586-GM-Media1.iso)
/dev/loop1: [0821]:26001460 (/ISO_images/SLE-11-SDK-DVD-i586-GM-Media1.iso)
/dev/loop2: [0821]:26001424 (/ISO_images/SLES-11-DVD-i586-GM-DVD1.iso)
/dev/loop3: [0821]:26001456 (/ISO_images/SLED-11-DVD-i586-GM-DVD.iso)
/dev/loop4: [0821]:26001456 (/ISO_images/SLED-11-DVD-i586-GM-DVD.iso)
/dev/loop5: [0821]:26001456 (/ISO_images/SLED-11-DVD-i586-GM-DVD.iso)
/dev/loop6: [0821]:26001456 (/ISO_images/SLED-11-DVD-i586-GM-DVD.iso)
/dev/loop7: [0821]:26001460 (/ISO_images/SLE-11-SDK-DVD-i586-GM-Media1.iso)
/dev/loop8: [0821]:26001460 (/ISO_images/SLE-11-SDK-DVD-i586-GM-Media1.iso)

The above shows that all devices (8 by default) are in use.
I had been mounting and unmounting those images during a couple of days. Somehow they had not become unmounted properly though.

To free one them:

losetup -d /dev/loop8

This needs to be done to all of them to free them.

After freeing them the ‘mount -o loop’ works normally again.
The problem described there must be a bug somewhere.
I have no idea whether it is the kernel, mount, umount or what.

Feel free to comment if you are familiar with this :)


Comments are closed.