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

grubx64.efi and grubby can sort the kernels in a different order with different index values

Linking RHIVOS CVEs to...Migration: Automation ...RHELPRIO AssignedTeam ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-10.0
    • grub2
    • Yes
    • None
    • rhel-bootloader
    • ssg_core_services
    • 3
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • x86_64
    • None

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

      Setting either the default kernel or the boot_next kernel using the index value shown by grubby might not boot the selected kernel.

      It appears that in some cases grub can sort the kernels in a different order than grubby does. So the index selected by a root user based on grubby output could result in the booting of a different kernel.

      Please provide the package NVR for which the bug is seen:

      grubby-8.40-77.el10.x86_64
      grub2-efi-x64-2.12-1.el10.x86_64

      How reproducible is this bug?:

          It's 100% reproducible with kernels that have a particular local version suffix, e.g.

      root@dell-per640-02:~# rpm -qa kernel
      kernel-6.12.0-35.el10.x86_64
      kernel-6.12.0-35.99_1592504161.el10.x86_64
      root@dell-per640-02:~# 

      Steps to reproduce

      root@dell-per640-02:~# grubby --info=ALL
      index=0
      kernel="/boot/vmlinuz-6.12.0-35.el10.x86_64"
      args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=UUID=24f31251-2e86-448b-b735-42f22d3c89c6 rd.lvm.lv=rhel_dell-per640-02/root rd.lvm.lv=rhel_dell-per640-02/swap console=tty0 console=ttyS0,115200n81 $tuned_params"
      root="/dev/mapper/rhel_dell--per640--02-root"
      initrd="/boot/initramfs-6.12.0-35.el10.x86_64.img $tuned_initrd"
      title="Red Hat Enterprise Linux (6.12.0-35.el10.x86_64) 10.0 (Coughlan)"
      id="89d201451f76424ea97479f9ffbce602-6.12.0-35.el10.x86_64"
      index=1
      kernel="/boot/vmlinuz-6.12.0-35.99_1592504161.el10.x86_64"
      args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=UUID=24f31251-2e86-448b-b735-42f22d3c89c6 rd.lvm.lv=rhel_dell-per640-02/root rd.lvm.lv=rhel_dell-per640-02/swap console=tty0 console=ttyS0,115200n81 $tuned_params"
      root="/dev/mapper/rhel_dell--per640--02-root"
      initrd="/boot/initramfs-6.12.0-35.99_1592504161.el10.x86_64.img $tuned_initrd"
      title="Red Hat Enterprise Linux (6.12.0-35.99_1592504161.el10.x86_64) 10.0 (Coughlan)"
      id="89d201451f76424ea97479f9ffbce602-6.12.0-35.99_1592504161.el10.x86_64"
      index=2
      kernel="/boot/vmlinuz-0-rescue-89d201451f76424ea97479f9ffbce602"
      args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=UUID=24f31251-2e86-448b-b735-42f22d3c89c6 rd.lvm.lv=rhel_dell-per640-02/root rd.lvm.lv=rhel_dell-per640-02/swap console=ttyS0,115200n81"
      root="/dev/mapper/rhel_dell--per640--02-root"
      initrd="/boot/initramfs-0-rescue-89d201451f76424ea97479f9ffbce602.img"
      title="Red Hat Enterprise Linux (0-rescue-89d201451f76424ea97479f9ffbce602) 10.0 (Coughlan)"
      id="89d201451f76424ea97479f9ffbce602-0-rescue"
      root@dell-per640-02:~# 

      Set the default to the 6.12.0-25.el10 kernel using its index=0.

      root@dell-per640-02:~# grub2-set-default 0
      root@dell-per640-02:~# grub2-editenv list
      saved_entry=0
      menu_auto_hide=1
      boot_success=0
      boot_indeterminate=0
      root@dell-per640-02:~# grubby --info=DEFAULT
      index=0
      kernel="/boot/vmlinuz-6.12.0-35.el10.x86_64"
      args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=UUID=24f31251-2e86-448b-b735-42f22d3c89c6 rd.lvm.lv=rhel_dell-per640-02/root rd.lvm.lv=rhel_dell-per640-02/swap console=tty0 console=ttyS0,115200n81 $tuned_params"
      root="/dev/mapper/rhel_dell--per640--02-root"
      initrd="/boot/initramfs-6.12.0-35.el10.x86_64.img $tuned_initrd"
      title="Red Hat Enterprise Linux (6.12.0-35.el10.x86_64) 10.0 (Coughlan)"
      id="89d201451f76424ea97479f9ffbce602-6.12.0-35.el10.x86_64"
      root@dell-per640-02:~# 
      

       

      But with index=0, grub boots the other kernel, 6.12.0-35.99_1592504161.el10.

       

      
                                     GRUB version 2.12
       /----------------------------------------------------------------------------\
       |*Red Hat Enterprise Linux (6.12.0-35.99_1592504161.el10.x86_64) 10.0 (Cough>| 
       | Red Hat Enterprise Linux (6.12.0-35.el10.x86_64) 10.0 (Coughlan)           |
       | Red Hat Enterprise Linux (0-rescue-89d201451f76424ea97479f9ffbce602) 10.0 >|
       | UEFI Firmware Settings                                                     |
       |                                                                            |
       |                                                                            |
       |                                                                            |
       |                                                                            |
       |                                                                            |
       |                                                                            |
       |                                                                            |
       |                                                                            | 
       \----------------------------------------------------------------------------/
      

       

       

      The exact same problem affects boot_next when set via grub2-reboot using an index value.

      Expected results

      grubby and grub should index the kernels (i.e. boot loader entries) in the same order.

      They do in this case in RHEL 9.

              bootloader-eng-team bootloader -eng-team
              lszubowi1@redhat.com Lenny Szubowicz
              bootloader -eng-team bootloader -eng-team
              Release Test Team Release Test Team
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: