Changing the default boot option in Grub can be very useful when we connect remotely to our computer, this way we can test different kernel versions or even different operating systems.
We configure Grub to be able to save the default boot:
vi /etc/default/grub
GRUB_DEFAULT=saved
To set the third entry as the default option:
grub-set-default 3
We mount the EFI variables, regenerate the Grub configuration and reinstall it:
mount -o remount,rw /sys/firmware/efi/efivars
grub-mkconfig -o /boot/grub/grub.cfg
grub-install –target=x86_64-efi –efi-directory=/boot/efi /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
grub-install –target=x86_64-efi –efi-directory=/boot/efi /dev/sda
We just need to restart to test the changes made:
reboot