Bug 668611

Summary: guestfish -i is trying to mount all mounts from /etc/fstab and fails with an error when device doesn't exists
Product: Red Hat Enterprise Linux 6 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: dallan, mbooth, mgoldman, mshao, virt-maint, yuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: libguestfs-1.7.17-9.el6 Doc Type: Bug Fix
Doc Text:
When a device in /etc/fstab did not exist, the "guestfish -i" command failed with a "No such file or directory" error. In the event of missing devices, guestfish now completes, and reports that some file systems could not be mounted. Note that this bug was reported and corrected during development. It was not seen in production systems in the field.
Story Points: ---
Clone Of: 668574 Environment:
Last Closed: 2011-05-19 11:46:00 UTC Type: ---
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: 668574    
Bug Blocks:    

Description Richard W.M. Jones 2011-01-10 21:53:31 UTC
+++ This bug was initially created as a clone of Bug #668574 +++

Description of problem:

If a device from /etc/fstab doesn't exists - guestfish -i fails to load.

/etc/fstab content:

LABEL=/     /         ext4    defaults         1 1
/dev/xvdb   /mnt      ext3    defaults         0 0
/dev/xvdc   /data     ext3    defaults         0 0
none       /dev/pts  devpts  gid=5,mode=620   0 0
none       /dev/shm  tmpfs   defaults         0 0
none       /proc     proc    defaults         0 0
none       /sys      sysfs   defaults         0 0

If I remove /dev/xvd* mount points from above /etc/fstab file the image gets mounted as expected with -i switch.

Version-Release number of selected component (if applicable):

guestfish-1.8.0-1.fc14.x86_64

Guest is RHEL 6.

How reproducible:

Always with additional devices in /etc/fstab

Steps to Reproduce:
1. Add some mount point to /etc/fstab
2. run guestfish -i image

Actual results:

$ guestfish -x -i rhel-basic.ec2 
add_drive_opts "rhel-basic.ec2" = 0
is_config = 1
launch = 0
list_partitions = [""]
inspect_osumount_all = 0
list_devices = ["/dev/vda"]
vfs_type "/dev/vda" = "ext4"
mount_ro "/dev/vda" "/" = 0
is_dir "/etc" = 1
is_dir "/bin" = 1
is_dir "/share" = 0
is_file "/grub/menu.lst" = 0
is_file "/grub/grub.conf" = 0
is_file "/etc/freebsd-update.conf" = 0
is_file "/etc/fstab" = 1
exists "/etc/lsb-release" = 0
exists "/etc/redhat-release" = 1
filesize "/etc/redhat-release" = 55
head_n 1 "/etc/redhat-release" = ["Red Hat Enterprise Linux Server release 6.0 (Santiago)"]
is_file "/bin/bash" = 1
file_architecture "/bin/bash"file "/bin/bash" = "ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped"
 = "x86_64"
filesize "/etc/fstab" = 354
aug_init "/" 48 = 0
aug_rm "/augeas/load//incl[. != "/etc/fstab"]" = 158
aug_load = 0
aug_ls "/files/etc/fstab" = ["/files/etc/fstab/1", "/files/etc/fstab/2", "/files/etc/fstab/3", "/files/etc/fstab/4", "/files/etc/fstab/5", "/files/etc/fstab/6", "/files/etc/fstab/7"]
aug_get "/files/etc/fstab/1/spec" = "LABEL=/"
aug_get "/files/etc/fstab/1/file" = "/"
findfs_label "/" = "/dev/vda"
aug_get "/files/etc/fstab/2/spec" = "/dev/xvdb"
aug_get "/files/etc/fstab/2/file" = "/mnt"
list_devices = ["/dev/vda"]
aug_get "/files/etc/fstab/3/spec" = "/dev/xvdc"
aug_get "/files/etc/fstab/3/file" = "/data"
list_devices = ["/dev/vda"]
aug_get "/files/etc/fstab/4/spec" = "none"
aug_get "/files/etc/fstab/4/file" = "/dev/pts"
aug_get "/files/etc/fstab/5/spec" = "none"
aug_get "/files/etc/fstab/5/file" = "/dev/shm"
aug_get "/files/etc/fstab/6/spec" = "none"
aug_get "/files/etc/fstab/6/file" = "/proc"
aug_get "/files/etc/fstab/7/spec" = "none"
aug_get "/files/etc/fstab/7/file" = "/sys"
aug_close = 0
is_file "/etc/HOSTNAME" = 0
is_file "/etc/hostname" = 0
is_file "/etc/sysconfig/network" = 1
filesize "/etc/sysconfig/network" = 65
aug_init "/" 48 = 0
aug_rm "/augeas/load//incl[. != "/etc/sysconfig/network"]" = 158
aug_load = 0
aug_get "/files/etc/sysconfig/network/HOSTNAME" = "localhost.localdomain"
aug_close = 0
umount_all = 0
list_partitions = [""]
available "lvm2" = 0
lvs = [""]
 = ["/dev/vda"]
inspect_get_mountpoints "/dev/vda" = ["/", "/dev/vda", "/mnt", "/dev/xvdb", "/data", "/dev/xvdc"]
mount_options "" "/dev/vda" "/" = 0
mount_options "" "/dev/xvdb" "/mnt" = -1 (error)
libguestfs: error: mount_options: mount_options_stub: /dev/xvdb: No such file or directory
umount_all = 0
sync = 0
kill_subprocess = 0

Expected results:

Image gets mounted.

--- Additional comment from rjones on 2011-01-10 16:52:43 EST ---

This appears to be a bug between the inspection code
and guestfish.  The inspection code is returning the
bogus mountpoints, and guestfish is trying to mount
them and failing.

Bug also exists in RHEL 6.1, so cloning.

Comment 2 Richard W.M. Jones 2011-01-11 10:56:40 UTC
For a test case, see:
https://bugzilla.redhat.com/show_bug.cgi?id=668574#c2

Comment 3 Richard W.M. Jones 2011-01-11 11:30:26 UTC
http://brewweb.devel.redhat.com/brew/taskinfo?taskID=3022693

Comment 5 Yufang Zhang 2011-02-15 07:04:30 UTC
QA verified this bug with libguestfs-1.7.17-12.el6.x86_64 and
guestfish-1.7.17-12.el6.x86_64:

Using the image file from https://bugzilla.redhat.com/show_bug.cgi?id=668574#c2:

# guestfish -a bogus.img -i --ro 
libguestfs: error: mount_ro: mount_ro_stub: /dev/sdb3: No such file or directory
libguestfs: error: mount_ro: /dev/VG/LV1 on /nosuchfile: mount: mount point /sysroot/nosuchfile does not exist
guestfish: some filesystems could not be mounted (ignored)

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

Operating system: Fedora release 14 (Phony)
/dev/VG/Root mounted on /
/dev/vda1 mounted on /boot
/dev/VG/LV1 mounted on /nosuchfile
/dev/sdb3 mounted on /var

><fs>

So change this bug to VERIFIED.

Comment 9 Laura Bailey 2011-04-20 05:11:17 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When a device in /etc/fstab did not exist, the "guestfish -i" command failed with a "No such file or directory" error. In the event of missing devices, guestfish now completes, and reports that some file systems could not be mounted.

Note that this bug was reported and corrected during development. It was not seen in production systems in the field.

Comment 10 Richard W.M. Jones 2011-04-20 07:50:51 UTC
This is fine, thanks.

Comment 11 errata-xmlrpc 2011-05-19 11:46:00 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0586.html

Comment 12 errata-xmlrpc 2011-05-19 13:10:51 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0586.html