How does one use GRUB_DEFAULT to select a default OS for boot?
Here's the easiest way to do this...
Edit /etc/default/grub
...
sudo -H gedit /etc/default/grub
near the top of the file, edit/add these parameters...
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
Then update grub...
sudo update-grub
Now, when you boot, it'll remember the last OS you selected, and make that the default until the next time that you choose a different OS.
Related videos on Youtube
Joachim Martillo
I am an inventor & created key cloud computing tech. See the US patent application entitled Software configurable network switching device.
Updated on September 18, 2022Comments
-
Joachim Martillo over 1 year
I am running UBUNTU 17.10 and have more than one Linux kernel that I might want to run.
According to the current grub manual, GRUB_DEFAULT is "the default menu entry. This may be a number, in which case it identifies the Nth entry in the generated menu counted from zero, or the title of a menu entry, or the special string ‘saved’. Using the id may be useful if you want to set a menu entry as the default even though there may be a variable number of entries before it."
The grub menu no longer gives the various OS options. It provides a menu element named Advanced. Selecting this menu item brings up a submenu of bootable kernels. GRUB_DEFAULT does not index this submenu.
Should I add my own custom boot options to /etc/grub.d/40_custom and reference these menu items in the grub.menu? This solution seems cumbersome. Defining a default kernel was much simpler in the past.
-
George Udosen over 6 years
-
Joachim Martillo over 6 yearsI am only using the Linux OS but about 7 different versions (kernels) thereof.
-
Tomachi about 5 yearsyes i need to also know this so i can reboot HEADLESS into another os without using any cursoring around interactively. otherwise, save default is good but man grub sucks turds.
-
-
Joachim Martillo over 6 yearsI share the machine with two other users that boot other versions of Linux. I would prefer that the default version of Linux be the same for all of us. It's a vanilla version of Linux on which none of us is hacking. All of us at various times boot other than the default version of Linux.
-
Joachim Martillo over 6 yearsI put the following GRUB_DEFAULT directive in /etc/default/grub.
GRUB_DEFAULT="1>2"
------- After I executed update-grub and rebooted, the system booted the 3rd kernel in the Advanced submenu. I found this procedure in another askubuntu answer. I have yet to find a passage in the grub manual that discusses this usage of GRUB_DEFAULT. -
Joachim Martillo over 6 yearsI found where in the manual navigating submenus with GRUB_DEFAULT is almost discussed: 15.1.10 default.