Bug 1484261 - Grub lens does not parse menu.lst with boot key
Summary: Grub lens does not parse menu.lst with boot key
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: augeas
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: TRACKER-bugs-affecting-libguestfs
TreeView+ depends on / blocked
 
Reported: 2017-08-23 07:03 UTC by Jaroslav Spanko
Modified: 2018-04-10 09:56 UTC (History)
3 users (show)

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.
Clone Of:
Environment:
Last Closed: 2018-04-10 09:55:26 UTC
Target Upstream Version:


Attachments (Terms of Use)
v2v debug (deleted)
2017-08-23 07:03 UTC, Jaroslav Spanko
no flags Details
v2v debug (4.66 MB, text/plain)
2017-08-23 07:04 UTC, Jaroslav Spanko
no flags Details
grub.conf (1.75 KB, text/plain)
2017-08-23 07:04 UTC, Jaroslav Spanko
no flags Details


Links
System ID Priority Status Summary Last Updated
Github hercules-team augeas pull 494 None closed Grub: handle top-level "boot" directive 2020-02-13 00:37:20 UTC
Red Hat Product Errata RHBA-2018:0684 None None None 2018-04-10 09:56:37 UTC

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


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