Modify GRUB2 Boot Order

Hey guys! I would like to know the most practical and safe way to do this in Fedora 37, as Grub Customizer unfortunately is not fully compatible.

I hope this helps:

List all installed kernels

To get the index number of all the installed kernels:

  sudo grubby --info=ALL | grep -E "^kernel|^index"

The output should be something like this:


Change the default kernel using index

Now we can change the default kernel by using the index number:

 sudo grubby --set-default-index=1

Verify the default kernel

Verify that the right kernel has been set as default:

   sudo grubby --default-title

The output will be the default kernel title:

 Fedora Linux (5.15.10-lqx1.0.fc35.x86_64) 35 (Workstation Edition)
1 Like

Hi friend, forgive me, I believe I was not clear about what I want. I want the safest and most convenient way to modify the systems boot order in the Grub or Grub2 menu. Using the Grub Customizer application would be the most practical way, but this application cannot show all installed systems.

The Boot Loader Specification defines a “sort-key” option.

sort-key is a short string used for sorting entries on display. This
should typically be initialized from the IMAGE_ID= or ID= fields of
os-release, possibly with an additional suffix. This field is optional.

Example: sort-key fedora

Scanning the grub2 source code it appears that this is not implemented. So that only leaves the “title” as sort key.

figured out how to modify the Grub2 boot entry or boot order. 2 interesting ways:

  1. Doing “sudo grub2-set-default x”, where x is the index of the entry position corresponding to the operating system to be booted. In this case, whenever the grub2 menu is started, the entry corresponding to the chosen index will always be selected

  2. In the etc/default/grub file, adding the entries “GRUB_DEFAULT=saved” and “GRUB_SAVEDEFAULT=true”, and after that, run “sudo grub2-mkconfig -o /boot/grub2/grub.cfg”, a similar situation to 1." will be applied, with the difference that the selected entry mentioned will always be the last one chosen by the user in the grub2 menu of the last run. It’s the default setting used in Endless OS, for example, and I think it’s great!

This helped, thanks

1 Like