Bug 2184757

Summary: Incorrect boot_id when --add-opts is used (upgrades/rollback)
Product: Red Hat Enterprise Linux 8 Reporter: Bryn M. Reeves <bmr>
Component: boom-bootAssignee: LVM and device-mapper development team <lvm-team>
Status: CLOSED WONTFIX QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: agk, bmr, cluster-qe, jbrassow, lvm-team, mcsontos
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2184755 Environment:
Last Closed: 2023-07-19 17:33:06 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 Bryn M. Reeves 2023-04-05 16:00:05 UTC
+++ This bug was initially created as a clone of Bug #2184755 +++

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.3-2.el8.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

--- Additional comment from Bryn M. Reeves on 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>