5

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.

1 Answers1

7

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.

heynnema
  • 70,711
  • I 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 Oct 30 '17 at 17:38
  • 3
    I 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 Nov 05 '17 at 17:35
  • I found where in the manual navigating submenus with GRUB_DEFAULT is almost discussed: 15.1.10 default. – Joachim Martillo Nov 05 '17 at 20:16
  • @JoachimMartillo: It may be a few years late, but I found the > construct described at https://www.gnu.org/software/grub/manual/grub/html_node/default.html – Zoltan Feb 03 '24 at 09:54