Red Hat Bugzilla – Bug 975377
inspect-get-hostname return unknown for linux guest in rhel6
Last modified: 2013-11-20 23:44:59 EST
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
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.
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.
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
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
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
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