Bug 1057504

Summary: mount-local should give a clearer error if root is not mounted
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, mbooth, ptoscano, yuliu
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1057492 Environment:
Last Closed: 2014-02-05 16:51:59 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:    
Bug Blocks: 1057492, 1057510    

Description Richard W.M. Jones 2014-01-24 09:08:11 UTC
+++ This bug was initially created as a clone of Bug #1057492 +++

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 1 Richard W.M. Jones 2014-01-24 10:23:47 UTC
I've posted a simple patch which tests if root is mounted:

$ guestfish -N fs mount-local /tmp/mnt : mount-local-run
libguestfs: error: exists: exists_stub: you must call 'mount' first to mount the root filesystem

https://www.redhat.com/archives/libguestfs/2014-January/msg00225.html

Comment 2 Richard W.M. Jones 2014-02-05 16:51:59 UTC
Fixed upstream in git commit 0e2489974b91e4728d544fe2aa08c2a1c9deb365.