Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1484261

Summary: Grub lens does not parse menu.lst with boot key
Product: Red Hat Enterprise Linux 7 Reporter: Jaroslav Spanko <jspanko>
Component: augeasAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: jspanko, xchen, yoguo
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: augeas-1.4.0-5.el7 Doc Type: Bug Fix
Doc Text:
Prior to this update, Augeas was not able to parse the boot key in in the GRUB 1 configuration (/boot/grub/menu.lst). The grub lens of Augeas has been fixed to parse also the boot key. As a result, Augeas now reads /boot/grub/menu.lst also with boot keys.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 09:55:26 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:    
Bug Blocks: 910269    
Attachments:
Description Flags
v2v debug
none
v2v debug
none
grub.conf none

Description Jaroslav Spanko 2017-08-23 07:03:09 UTC
Description of problem:
augeas is not able to parse the boot line in menu.lst/grub.conf which cause that v2v is not able to convert guest

Version-Release number of selected component (if applicable):
augeas-libs-1.4.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare the RHEL 6.x or Centos 6.x with enable boot line 
2. v2v fails 


Actual results:
libguestfs: trace: v2v: aug_get "/files/boot/grub/menu.lst/default"
guestfsd: main_loop: proc 24 (aug_match) took 0.00 seconds
guestfsd: main_loop: new request, len 0x50
guestfsd: error: no matching node
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.

Expected results:
augeas should ignore the line which cannot parse or handle the boot line

Additional info:
In the attachment the grub config and the v2v debug log

Comment 2 Jaroslav Spanko 2017-08-23 07:04:05 UTC
Created attachment 1316963 [details]
v2v debug

Comment 3 Jaroslav Spanko 2017-08-23 07:04:44 UTC
Created attachment 1316964 [details]
grub.conf

Comment 4 YongkuiGuo 2017-08-25 10:15:31 UTC
I can reproduce this bug with packages:
augeas-libs-1.4.0-2.el7.x86_64
augeas-1.4.0-2.el7.x86_64

Steps:

1.Enable boot line in /boot/grub/menu.lst file on rhel6.9 host.
...
boot=/dev/xxx
...

2.#augtool
augtool> print /files/boot/grub/menu.lst
augtool>
augtool> print /augeas//error
...
/augeas/files/boot/grub/menu.lst/error = "parse_failed"
/augeas/files/boot/grub/menu.lst/error/pos = "379"
/augeas/files/boot/grub/menu.lst/error/line = "9"
/augeas/files/boot/grub/menu.lst/error/char = "0"
/augeas/files/boot/grub/menu.lst/error/lens = "/usr/share/augeas/lenses/dist/grub.aug:285.14-286.43:"
/augeas/files/boot/grub/menu.lst/error/message = "Get did not match entire input"
...

Comment 5 Pino Toscano 2017-08-25 11:02:31 UTC
Just one note: "boot" is not a recognized key in the menu.lst file (only in the grub1 CLI).  Most probably grub1 ignores unknown directives in the configuration file.

Comment 6 Pino Toscano 2017-09-11 19:03:46 UTC
Other than the unrecognized boot=device entry, apparently the Grub lens does not seem to handle the empty line (line 18 in attachment 1316964 [details]), still giving a parse error because of it.

Comment 7 Pino Toscano 2017-09-21 16:32:10 UTC
Actually, the problem looks like the provided grub.lst has DOS-style end of line (so \r\n).  Jaroslav, is this the original file from the guest, or was it manually copied&pasted from somewhere (e.g. a screen output)?

Comment 8 Pino Toscano 2017-10-04 11:24:06 UTC
OK, with Jaroslav we checked the grub configuration should be properly saved in the guest, so only the boot key is the issue.

Comment 10 YongkuiGuo 2017-10-09 03:30:35 UTC
Verified with package:
augeas-1.4.0-5.el7.x86_64

Steps:

1.Enable boot line in /boot/grub/menu.lst file on rhel6.9 host.
...
boot=/dev/xvda
...

2.#augtool print /files/boot/grub/menu.lst
-------------------------------------------------
/files/boot/grub/menu.lst
/files/boot/grub/menu.lst/#comment[1] = "grub.conf generated by anaconda"
/files/boot/grub/menu.lst/#comment[2] = "Note that you do not have to rerun grub after making changes to this file"
/files/boot/grub/menu.lst/#comment[3] = "NOTICE:  You have a /boot partition.  This means that"
/files/boot/grub/menu.lst/#comment[4] = "all kernel and initrd paths are relative to /boot/, eg."
/files/boot/grub/menu.lst/#comment[5] = "root (hd0,0)"
/files/boot/grub/menu.lst/#comment[6] = "kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root"
/files/boot/grub/menu.lst/#comment[7] = "initrd /initrd-[generic-]version.img"
/files/boot/grub/menu.lst/boot = "/dev/xvda"
...

-------------------------------------------------

Grub lens can parse menu.lst normally. So verified this bug.

Comment 13 errata-xmlrpc 2018-04-10 09:55:26 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-2018:0684