This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 894241

Summary: aug-init fail with the newest augeas package
Product: Red Hat Enterprise Linux 7 Reporter: Mohua Li <moli>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.0CC: bfan, dcleal, enakai, leiwang, rjones, sagarun, sbaker, shardy, wshi
Target Milestone: rcKeywords: TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.20.1-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 07:56:20 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Mohua Li 2013-01-11 01:54:48 EST
Description of problem:

aug-init fail with "Augeas initialization failed", this fail occur on the 
latest augeas package augeas-1.0.0-1.el7, no problem with augeas-0.10.0-5.el7, 
on libguestfs, just simply call the aug_init api, so it's probably a augeas 
problem, 

daemon/augeas.c
                                                                         
   83                                                                                
   84   aug = aug_init (buf, NULL, flags);                                           
   85   free (buf);                                                                  
   86                                                                                
   87   if (!aug) {                                                                  
   88     reply_with_error ("Augeas initialization failed");                         
   89     return -1;                                                                 
   90   }                     



Version-Release number of selected component (if applicable):
libguestfs-1.20.1-4.el7.x86_64
augeas-1.0.0-1.el7

How reproducible:
always

Steps to Reproduce:
1.guestfish -x -v -N fs  mount /dev/sda1 / : aug-init / 1 

 
Actual results:


Expected results:


Additional info:
Comment 2 Dominic Cleal 2013-01-14 05:03:11 EST
I can reproduce this on Fedora 18 with:

libguestfs-1.20.1-2.fc18.x86_64
augeas-1.0.0-1.fc18.x86_64

It'd be really useful to call aug_init with the AUG_NO_ERR_CLOSE flag and then call aug_error* when initialisation fails.  See for instance:

https://github.com/hercules-team/augeas/blob/master/src/augtool.c#L593
https://github.com/hercules-team/augeas/blob/master/src/augtool.c#L412
Comment 3 David Lutterkort 2013-01-15 15:04:30 EST
This _might_ be caused by attempting to read files with funky filenames. To get more information about the error, pass the AUG_NO_LOAD flag to aug_init, and then issue a separate aug_load and look at the errors from that. You can also try to trigger the error by running augtool -A 'load' on the affected system.

Is there any way you could send me the /etc from the machine to help me analyze this ?
Comment 6 Mohua Li 2013-01-16 00:16:33 EST
(In reply to comment #3)
> This _might_ be caused by attempting to read files with funky filenames. To
> get more information about the error, pass the AUG_NO_LOAD flag to aug_init,
> and then issue a separate aug_load and look at the errors from that. You can
> also try to trigger the error by running augtool -A 'load' on the affected
> system.
> 
> Is there any way you could send me the /etc from the machine to help me
> analyze this ?

i didn't find a way to send you the /etc so far, as it's in the libguestfs appliance env,
Comment 7 Richard W.M. Jones 2013-01-16 06:14:42 EST
(In reply to comment #6)
> i didn't find a way to send you the /etc so far, as it's in the libguestfs
> appliance env,

Whoa wait ... you're doing aug-init on the libguestfs appliance *itself*?

Well, I guess that should work, but I'm not sure why you'd want
to ever do that.

In any case, you can extract the libguestfs appliance /etc using
libguestfs (naturally):

  cd /var/tmp/.guestfs-`id -u`
  guestfish -a root -m /dev/sda --ro tar-out /etc /tmp/etc.tar
  ls -l /tmp/etc.tar 

To extract /etc from a regular disk image, do this instead:

  virt-tar-out -d disk.img /etc /tmp/etc.tar
Comment 8 Richard W.M. Jones 2013-01-16 06:15:47 EST
(In reply to comment #7)
> To extract /etc from a regular disk image, do this instead:

Correction:

  virt-tar-out -a disk.img /etc /tmp/etc.tar
Comment 9 Mohua Li 2013-01-16 06:44:00 EST
(In reply to comment #7)
> (In reply to comment #6)
> > i didn't find a way to send you the /etc so far, as it's in the libguestfs
> > appliance env,
> 
> Whoa wait ... you're doing aug-init on the libguestfs appliance *itself*?
> 
> Well, I guess that should work, but I'm not sure why you'd want
> to ever do that.

no, not the appliance itself, but aug-init on a disk image which add with "-a"
to guestfish  

> 
> In any case, you can extract the libguestfs appliance /etc using
> libguestfs (naturally):
> 
>   cd /var/tmp/.guestfs-`id -u`
>   guestfish -a root -m /dev/sda --ro tar-out /etc /tmp/etc.tar
>   ls -l /tmp/etc.tar 
> 
> To extract /etc from a regular disk image, do this instead:
> 
>   virt-tar-out -d disk.img /etc /tmp/etc.tar


yup, just forgot i could hack the appliance disk image, thanks for remind
Comment 10 Richard W.M. Jones 2013-01-18 04:53:57 EST
*** Bug 901439 has been marked as a duplicate of this bug. ***
Comment 11 Dominic Cleal 2013-01-18 05:44:44 EST
The issue is the hostfiles list to build the contents of the libguestfs appliance is out of date with respect to the contents of the augeas packages.

By adding augtool into the appliance and running it, I was able to get the detailed error messages.  A number of modules were added in Augeas 1.0.0, two of which (Quote and Simplevars) are new dependencies for existing modules.

><rescue> augtool 
Failed to initialize Augeas
error: Syntax error in lens definition
/usr/share/augeas/lenses/dist/dhcpd.aug:95.14-.28:Could not load module Quote for Quote.do_quote
/usr/share/augeas/lenses/dist/dhcpd.aug:95.14-.28:Undefined variable Quote.do_quote

><rescue> augtool
Failed to initialize Augeas
error: Syntax error in lens definition
/usr/share/augeas/lenses/dist/sysctl.aug:36.34-.50:Could not load module Simplevars for Simplevars.entry
/usr/share/augeas/lenses/dist/sysctl.aug:36.34-.50:Undefined variable Simplevars.entry

Adding these to the supermin hostfiles (/usr/lib64/guestfs/supermin.d/hostfiles) resolved the issue:

/usr/share/augeas/lenses/dist/quote.aug
/usr/share/augeas/lenses/dist/simplevars.aug

I guess rebuilding libguestfs would resolve the issue, as it'd pick up the new package list from Augeas 1.0.0.  It seems though that either the dependency between the built libguestfs RPM and the packages it's pulling into the appliance should be tighter, or the hostfiles list made more dynamic.
Comment 12 Richard W.M. Jones 2013-01-18 05:56:07 EST
I see, not good.

Let's go for the rebuild option (Fedora 18 and RHEL 7 should
cover it).
Comment 13 Richard W.M. Jones 2013-01-18 08:05:53 EST
For Fedora 18: libguestfs-1.20.1-3.fc18 is building here:
http://koji.fedoraproject.org/koji/taskinfo?taskID=4880583

Can't build on RHEL 7 at the moment because qemu is broken
(bug 901542).
Comment 14 Richard W.M. Jones 2013-01-18 10:11:16 EST
Sorry I don't have a separate bug for the Fedora 18 issue,
but please try this package and mod it up if it works for you:

https://admin.fedoraproject.org/updates/libguestfs-1.20.1-3.fc18
Comment 15 Richard W.M. Jones 2013-01-18 10:15:50 EST
$ egrep 'augeas.*(quote|simplevars)' /usr/lib64/guestfs/supermin.d/hostfiles 
/usr/share/augeas/lenses/dist/quote.aug
/usr/share/augeas/lenses/dist/simplevars.aug
/usr/share/augeas/lenses/dist/tests/test_quote.aug
/usr/share/augeas/lenses/dist/tests/test_simplevars.aug
Comment 16 Richard W.M. Jones 2013-01-19 07:15:39 EST
https://brewweb.devel.redhat.com/taskinfo?taskID=5292752
Comment 17 Steve Baker 2013-01-20 15:50:34 EST
Fedora 17 is also affected by this
Comment 18 Richard W.M. Jones 2013-01-21 02:32:43 EST
I've kicked off an F17 rebuild:
http://koji.fedoraproject.org/koji/taskinfo?taskID=4888499
Comment 19 David Lutterkort 2013-01-23 13:42:08 EST
I just added a --trace option to augparse (commit 85db83cd) so that it will print which modules are loaded - hopefully that will be useful in generating hostfiles.
Comment 20 Arun S A G 2013-01-24 08:58:04 EST
Fedora 17 build worked for me, Thanks!
Comment 21 Arun S A G 2013-01-31 07:04:21 EST
The problem now happens in RHEL5

$ rpm -q augeas
augeas-1.0.0-1.el5

$ rpm -q python-augeas
python-augeas-0.4.1-1.el5

$ rpm -q libguestfs
libguestfs-1.19.37-4.el5
Comment 22 Richard W.M. Jones 2013-01-31 07:12:40 EST
(In reply to comment #21)
> The problem now happens in RHEL5
> 
> $ rpm -q augeas
> augeas-1.0.0-1.el5
> 
> $ rpm -q python-augeas
> python-augeas-0.4.1-1.el5
> 
> $ rpm -q libguestfs
> libguestfs-1.19.37-4.el5

You mean EPEL 5?  Please file a separate bug about it.
Comment 23 Arun S A G 2013-01-31 08:58:19 EST
(In reply to comment #22)

> You mean EPEL 5?  Please file a separate bug about it.

Done https://bugzilla.redhat.com/show_bug.cgi?id=906361 Thanks!
Comment 27 Wei Shi 2013-06-13 04:59:23 EDT
Verified:
 libguestfs-1.22.2-1.el7.x86_64
 augeas-1.0.0-2.el7.x86_64

 # guestfish -N fs  mount /dev/sda1 / : aug-init / 1

No error feedback.
Comment 28 Ludek Smid 2014-06-13 07:56:20 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.