7

One of our Debian-servers won't boot into the newest installed kernel, and during troubleshooting I came across this:

grep GRUB_DEFAULT /etc/default/grub

Output:

GRUB_DEFAULT="1>2"

I haven't seen this syntax before. What does this mean?

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
kenneho
  • 203
  • 2
  • 6
  • Slightly related (though it is not about sub menus): *[How can I change the default boot menu option from the GRUB command line?](https://superuser.com/questions/340168/how-can-i-change-the-default-boot-menu-option-from-the-grub-command-line/1588301#1588301)* (answers are about setting the top level GRUB menu default) – Peter Mortensen Mar 08 '23 at 11:45

2 Answers2

9

From GNU GRUB Manual 2.02: default:

If the entry is in a submenu, then it must be identified using the number, title, or id of each of the submenus starting from the top level, followed by the number, title, or id of the menu entry itself, with each element separated by ‘>’

Meaning that

GRUB_DEFAULT="1>2"

Represents the following logic:
If entry 1 is a submenu, open it and select entry 2 from there.

Which is most likely the advanced submenu leading to a fallback/backup/recovery kernel.

Fanatique
  • 4,538
  • 1
  • 18
  • 28
  • 2
    +1. Additionally you can also validate the selection `2` in above example, what it points to, from command line, by looking at the grub menu-options configuration - `sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}'` [4 more details : https://askubuntu.com/a/1393019/350255] – parasrish Jul 15 '22 at 05:07
2

Take note that for syntax like "1>2", the index starts from 0. So if the 3rd item is a submenu inside which the 2nd item is the default you want to boot, then it should be "2>1".

xuancong84
  • 121
  • 2
  • Also take note that the double quotes are required (unlike for the top level; `GRUB_DEFAULT=1` for the second (top level) menu item will work (without the double quotes)). – Peter Mortensen Mar 08 '23 at 11:48