Issue
Description of problem:
Running "grub2-mkconfig" will remove all options from the BLS entries in /boot/loader/entries and /etc/kernel/cmdline.
Version-Release number of selected component (if applicable):
grub2-tools-2.06-60.el9.x86_64
How reproducible:
Always
Steps to Reproduce:
cat /boot/loader/entries/* | grep ^options
options root=UUID=b862bc8d-e44f-44be-95f8-93ccdcaa6b35 console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M $tuned_params
cat /etc/kernel/cmdline
root=UUID=b862bc8d-e44f-44be-95f8-93ccdcaa6b35 console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0<no newline at end>
cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt3)/vmlinuz-5.14.0-268.el9.x86_64 root=UUID=b862bc8d-e44f-44be-95f8-93ccdcaa6b35 console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M
grub2-mkconfig -o /dev/null
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
cat /boot/loader/entries/* | grep ^options
options root=UUID=b862bc8d-e44f-44be-95f8-93ccdcaa6b35 ro
cat /etc/kernel/cmdline
root=UUID=b862bc8d-e44f-44be-95f8-93ccdcaa6b35 ro
Actual results:
As above.
Expected results:
Running grub2-mkconfig should not change the BLS entries or /etc/kernel/cmdline.
(My expectation is that grub2-mkconfig should never change any files itself, it should only gather information and output a config file that I then might or might not install for real. But maybe that is a wrong expectation.)
Additional info:
I think this has started to happen for two reasons:
GRUB_CMDLINE_LINUX in /etc/default/grub is empty in RHEL 9, probably since the beginning. In RHEL 8 and Fedora, it matches the BLS entries.
The 10_linux part of grub2-mkconfig used to only look at BLS entries that match the machine id and would miss the one that is actually present, which looks like this:
ls /boot/loader/entries
ffffffffffffffffffffffffffffffff-5.14.0-268.el9.x86_64.conf
This is why grub2-mkconfig would not clobber BLS entries before RHEL 9.2, I think. It would probably clobber /etc/kernel/cmdline.
Now 10_linux processes all files in /boot/loader/entries.
Also note that /etc/kernel/cmdline does not contain the crashkernel option that is in the BLS entries.