Bug 975377

Summary: inspect-get-hostname return unknown for linux guest in rhel6
Product: Red Hat Enterprise Linux 6 Reporter: bfan
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: leiwang, rjones, wshi
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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: Environment:
Last Closed: 2013-11-21 04:44: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: 975412    
Bug Blocks:    
Attachments:
Description Flags
Test script which reproduces the problem none

Description bfan 2013-06-18 10:05:50 UTC
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):
libguestfs-1.20.8-5.el6.x86_64

How reproducible:
100%

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


Additional info:
1.It works with 1.16,regression
2.Same issue with bug 920609

Comment 3 Richard W.M. Jones 2013-06-18 11:10:23 UTC
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 11:12:54 UTC
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 11:22:11 UTC
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 12:28:18 UTC
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:
https://bugzilla.redhat.com/show_bug.cgi?id=975412

Comment 8 bfan 2013-09-17 07:30:22 UTC
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
/dev/VolGroup/lv_root
><fs> inspect-get-hostname /dev/VolGroup/lv_root
localhost.localdomain

So change the status to verified

Comment 10 errata-xmlrpc 2013-11-21 04:44:59 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/RHSA-2013-1536.html