Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2159282

Summary: augeas fails to parse /etc/kernel/cmdline if there is a space at the end of the line
Product: Red Hat Enterprise Linux 9 Reporter: YongkuiGuo <yoguo>
Component: augeasAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 9.2CC: jmaloy, lersek, qzhang, rjones, ymao
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: augeas-1.13.0-5.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:25:08 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:

Description YongkuiGuo 2023-01-09 10:01:12 UTC
Description of problem:
According to our recent nightly compose test results, augeas fails to parse the /etc/kernel/cmdline file if there is a space at the end of the line.

$ cat /etc/kernel/cmdline
root=/dev/mapper/rhel_hp--dl385g8--02-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel_hp--dl385g8--02-swap rd.lvm.lv=rhel_hp-dl385g8-02/root rd.lvm.lv=rhel_hp-dl385g8-02/swap console=ttyS1,115200n81

$ hexdump -C /etc/kernel/cmdline
00000000  72 6f 6f 74 3d 2f 64 65  76 2f 6d 61 70 70 65 72  |root=/dev/mapper|
00000010  2f 72 68 65 6c 5f 68 70  2d 2d 64 6c 33 38 35 67  |/rhel_hp--dl385g|
00000020  38 2d 2d 30 32 2d 72 6f  6f 74 20 72 6f 20 63 72  |8--02-root ro cr|
00000030  61 73 68 6b 65 72 6e 65  6c 3d 31 47 2d 34 47 3a  |ashkernel=1G-4G:|
00000040  31 39 32 4d 2c 34 47 2d  36 34 47 3a 32 35 36 4d  |192M,4G-64G:256M|
00000050  2c 36 34 47 2d 3a 35 31  32 4d 20 72 65 73 75 6d  |,64G-:512M resum|
00000060  65 3d 2f 64 65 76 2f 6d  61 70 70 65 72 2f 72 68  |e=/dev/mapper/rh|
00000070  65 6c 5f 68 70 2d 2d 64  6c 33 38 35 67 38 2d 2d  |el_hp--dl385g8--|
00000080  30 32 2d 73 77 61 70 20  72 64 2e 6c 76 6d 2e 6c  |02-swap rd.lvm.l|
00000090  76 3d 72 68 65 6c 5f 68  70 2d 64 6c 33 38 35 67  |v=rhel_hp-dl385g|
000000a0  38 2d 30 32 2f 72 6f 6f  74 20 72 64 2e 6c 76 6d  |8-02/root rd.lvm|
000000b0  2e 6c 76 3d 72 68 65 6c  5f 68 70 2d 64 6c 33 38  |.lv=rhel_hp-dl38|
000000c0  35 67 38 2d 30 32 2f 73  77 61 70 20 63 6f 6e 73  |5g8-02/swap cons|
000000d0  6f 6c 65 3d 74 74 79 53  31 2c 31 31 35 32 30 30  |ole=ttyS1,115200|
000000e0  6e 38 31 20 0a                                    |n81 .|
000000e5

$ augtool print /augeas//error | grep cmdline
/augeas/files/etc/kernel/cmdline/error = "parse_failed"
/augeas/files/etc/kernel/cmdline/error/pos = "227"
/augeas/files/etc/kernel/cmdline/error/line = "1"
/augeas/files/etc/kernel/cmdline/error/char = "227"
/augeas/files/etc/kernel/cmdline/error/lens = "/usr/share/augeas/lenses/dist/cmdline.aug:16.10-.58:"
/augeas/files/etc/kernel/cmdline/error/message = "Get did not match entire input"


After deleting the space, augeas works well.

$ augtool print /files/etc/kernel/cmdline
/files/etc/kernel/cmdline
/files/etc/kernel/cmdline/root = "/dev/mapper/rhel_hp--dl385g8--02-root"
/files/etc/kernel/cmdline/ro
/files/etc/kernel/cmdline/crashkernel = "1G-4G:192M,4G-64G:256M,64G-:512M"
/files/etc/kernel/cmdline/resume = "/dev/mapper/rhel_hp--dl385g8--02-swap"
/files/etc/kernel/cmdline/rd.lvm.lv[1] = "rhel_hp-dl385g8-02/root"
/files/etc/kernel/cmdline/rd.lvm.lv[2] = "rhel_hp-dl385g8-02/swap"
/files/etc/kernel/cmdline/console = "ttyS1,115200n81"


Version-Release number of selected component (if applicable):
augeas-1.13.0-3.el9.x86_64


How reproducible:
100%


Steps:

On rhel9.2 host
1. 
2.

Actual results:
As above

Expected results:
augeas can parse the /etc/kernel/cmdline file successfully.


Additional info:

Comment 1 Richard W.M. Jones 2023-01-09 10:34:09 UTC
Can reproduce this upstream:

$ cd /var/tmp
$ mkdir -p root/etc/kernel
$ echo 'debug ' > root/etc/kernel/cmdline
$ augtool -r /var/tmp/root
augtool> print /files/etc/kernel/cmdline
augtool> print /augeas//error
/augeas/files/etc/kernel/cmdline/error = "parse_failed"
/augeas/files/etc/kernel/cmdline/error/pos = "5"
/augeas/files/etc/kernel/cmdline/error/line = "1"
/augeas/files/etc/kernel/cmdline/error/char = "5"
/augeas/files/etc/kernel/cmdline/error/lens = "/usr/share/augeas/lenses/dist/cmdline.aug:16.10-.58:"
/augeas/files/etc/kernel/cmdline/error/message = "Get did not match entire input"

Comment 2 Richard W.M. Jones 2023-01-09 10:48:53 UTC
https://github.com/hercules-team/augeas/pull/798

Comment 3 Richard W.M. Jones 2023-03-05 10:39:35 UTC
Finally upstream in:
https://github.com/hercules-team/augeas/commit/801aa73db3c356378467622a7e02dea21ccf4332

Comment 4 YongkuiGuo 2023-04-06 02:38:06 UTC
Tested with the package:
augeas-1.13.0-5.el9.x86_64

Steps:

1. On rhel9.3 host
$ cd /var/tmp
$ mkdir -p root/etc/kernel
$ echo 'debug ' > root/etc/kernel/cmdline
$ augtool -r /var/tmp/root
augtool> print /files/etc/kernel/cmdline
/files/etc/kernel/cmdline
/files/etc/kernel/cmdline/debug

Augeas can successfully parse the /etc/kernel/cmdline file.

Comment 8 YongkuiGuo 2023-04-23 01:51:44 UTC
Verified this bug since the test case for this bug has been automated and passed in the latest nightly compose test.

Comment 10 errata-xmlrpc 2023-11-07 08:25:08 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 (augeas bug fix and enhancement update), 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-2023:6344