Bug 2184755

Summary: Incorrect boot_id when --add-opts is used (upgrades/rollback)
Product: Red Hat Enterprise Linux 9 Reporter: Bryn M. Reeves <bmr>
Component: boom-bootAssignee: LVM Team <lvm-team>
Status: VERIFIED --- QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.2CC: agk, bmr, cmarthal, dkeefe, jbrassow, mcsontos
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: boom-boot-1.5.1-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2184757 (view as bug list) Environment:
Last Closed: 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 Bryn M. Reeves 2023-04-05 15:56:09 UTC
Description of problem:
The version of boom packages in RHEL8/9 contains a bug in the handling of additional kernel command line options specified with --add-opts. This causes the boot_id of affected boot entries to change unexpectedly preventing boom from removing them with the "boom delete" command.

Version-Release number of selected component (if applicable):
boom-boot-1.4-4.el9.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create a boot entry with multiple options specified with --add-opts:
[root@localhost ~]# boom create --title "AddOpts Test" --root-lv rhel/root --add-opts "a b c"
Created entry with boot_id 52eaf73:
  title AddOpts Test
  machine-id d7762ea419aa482a865812c7fca37883
  version 5.14.0-162.6.1.el9_1.x86_64
  linux /vmlinuz-5.14.0-162.6.1.el9_1.x86_64
  initrd /initramfs-5.14.0-162.6.1.el9_1.x86_64.img
  options root=/dev/rhel/root ro rd.lvm.lv=rhel/root a b c
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel


2. Inspect the boot_id reported by "boom list"
[root@localhost ~]# boom list
BootID  Version                     Name                     RootDevice           
0add455 5.14.0-162.6.1.el9_1.x86_64 Red Hat Enterprise Linux /dev/rhel/root 

3. Attempt to delete the entry via either reported boot_id:
[root@localhost ~]# boom delete 52eaf73
No matching entry found.
[root@localhost ~]# boom delete 
# boom delete 0add455
Cannot delete read-only boot entry: /boot/loader/entries/d7762ea419aa482a865812c7fca37883-52eaf73-5.14.0-162.6.1.el9_1.x86_64.conf

Actual results:
The entry boot_id reported when the entry is created does not match the value reported when the entry is read back in from disk and it is not possible to delete the entry with "boom delete".

Expected results:
The boot_id remains consistent and the entry can be removed with "boom delete".

Additional info:
Users can work around this problem my manually removing the problem boot entry from /boot/loader/entries with the rm command:

[root@localhost ~]# rm -f /boot/loader/entries/d7762ea419aa482a865812c7fca37883-52eaf73-5.14.0-162.6.1.el9_1.x86_64.conf

Comment 1 Bryn M. Reeves 2023-04-05 15:57:04 UTC
Fixed upstream in commit 0bf009c:

commit 0bf009c9be1e679b49743897e589da901618d74f
Author: Bryn M. Reeves <bmr>
Date:   Wed Apr 5 14:44:19 2023 +0100

    Fix comparisons in BootParams.from_entry().is_add()
    
    The comparison of a parsed option against the OsProfile template
    and expanded boot loader variables incorrectly uses a substring
    comparison rather than splitting the string on white space and
    testing for list membership.
    
    Fix this and add a regression test to command_tests.py.
    
    Resolves: #13
    
    Signed-off-by: Bryn M. Reeves <bmr>

Comment 7 Corey Marthaler 2023-06-28 19:28:11 UTC
Marking Verified:Tested in the latest rpms.

boom-boot-1.5.1-1.el9    BUILT: Wed May 17 03:00:49 PM CEST 2023

Check 8. Verify the correct boot_id when --add-opts is used (bug 2184755)
boom create --title "AddOpts Test" --root-lv /dev/snapper/boom_snap --add-opts "optional tags ABC"
Created entry with boot_id d90372c:
  title AddOpts Test
  machine-id 7b2d82dad70f4ece8f867b6a482308de
  version 5.14.0-322.el9.x86_64
  linux /vmlinuz-5.14.0-322.el9.x86_64
  initrd /initramfs-5.14.0-322.el9.x86_64.img
  options root=/dev/snapper/boom_snap ro rd.lvm.lv=snapper/boom_snap crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel_grant--01-swap rd.lvm.lv=rhel_grant-01/swap rhgb quiet optional tags ABC
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel
boom delete d90372c