Changes to /etc/default/grub not taking effect

Hi all, I’m setting up a new test server using the Almalinux 9.3 media.

Changes I make to /etc/default/grub to the kernel command line parameters aren’t taking effect. I notice that after I run grub2-mkconfig the resulting file in /boot/grub2/grub.cfg has my changes, but when I reboot and check dmesg the kernel is being booted with the original default parameters.

Maybe something changed or I’m doing something wrong. Why isn’t this working like it used to for me?

1 Like

you’re probably using UEFI not BIOS, so it uses a different path.

you could do:

sudo grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg

but you’d be better off using grubby, like so (substituting your own args):

sudo grubby --args="audit=1 selinux=1" --update-kernel=ALL

then you don’t even have to edit /etc/default/grub or run grub2-mkconfig and it figures out the correct grub.cfg path.

have a look at grubby --help

1 Like

Chapter 4. New features Red Hat Enterprise Linux 9 | Red Hat Customer Portal section 4.9

The grub2-mkconfig has new behaviour/option about BLS entries in el9_3.

1 Like

Thanks. I did doublecheck and this machine is set to legacy BIOS mode (there isn’t even a /boot/efi/EFI/AlmaLinux/grub.cfg file. Regardless though, using grubby worked. It made the changes to /etc/default/grub and whatever it did afterward worked while grub2-mkconfig -o /boot/grub2/grub.cfg didn’t. (must be more required after that now?)

In any case, grubby solved the problem and that’s what I’ll use going forward. Thanks for the tip again

Not in el9.

In AlmaLinux 8:

  • Legacy mode has grub config in /boot/grub2/
  • UEFI mode has grub config in /boot/efi/EFI/almalinux/

In AlmaLinux 9:

  • Legacy mode has grub config in /boot/grub2/
  • UEFI mode has grub config in /boot/grub2/ too and /boot/efi/EFI/almalinux/grub.cfg is wrapper that loads /boot/grub2/grib.cfg

The RHEL 9.3 release notes tell:

With this update, the behavior of GRUB variables has changed as follows:

  • If you set the GRUB_ENABLE_BLSCFG= parameter to true, running the grub2-mkconfig -o /path/to/grub.cfg command makes all the changes to the grub.cfg file that you had made in the /etc/default/grub file except from the kernel command line. In such a case, BLS snippets do not get updated.
  • If you set the GRUB_ENABLE_BLSCFG= parameter to false, BLS snippets do not get updated, but the changes are still made to the grub.cfg file.

In case you want to update the kernel command line, enter:

# grub2-mkconfig -o /path/to/grub.cfg --update-bls-cmdline

Also note that you can make changes to BLS snippets for individual kernels using grubby:

# grubby --update-kernel /path/to/kernel --args "new args"

That (the options) seem a bit redundant. If user has learned that the grub config is dictated by /etc/default/grub but most update operations do use grubby, then the /etc/default/grub does not have to stay consistent with actual config and the user will become confused. Even more so, if automation has been adopted and it relies on (old behaviour of) grub2-mkconfig.