Bug 1582236 - augeas cannot parse invalid grub.conf that grub silently accepts
Summary: augeas cannot parse invalid grub.conf that grub silently accepts
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: augeas
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: YongkuiGuo
URL:
Whiteboard:
: 1618916 (view as bug list)
Depends On:
Blocks: 1651787
TreeView+ depends on / blocked
 
Reported: 2018-05-24 15:40 UTC by Anitha Udgiri
Modified: 2019-08-06 12:02 UTC (History)
3 users (show)

Fixed In Version: augeas-1.4.0-7.el7
Doc Type: If docs needed, set a value
Doc Text:
Augeas handles better invalid Grub 1 configuration files Previously, Augeas was not able to parse Grub 1 configuration files with unknown keys, or with known keys in not allowed sections of the file. This sometime caused problems in software tools that use Augeas, such as the *virt-v2v* utility or the *Puppet* management tool. With this update, the Grub lens of Augeas handles invalid keys as #error nodes, allowing to parse, and manipulate the rest of the file as expected.
Clone Of:
: 1649262 (view as bug list)
Environment:
Last Closed: 2019-08-06 12:02:32 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github hercules-team augeas pull 562 'None' closed Grub: tolerate some invalid entries 2020-02-13 19:05:03 UTC
Red Hat Bugzilla 1649262 None None None 2019-12-02 05:57:48 UTC
Red Hat Product Errata RHBA-2019:2019 None None None 2019-08-06 12:02:37 UTC

Internal Links: 1649262

Description Anitha Udgiri 2018-05-24 15:40:57 UTC
Description of problem:
Customer is unable to convert a Vmware VM into a RHV VM.

The following errors are noticed in virt-v2v import log :

libguestfs: trace: v2v: aug_get = "Lenses @Grub and grub.lns could be used to load this file"
augeas failed to parse /boot/grub/grub.conf:
 error "Lenses @Grub and grub.lns could be used to load this file"
augeas failed to parse /boot/grub/menu.lst:
 error "Get did not match entire input" at line 10 char 0 in lens /usr/share/augeas/lenses/dist/grub.aug:286.14-287.43:
augeas failed to parse /etc/X11/xorg.conf:
 error "Iterated lens matched less than it should" at line 33 char 4 in lens /usr/share/augeas/lenses/dist/xorg.aug:303.10-.40:
augeas failed to parse /etc/grub.conf:
 error "Get did not match entire input" at line 10 char 0 in lens /usr/share/augeas/lenses/dist/grub.aug:286.14-287.43:

---
guestfsd: main_loop: new request, len 0x54
guestfsd: main_loop: proc 24 (aug_match) took 0.00 seconds
libguestfs: trace: v2v: aug_match = []
libguestfs: trace: v2v: aug_get "/files/boot/grub/grub.conf/default"
guestfsd: main_loop: new request, len 0x50
guestfsd: error: no matching node
guestfsd: main_loop: proc 19 (aug_get) took 0.00 seconds
libguestfs: trace: v2v: aug_get = NULL (error)
kernels offered by the bootloader in this guest (first in list is default):
virt-v2v: error: no kernels were found in the bootloader configuration.

This probably indicates that virt-v2v was unable to parse the bootloader 
configuration of this guest.
rm -rf '/var/tmp/null.yf9GuR'
libguestfs: trace: v2v: close
libguestfs: closing guestfs handle 0x23d86b0 (state 2)
libguestfs: trace: v2v: internal_autosync
---

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

augeas-1.4.0-5.el7_5.1.x86_64

Comment 5 Pino Toscano 2018-05-24 16:06:16 UTC
That's because of the
  acpi=off
line in grub.conf.  I don't see that as allowed configuration key nor command for grub1, so the quick (and most probably the most correct one) fix is just commenting the above line.

Comment 6 Anitha Udgiri 2018-05-24 17:26:32 UTC
Information from Customer about the remaining files requested :


Both requested files are symbolic links to /boot/grub/grub.conf.

# ls -l /boot/grub/menu.lst 
lrwxrwxrwx 1 root root 11 Jun  7  2012 /boot/grub/menu.lst -> ./grub.conf

# ls -l /etc/grub.conf 
lrwxrwxrwx 1 root root 22 Jun  7  2012 /etc/grub.conf -> ../boot/grub/grub.conf

Comment 7 Richard W.M. Jones 2018-05-30 12:51:16 UTC
Discussion moved to upstream mailing list:
https://www.redhat.com/archives/augeas-devel/2018-May/msg00002.html

Comment 8 Richard W.M. Jones 2018-06-05 10:30:57 UTC
https://github.com/hercules-team/augeas/pull/562

Comment 9 Pino Toscano 2018-11-13 09:27:03 UTC
Since the fix for this bug actually makes augeas able to parse invalid grub.conf files (leaving invalid lines as #error nodes), I'm retitling it to be slightly more general, so other similar cases can be mapped to this.

Comment 10 Pino Toscano 2018-11-13 09:28:43 UTC
*** Bug 1618916 has been marked as a duplicate of this bug. ***

Comment 12 YongkuiGuo 2018-11-14 03:20:02 UTC
Verified with package:
augeas-1.4.0-8.el7

Step:
1. 
# augtool
augtool> print /files/etc/grub.conf
/files/etc/grub.conf
/files/etc/grub.conf/#comment[1] = "grub.conf generated by anaconda"
/files/etc/grub.conf/#comment[2] = "Note that you do not have to rerun grub after making changes to this file"
/files/etc/grub.conf/#comment[3] = "NOTICE:  You have a /boot partition.  This means that"
/files/etc/grub.conf/#comment[4] = "all kernel and initrd paths are relative to /boot/, eg."
/files/etc/grub.conf/#comment[5] = "root (hd0,0)"
/files/etc/grub.conf/#comment[6] = "kernel /vmlinuz-version ro root=/dev/sda3"
/files/etc/grub.conf/#comment[7] = "initrd /initrd-version.img"
/files/etc/grub.conf/boot = "/dev/sda1"
/files/etc/grub.conf/#error = "acpi=off"
/files/etc/grub.conf/default = "0"
/files/etc/grub.conf/timeout = "5"
/files/etc/grub.conf/splashimage = "(hd0,0)/grub/splash.xpm.gz"
/files/etc/grub.conf/#comment[8] = "hiddenmenu"
/files/etc/grub.conf/title[1] = "_.--< luxser001 >--._  (2.6.18-238.el5)"
/files/etc/grub.conf/title[1]/root = "(hd0,0)"
/files/etc/grub.conf/title[1]/kernel = "/vmlinuz-2.6.18-238.el5"
/files/etc/grub.conf/title[1]/kernel/ro
/files/etc/grub.conf/title[1]/kernel/root = "LABEL=/"
/files/etc/grub.conf/title[1]/kernel/quiet
/files/etc/grub.conf/title[1]/kernel/nomodeset
/files/etc/grub.conf/title[1]/initrd = "/initrd-2.6.18-238.el5.img"
/files/etc/grub.conf/title[2] = "RHELS 5.6 (2.6.18-238.el5) original nach Installation"
/files/etc/grub.conf/title[2]/root = "(hd0,0)"
/files/etc/grub.conf/title[2]/kernel = "/vmlinuz-2.6.18-238.el5"
/files/etc/grub.conf/title[2]/kernel/ro
/files/etc/grub.conf/title[2]/kernel/root = "LABEL=/"
/files/etc/grub.conf/title[2]/kernel/rhgb
/files/etc/grub.conf/title[2]/kernel/quiet
/files/etc/grub.conf/title[2]/initrd = "/initrd-2.6.18-238.el5.img"

The 'acpi=off' line can be parsed as error configuration.

Comment 14 errata-xmlrpc 2019-08-06 12:02:32 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.

https://access.redhat.com/errata/RHBA-2019:2019


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