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.

Joachim Martillo
  • 71
  • 1
  • 1
  • 5
  • Are you asking for default kernel or OS? See [here](https://askubuntu.com/questions/100232/how-do-i-change-the-grub-boot-order), and [here](https://askubuntu.com/questions/216398/set-older-kernel-as-default-grub-entry) – George Udosen Oct 30 '17 at 16:53
  • I am only using the Linux OS but about 7 different versions (kernels) thereof. – Joachim Martillo Oct 30 '17 at 17:33
  • yes 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. – Tomachi Mar 26 '19 at 18:29

1 Answers1

6

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
  • 68,647
  • 15
  • 124
  • 180
  • 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
  • 2
    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](https://www.gnu.org/software/grub/manual/grub/html_node/) 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](https://www.gnu.org/software/grub/manual/grub/html_node/default.html#default). – Joachim Martillo Nov 05 '17 at 20:16