Bug 975377 - inspect-get-hostname return unknown for linux guest in rhel6
inspect-get-hostname return unknown for linux guest in rhel6
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
: Regression
Depends On: 975412
  Show dependency treegraph
Reported: 2013-06-18 06:05 EDT by bfan
Modified: 2013-11-20 23:44 EST (History)
3 users (show)

See Also:
Fixed In Version: libguestfs-1.20.9-5.el6
Doc Type: Bug Fix
Doc Text:
(This was a bug in Augeas, not libguestfs)
Story Points: ---
Clone Of:
Last Closed: 2013-11-20 23:44:59 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test script which reproduces the problem (824 bytes, text/plain)
2013-06-18 07:10 EDT, Richard W.M. Jones
no flags Details

  None (edit)
Description bfan 2013-06-18 06:05:50 EDT
Description of problem:
inspect-get-hostname return unknown for all linux guest in rhel6, but function correctly with windows guest

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

How reproducible:

Steps to Reproduce:
# guestfish -a RHEL-Server-6.4-64-hvm.raw
><fs> run
><fs> inspect-os
><fs> inspect-get-hostname /dev/VolGroup/lv_root

Additional info:
1.It works with 1.16,regression
2.Same issue with bug 920609
Comment 3 Richard W.M. Jones 2013-06-18 07:10:23 EDT
Created attachment 762465 [details]
Test script which reproduces the problem

Note that 920609 has been fixed in the rebased Augeas package in RHEL 6.5
(but not the package in RHEL 7 apparently).

I can reproduce the problem using the attached script but I don't
yet understand why it happens.
Comment 4 Richard W.M. Jones 2013-06-18 07:12:54 EDT
FYI on RHEL 6 host, RHEL 6 guest, the test script dies with:

could not get hostname (error = 'aug_get: no matching node at /tmp/bz975377.pl line 27.
') at /tmp/bz975377.pl line 29.
Comment 5 Richard W.M. Jones 2013-06-18 07:22:11 EDT
Playing around with augtool (in virt-rescue) seems to
show this is an Augeas problem.

(1) Run the 'rm' expression:

><rescue> augtool -r /sysroot -L
augtool> rm '/augeas/load//incl[. != "/etc/sysconfig/network"]'
rm : /augeas/load//incl[. != "/etc/sysconfig/network"] 297    <---#a
augtool> rm '/augeas/load//incl[. != "/etc/sysconfig/network"]'
rm : /augeas/load//incl[. != "/etc/sysconfig/network"] 0      <---#b

At #a 297 rules are deleted.  When repeated, no more rules are deleted.

(2) Repeat augtool, this time deleting a non-existent file:

><rescue> augtool -r /sysroot -L
augtool> rm '/augeas/load//incl[. != "/etc/foobar"]'
rm : /augeas/load//incl[. != "/etc/foobar"] 297      <---#c
augtool> rm '/augeas/load//incl[. != "/etc/foobar"]'
rm : /augeas/load//incl[. != "/etc/foobar"] 0        <---#d

Note that #c and #d match #a and #b.

(3) Repeat augtool, this time deleting a file which we know exists:

><rescue> augtool -r /sysroot -L
augtool> rm '/augeas/load//incl[. != "/etc/passwd"]'
rm : /augeas/load//incl[. != "/etc/passwd"] 296    <---#e
augtool> rm '/augeas/load//incl[. != "/etc/passwd"]'
rm : /augeas/load//incl[. != "/etc/passwd"] 0      <---#f

Note that 1 less rule is deleted in #e compared to #a or #c.

(4) Note that the file exists and is readable:

><rescue> ls -l /sysroot/etc/sysconfig/network
-rw-r--r--. 1 root root 55 Jul 13  2011 /sysroot/etc/sysconfig/network
Comment 6 Richard W.M. Jones 2013-06-18 08:28:18 EDT
Set component back to libguestfs since that's where we will
have to make the change.

This is actually an incompatible ABI change in Augeas however.

Upstream bug report:
Comment 8 bfan 2013-09-17 03:30:22 EDT
Verified with libguestfs-1.20.11-1.el6.x86_64

# guestfish -a RHEL-Server-6.4-64-hvm.raw

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

><fs> run
><fs> inspect-os
><fs> inspect-get-hostname /dev/VolGroup/lv_root

So change the status to verified
Comment 10 errata-xmlrpc 2013-11-20 23:44:59 EST
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.


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