Bug 668574 - guestfish -i is trying to mount all mounts from /etc/fstab and fails with an error when device doesn't exists
guestfish -i is trying to mount all mounts from /etc/fstab and fails with an ...
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
Unspecified Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks: 668611
  Show dependency treegraph
 
Reported: 2011-01-10 15:06 EST by Marek Goldmann
Modified: 2011-01-11 06:12 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 668611 (view as bug list)
Environment:
Last Closed: 2011-01-11 06:12:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Disk image with bogus /etc/fstab for testing (7.94 KB, application/x-bzip2)
2011-01-11 05:55 EST, Richard W.M. Jones
no flags Details

  None (edit)
Description Marek Goldmann 2011-01-10 15:06:56 EST
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.
Comment 1 Richard W.M. Jones 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 05:55:24 EST
Created attachment 472777 [details]
Disk image with bogus /etc/fstab for testing

The attached disk image may be used to test this bug.
First download and uncompress the image:

  bunzip2 bogus.img.bz2

Then run guestfish against the image:

  guestfish --ro -a bogus.img -i exit
  echo $?

In the failure case you will get an error like this:

  libguestfs: error: mount_ro: mount_ro_stub: /dev/sdb3: No such file or directory

and guestfish will exit with an error.

When the bug is fixed, guestfish will ignore bogus entries in the
fstab file, and output will instead look something like this:

  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>

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