Tuxtips - Linux HowTos

Linux HowTos live here


How to make GRUB remember my last choice

13 Nov 2020

GRUB is a boot loader - a program that gives you a choice of booting various operating systems or various saved configurations of the only Linux distribution installed on your machine. If GRUB is configured to give you a choice at boot, you should see a list of choices right after starting your machine, one of which is selected by default and if you do not change the selection, it boots after a few seconds.

What if GRUB insists on booting the entry you do not wish to select? You have a few options, one of the more convenient is saving the last chosen entry to be the default. Here is how to achieve this.

First, you need to edit /etc/default/grub file, changing GRUB_DEFAULT value to "saved":
click code to copy
GRUB_DEFAULT=saved

then add (or uncomment) the line
click code to copy
GRUB_SAVEDEFAULT="true"

Save the file. Now you need to save the GRUB config to make it work at the next boot. In Debian/Ubuntu run in terminal:
click code to copy
sudo update-grub

In Arch you should run:
click code to copy
sudo grub-mkconfig -o /boot/grub/grub.cfg

That's it. When you reboot your computer, choose the entry you want to make default and hit Enter to boot the system of your choice. All subsequent boots should result in making that entry selected by default.
Tested on: EndeavourOS, Nov 2020



 
Comments Add your comment




Enter the digit "four" (spam protection):

Tags: