Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-36691

boom: fix cache reference counting bug

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Normal Normal
    • rhel-9.5
    • rhel-9.2.0, rhel-9.3.0, rhel-9.4
    • boom-boot
    • None
    • rhel-sst-logical-storage
    • ssg_filesystems_storage_and_HA
    • 2
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • All
    • None

      What were you trying to do that didn't work?

      Modifying boom boot entries that use the boom create --backup option directly can cause a situation where the backup boot images used by the entries are incorrectly deleted.
       
      This causes the boot_id for the entry to change, which causes boom to treat it as a foreign (read-only) entry. This triggers a bug in boom-1.6.0 and earlier that incorrectly reference counts the cached images, causing them to have a reference count of zero and triggering automatic cleanup:

      [root@localhost ~]# boom list -VV --debug=all
      DEBUG - reading boom configuration from '/boot/boom/boom.conf'
      DEBUG - Found global.boot_path
      DEBUG - Found global.boom_path
      DEBUG - Found legacy.enable
      DEBUG - Found legacy.sync
      ...
      BootID  Version                      Name                     RootDevice                             Options                                                                                                                                                                                                  MachineID 
      1e1a9b4 4.18.0-513.5.1.el8_9.x86_64  Red Hat Enterprise Linux /dev/mapper/rhel-root                  root=/dev/mapper/rhel-root ro resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet $tuned_params crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M                                 b1609d18cd
      4ea37b9 4.18.0-513.24.1.el8_9.x86_64 Red Hat Enterprise Linux /dev/mapper/rhel-root                  root=/dev/mapper/rhel-root ro resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet $tuned_params crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M                                 b1609d18cd
      e22dd61 5.14.0-362.24.1.el9_3.x86_64 Red Hat Enterprise Linux /dev/mapper/rhel-root                  root=/dev/mapper/rhel-root ro resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet rd.plymouth=0 plymouth.enable=0 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M $tuned_params b1609d18cd
      6e810cc 4.18.0-513.24.1.el8_9.x86_64 Red Hat Enterprise Linux /dev/rhel/root_snapshot_before_changes root=/dev/rhel/root_snapshot_before_changes ro rd.lvm.lv=rhel/root_snapshot_before_changes crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M                                                                  b1609d18cd
      f886037 5.14.0-362.24.1.el9_3.x86_64 Red Hat Enterprise Linux /dev/rhel/root                         root=/dev/rhel/root ro rd.lvm.lv=rhel/root resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/swap rhgb quiet rd.plymouth=0 plymouth.enable=0                                                                   
      DEBUG - Loading cache entries from '/boot/boom/cache/cacheindex.json'
      DEBUG - Loaded 2 cache paths and 2 images
      DEBUG - Finding cache entries for Selection()
      DEBUG - Found 2 cached paths
      DEBUG - Finding entries for Selection(path='/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0')
      DEBUG - Found 1 entries
      DEBUG - Finding entries for Selection(path='/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0')
      DEBUG - Found 1 entries
      DEBUG - Finding entries for Selection(path='/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0')
      DEBUG - Found 1 entries
      DEBUG - Finding entries for Selection(path='/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0')
      DEBUG - Found 1 entries
      INFO - Removed 2 unused cache entries
      

      The boot images used by the snapshot boot entry have now been deleted:

      [root@localhost ~]# boom show f886037
      Boot Entry (boot_id=f886037)
        title Test
        machine-id b1609d18cd704009b4e3f4142ec64eba
        version 5.14.0-362.24.1.el9_3.x86_64
        linux /vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0
        initrd /initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0
        options root=/dev/rhel/root ro rd.lvm.lv=rhel/root resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/swap rhgb quiet rd.plymouth=0 plymouth.enable=0
        grub_users $grub_users
        grub_arg --unrestricted
        grub_class kernel
      [root@localhost ~]# ls /boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0 /boot/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0
      ls: cannot access '/boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0': No such file or directory
      ls: cannot access '/boot/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0': No such file or directory
      

      Please provide the package NVR for which bug is seen:

      boom-boot-1.6.0-2.el8.noarch

      How reproducible:

      100%

      Steps to reproduce

      1.  create a boot entry using boom create --backup:

      [root@localhost ~]# boom create --backup --title "Test" --root-lv rhel/root
      Created entry with boot_id c6c28de:
        title Test
        machine-id b1609d18cd704009b4e3f4142ec64eba
        version 5.14.0-362.24.1.el9_3.x86_64
        linux /vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0
        initrd /initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0
        options root=/dev/rhel/root ro rd.lvm.lv=rhel/root resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/swap rhgb quiet rd.plymouth=0 plymouth.enable=0 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M
        grub_users $grub_users
        grub_arg --unrestricted
        grub_class kernel
      

      2. Modify the boot entry e.g. removing the crashkernel= parameter:

      [root@localhost ~]# cat /boot/loader/entries/b1609d18cd704009b4e3f4142ec64eba-c6c28de-5.14.0-362.24.1.el9_3.x86_64.conf 
      #OsIdentifier: 6514b555d12abeb890c92453c3127d7bf1f52329
      title Test
      machine-id b1609d18cd704009b4e3f4142ec64eba
      version 5.14.0-362.24.1.el9_3.x86_64
      linux /vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0
      initrd /initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0
      options root=/dev/rhel/root ro rd.lvm.lv=rhel/root resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/swap rhgb quiet rd.plymouth=0 plymouth.enable=0
      grub_users $grub_users
      grub_arg --unrestricted
      grub_class kernel
       

      3. Run boom list:

      [root@localhost ~]# boom list
      BootID  Version                      Name                     RootDevice                            
      e22dd61 5.14.0-362.24.1.el9_3.x86_64 Red Hat Enterprise Linux /dev/mapper/rhel-root                 
      f886037 5.14.0-362.24.1.el9_3.x86_64 Red Hat Enterprise Linux /dev/rhel/root 

      (note the boot_id has changed from c6c28de to f886037)

      4. Check for backup boot images in /boot:

      [root@localhost ~]# ls /boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0 /boot/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0
      

      Expected results

      [root@localhost ~]# ls /boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0 /boot/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0
      /boot/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0  /boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0
       

      Actual results

      ls: cannot access '/boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64.boom0': No such file or directory
      ls: cannot access '/boot/initramfs-5.14.0-362.24.1.el9_3.x86_64.img.boom0': No such file or directory
      

       

      Upstream status

      This is fixed in commit 7a134cf:

      commit 7a134cf302a2a3998144a222a98453d8ea16d3a4
      Author: Bryn M. Reeves <bmr@redhat.com>
      Date:   Wed May 8 18:43:52 2024 +0100    Revert "boom.cache: ignore foreign boot entries when reference counting"
          
          This reverts commit f9704eea7b973863ea5a2bf6ad13cd37abce64f6.
          
          The reason for ignoring foreign boot entries when determining reference
          counts no longer exists (a spurious warning when creating entries with
          --backup).
          
          This commit causes problems if a boom-managed boot entry is modified
          outside of boom's control (e.g. by kdumctl/grubby appending a modified
          crashkernel argument): since boom sees the entry as foreign the images
          used by it end up with a reference count of zero and are automatically
          removed.
          
          Revert the above commit to prevent this behaviour.
          
          Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
       

      Workaround for RHEL8-9 upgrades

      By adding the RHEL9 crashkernel setting to the RHEL8 boom profile the modification by kdumpctl/grubby can be avoided:

      x86_64/s390x
      [root@localhost ~]# boom profile create --from-host --os-options "root=%{root_device} ro %{root_opts} rhgb quiet crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M"
      
      aarch64
      [root@localhost ~]# boom profile create --from-host --os-options "root=%{root_device} ro %{root_opts} rhgb quiet crashkernel=1G-4G:256M,4G-64G:320M,64G-:576M"
      
      ppc64le
      [root@localhost ~]# boom profile create --from-host --os-options "root=%{root_device} ro %{root_opts} rhgb quiet crashkernel=2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G" --optional-keys "grub_users grub_arg grub_class id"
      

              lvm-team lvm-team
              rhn-support-bmr Bryn Reeves
              lvm-team lvm-team
              Filip Suba Filip Suba
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: