Bug 1242853

Summary: mount-loop failed to setup loop device: No such file or directory
Product: Red Hat Enterprise Linux 7 Reporter: Hu Zhang <huzhan>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: fdeutsch, leiwang, linl, ptoscano, sherold, wshi, xchen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.31.7-2.el7.x86_64 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 17:54:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1165785, 1218766    
Bug Blocks: 1288337, 1301891    

Description Hu Zhang 2015-07-14 09:25:35 UTC
Description of problem:
"mount-loop" fails to mount a filesystem image. It returns "failed to setup loop device: No such file or directory". Same as Bug 1011907.

Version-Release number of selected component (if applicable):
kernel-3.10.0-290.el7.x86_64
libguestfs-1.28.1-1.46.el7.x86_64
libguestfs-winsupport-7.2-1.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. # qemu-img create test-loop.raw 100M
   # qemu-img create test.raw 500M

2. # guestfish -a test-loop.raw
   ><fs> part-disk /dev/sda mbr
   ><fs> mkfs ext3 /dev/sda
   ><fs> mount /dev/sda /
   ><fs> exit

3. # guestfish -a test.raw -vx
   ><fs> part-disk /dev/sda mbr
   ><fs> mkfs ext3 /dev/sda1
   ><fs> mount /dev/sda /
   ><fs> upload /path/to/test-loop.raw /test-loop.raw
   ><fs> mkmountpoint /loop
   ><fs> mount-loop /test-loop.raw /loop/
  
Actual results:
In step 3,
><fs> mount-loop /test-loop.raw /loop/
libguestfs: trace: mount_loop "/test-loop.raw" "/loop/"
guestfsd: error: /test-loop.raw on /loop/: mount: /sysroot/test-loop.raw: failed to setup loop device: No such file or directory
libguestfs: trace: mount_loop = -1 (error)
libguestfs: error: mount_loop: /test.raw on /loop/: mount: /sysroot/test-loop.raw: failed to setup loop device: No such file or directory

Expected results:
In step 3, mount-loop can mount the image to the mount point successfully.

Additional info:

Comment 2 Richard W.M. Jones 2015-07-14 09:55:06 UTC
This works if you run:

><fs> modprobe loop
><fs> mount-loop /test-loop.raw /loop

It probably means we are missing a udev rule somewhere.

I can only reproduce the bug on RHEL 7.2, not on Fedora.

Comment 3 Pino Toscano 2015-10-19 13:22:17 UTC
This is basically the RHEL version of bug #1165785.

The fix (commit 3dabc7a7bae709e884b56e297e7ece222e653d0c) is part of libguestfs >= 1.29.9, and thus it will be picked by the rebase (bug #1218766).

I just sent the small instructions this bug as regression test case, so we can check this keeps working:
  https://www.redhat.com/archives/libguestfs/2015-October/msg00198.html

Comment 7 Xianghua Chen 2016-06-28 05:50:02 UTC
Verified with the packages:
libguestfs-1.32.5-6.el7.x86_64

Verify steps:
1. # qemu-img create test-loop.raw 100M
   # qemu-img create test.raw 500M

2. # guestfish -a test-loop.raw
   ><fs> part-disk /dev/sda mbr
   ><fs> mkfs ext3 /dev/sda
   ><fs> mount /dev/sda /
   ><fs> exit

3. # guestfish -a test.raw 
   ><fs> part-disk /dev/sda mbr
   ><fs> mkfs ext3 /dev/sda
   ><fs> mount /dev/sda /
   ><fs> upload /path/to/test-loop.raw /test-loop.raw
   ><fs> mkmountpoint /loop
   ><fs> mount-loop /test-loop.raw /loop/

Commands finished successfully.

So Verified.

Comment 9 errata-xmlrpc 2016-11-03 17:54:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2576.html