This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1011907 - mount-loop failed to setup loop device: No such file or directory
mount-loop failed to setup loop device: No such file or directory
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-25 07:30 EDT by bfan
Modified: 2015-10-19 11:26 EDT (History)
3 users (show)

See Also:
Fixed In Version: libguestfs-1.22.6-9.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 09:25:43 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description bfan 2013-09-25 07:30:47 EDT
Description of problem:
mount-loop failed to setup loop device: No such file or directory, test it against RHEL-7.0-20130919.0 tree.

 
Version-Release number of selected component (if applicable):
kernel 3.10.0-23.el7.x86_64
libguestfs-1.22.6-8.el7.x86_64
supermin-4.1.4-1.el7.x86_64
augeas-1.1.0-2.el7.x86_64
hivex-1.3.8-1.el7.x86_64
qemu-kvm-1.5.3-3.el7.x86_64
libvirt-1.1.1-6.el7.x86_64


How reproducible:
100%

 
Steps to Reproduce:
# guestfish -N fs
><fs> mount /dev/sda1 /
><fs> upload file.iso /file.iso
><fs> mkmountpoint /loop
><fs> ls /
file.iso
loop
lost+found

><fs> mount-loop /file.iso /loop
libguestfs: trace: mount_loop "/file.iso" "/loop"
guestfsd: main_loop: new request, len 0x44
mount -o loop /sysroot/file.iso /sysroot/loop
mount: /sysroot/file.iso: failed to setup loop device: No such file or directory
guestfsd: error: /file.iso on /loop: mount: /sysroot/file.iso: failed to setup loop device: No such file or directory
guestfsd: main_loop: proc 129 (mount_loop) took 0.03 seconds
libguestfs: trace: mount_loop = -1 (error)
libguestfs: error: mount_loop: /file.iso on /loop: mount: /sysroot/file.iso: failed to setup loop device: No such file or directory


Actual result:


Expect result:


Additional info:
I test RHEL-7.0-20130628.0 tree with all same libguestfs related packages,it works well. I'm not sure what effect it
Comment 1 Richard W.M. Jones 2013-09-25 07:45:00 EDT
Hmm .. kernel bug perhaps?  Does using the -v option provide
any more information?
Comment 2 Richard W.M. Jones 2013-09-25 07:48:52 EDT
It works for me on Fedora 19 / libguestfs 1.23.22, although
that doesn't really mean much.

Some other questions:

 - How was the ISO file prepared?  Perhaps the ISO is faulty.

 - Does the following command work on the host:
   mkdir /tmp/loop; mount -o loop file.iso /tmp/loop
Comment 4 Richard W.M. Jones 2013-09-26 04:09:23 EDT
I can reproduce this with:

kernel-3.10.0-29.el7.x86_64
libguestfs-1.22.6-8.el7.x86_64

The reproducer is:

$ mkdir /tmp/empty
$ genisoimage -o /tmp/test.iso /tmp/empty
$ guestfish -v -N fs -m /dev/sda1 upload /tmp/test.iso /test.iso : mkdir /loop : mount-loop /test.iso /loop

There's not very much information in the verbose output, in
particular no kernel error messages, just:

mount -o loop /sysroot/test.iso /sysroot/loop
mount: /sysroot/test.iso: failed to setup loop device: No such file or directory
guestfsd: error: /test.iso on /loop: mount: /sysroot/test.iso: failed to setup loop device: No such file or directory
libguestfs: error: mount_loop: /test.iso on /loop: mount: /sysroot/test.iso: failed to setup loop device: No such file or directory
libguestfs: closing guestfs handle 0x7f4e38a75bb0 (state 2)
guestfsd: main_loop: proc 129 (mount_loop) took 0.07 seconds
guestfsd: main_loop: new request, len 0x28
Comment 5 Richard W.M. Jones 2013-09-26 04:13:03 EDT
Same, in virt-rescue:

><rescue> mkdir /tmp/empty
><rescue> genisoimage -o /tmp/test.iso /tmp/empty
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
174 extents written (0 MB)
><rescue> mkdir /tmp/loop
><rescue> mount -o loop /tmp/test.iso /tmp/loop
mount: /tmp/test.iso: failed to setup loop device: No such file or directory

stracing the final command in virt-rescue shows the real error
is lack of /dev/loop devices:

readlink("/tmp", 0x7fffea3fe610, 4096)  = -1 EINVAL (Invalid argument)
readlink("/tmp/loop", 0x7fffea3fe610, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev", 0x7fffea3fe610, 4096)  = -1 EINVAL (Invalid argument)
readlink("/run", 0x7fffea3fe610, 4096)  = -1 EINVAL (Invalid argument)
readlink("/sys", 0x7fffea3fe610, 4096)  = -1 EINVAL (Invalid argument)
readlink("/proc", 0x7fffea3fe610, 4096) = -1 EINVAL (Invalid argument)
stat("/dev/loop", 0x7fffea4005f0)       = -1 ENOENT (No such file or directory)
stat("/dev/loop0", 0x7fffea3ff540)      = -1 ENOENT (No such file or directory)
open("/sys/block/loop0/dev", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
readlink("/tmp", 0x7fffea3fe650, 4096)  = -1 EINVAL (Invalid argument)
readlink("/tmp/test.iso", 0x7fffea3fe650, 4096) = -1 EINVAL (Invalid argument)
open("/tmp/test.iso", O_RDWR|O_CLOEXEC) = 3
open("/dev/loop0", O_RDWR|O_CLOEXEC)    = -1 ENOENT (No such file or directory)
close(3)                                = 0
write(2, "mount: ", 7mount: )                  = 7
write(2, "/tmp/test.iso: failed to setup l"..., 42/tmp/test.iso: failed to setup loop device) = 42
write(2, ": ", 2: )                       = 2
write(2, "No such file or directory\n", 26No such file or directory
) = 26

><rescue> ls -l /dev/loop*
ls: cannot access /dev/loop*: No such file or directory
><rescue> ls -l /sys/block/loop*
ls: cannot access /sys/block/loop*: No such file or directory

Loading the kernel module explicitly makes it work:

><rescue> modprobe loop
[  159.545716] loop: module loaded
><rescue> mount -o loop /tmp/test.iso /tmp/loop

So the question would be why the kernel module needs to be
loaded explicitly or isn't loaded automatically?
Comment 6 Richard W.M. Jones 2013-09-26 06:00:07 EDT
kmod/systemd playing silly buggers again.  Here is the fix:

https://github.com/libguestfs/libguestfs/commit/e2895b19bb2be67c01172cdd0634553c21923605
Comment 8 bfan 2013-12-04 04:29:02 EST
Verified with libguestfs-1.22.6-16.el7.x86_64

$ mkdir /tmp/empty
$ genisoimage -o /tmp/test.iso /tmp/empty
$ guestfish -v -N fs -m /dev/sda1 upload /tmp/test.iso /test.iso : mkdir /loop : mount-loop /test.iso /loop


Execute no error
Comment 9 Ludek Smid 2014-06-13 09:25:43 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.