sudo mkdir -p /media/cdrom
cd ~
sudo mount -o loop ubuntu-* /
mount: ubuntu-*: failed to setup loop device: No such file or directory
- 20,938
- 161
4 Answers
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.
- 17,371
- 20,938
I'm aware that the this is not a direct answer to the OP's question. however I decided to drop an answer because this post was a high ranked result when I googled about my own situation.
In my case running as a non-root user caused the following error:
failed to setup loop device for /home/user/ubuntu-22.04.3-live-server-amd64.iso
Don't forget to run mount command with root privileges.
You can run it with sudo for example.
- 143
- 5
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
- 41,268
This mounted my file for me
sudo mount -o loop ubuntu-14.04.2-desktop-amd64.iso /media/cdrom
Thanks kos
- 1