Bug 1057510

Summary: mount-local should give a clearer error if root is not mounted
Product: Red Hat Enterprise Linux 6 Reporter: yuliu <yuliu>
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: huzhan, leiwang, lkong, mbooth, ptoscano, rjones, wshi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.20.11-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1057492 Environment:
Last Closed: 2014-10-14 06:35:06 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: 1057504    
Bug Blocks:    

Description yuliu 2014-01-24 09:18:02 UTC
+++ This bug was initially created as a clone of Bug #1057492 +++

Description of problem:
Before run "mount-local localmountpoint " you should mount filesystem to "/" first.
This prerequisites should be added to help info.

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


How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

--- Additional comment from Richard W.M. Jones on 2014-01-24 04:07:09 EST ---

If you use mount-local without mounting something on / then you get
odd errors:

$ mkdir -p /tmp/mnt
$ guestfish -x -N fs mount-local /tmp/mnt : mount-local-run
libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem
libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem

Basically what happens is that mount-local itself doesn't do the
usual "is root mounted" daemon check (because it cannot - it is not
running in the daemon).  However any later commands which are run
by mount-local do this check, and give errors.

It would be better if mount-local itself did this check and gave
a clearer error if root was not mounted.

Comment 4 Lingfei Kong 2014-05-07 05:52:01 UTC
Verified with libguestfs-1.20.11-3.el6

[root@amd-4450b-4-1 ~]# mkdir -p /tmp/mnt
[root@amd-4450b-4-1 ~]# guestfish -x -N fs mount-local /tmp/mnt : mount-local-run
libguestfs: trace: set_pgroup true
libguestfs: trace: set_pgroup = 0
libguestfs: trace: add_drive "test1.img" "format:raw"
libguestfs: trace: add_drive = 0
libguestfs: trace: is_config
libguestfs: trace: is_config = 1
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: launch = 0
libguestfs: trace: part_disk "/dev/sda" "mbr"
libguestfs: trace: part_disk = 0
libguestfs: trace: mkfs "ext2" "/dev/sda1"
libguestfs: trace: mkfs = 0
libguestfs: trace: mount_local "/tmp/mnt"
libguestfs: trace: mount_local = 0
libguestfs: trace: mount_local_run
libguestfs: trace: exists "/"
libguestfs: trace: exists = -1 (error)
libguestfs: error: you must call 'guestfs_mount' first to mount a filesystem on '/'.
Note: '/tmp/mnt' is still mounted.  Use 'fusermount -u /tmp/mnt' to clean up.
libguestfs: trace: mount_local_run = -1 (error)
libguestfs: trace: close
libguestfs: trace: internal_autosync
libguestfs: trace: internal_autosync = 0

Comment 5 errata-xmlrpc 2014-10-14 06:35:06 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.

http://rhn.redhat.com/errata/RHBA-2014-1458.html