Ubuntu: Can't mount ISO file as loop device: Error: “failed to setup loop device”



Question:

sudo mkdir -p /media/cdrom  cd ~  sudo mount -o loop ubuntu-* /  mount: ubuntu-*: failed to setup loop device: No such file or directory  


Solution:1

First make sure you have mounted loop device kernel module. So run:

lsmod | grep loop

If you get no output, that means you have to mount the loop device kernel module . So:

modprobe loop

Re-run the following to make sure the module is loaded. You should get some outputs:

lsmod | grep loop

Now, to mount an ISO file as loop device do the following:

mount -o loop -t iso9660 <path/to/iso/file> /media/cdrom

However I guess it should also work without the -t iso9660 part.


Solution:2

I suspect you're blindly following some instructions on how to mount an Ubuntu ISO image using the loop device.

sudo mkdir -p /media/cdrom  

This creates a directory cdrom owned by root in /media if not existing, and it's meant to be used as the to be mounted filesystem's mount point;

cd ~  

This changes the current working directory of your terminal instance to ~, which is a shorthand which expands to your home directory's path;

sudo mount -o loop ubuntu-* /  

This attempts to mount all the files matching ubuntu-* (all the files having a filename starting with ubuntu-) in your home directory using the loop device and / as the mount point. Just don't do that. It's not useful at all to match against a wildcard if you're trying to mount a single ISO image, leaving aside that fact that you want your / mount point to keep holding the root partition. Mount the ISO image specifying its exact filename and mount it on the mount point you just created (/media/cdrom). In order to do that, make sure that the ISO image you want to mount is present in your home directory and change ubuntu-* with the full name of the ISO image. For example, to mount the official image of Ubuntu Desktop 14.04.2 64-bit the command would be:

sudo mount -o loop ubuntu-14.04.2-desktop-amd64.iso /media/cdrom  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »