How to disable grub2 menu auto hide?

I want to always show grub2 menu, with the default timeout of 5s.

I want it to be effective even after kernel update.

And it is even better if this setting will still be valid after running
grub2-mkconfig .

1 Like

I think that was done by setting timeout to a non-zero value in /etc/default/grub. It’s been a while since I used grub2 though, so I’m not sure. Maybe you have to set default as well. I think in the old versions, default could be set to a number (starting from zero) that indicated which entry (top down) was to be booted when the timer ran out.

Just going from memory.

In recent Fedora (start with 33?), there is a menu_auto_hide feature.

If the previous boot is successful, and there is no key pressed, it will boot direct into the “last or default” entry without showing the menu.

At the moment, with grub2 using BLS, it seems /etc/default/grub is not being respected.

### BEGIN /etc/grub.d/10_reset_boot_success ###
# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry
if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
  set menu_hide_ok=0  ## I manually set this to 0 to disable it.
else
  set menu_hide_ok=0 
fi
# Reset boot_indeterminate after a successful boot
if [ "${boot_success}" = "1" ] ; then
  set boot_indeterminate=0
# Avoid boot_indeterminate causing the menu to be hidden more then once
elif [ "${boot_indeterminate}" = "1" ]; then
  set boot_indeterminate=2
fi
sudo grub2-editenv - unset menu_auto_hide

For more info:

6 Likes

Thank you very much!

2 Likes

On fedora 33 I was able to edit the /etc/grub.d/12_menu_auto_hide file and change the lines that had

set timeout-style=hidden
set timeout=0

to 

set timeout-style=menu
set timeout=5

It now always displays the grub menu on boot and the 5 second delay does not bother me at all.

Just be aware that if the 12_menu_auto_hide file is part of a RPM package, it will be overwritten with the next update of that package.

P.S. You can use rpm -qf <path> to see what package a file belongs to (if any).

2 Likes

being

/etc/grub.d/12_menu_auto_hide

while

 sudo dnf reinstall grub2-common

will sort of reset manual dealings in the bash scripts.

note that

man grub2-editenv     # does not mention  " - " to fallback the  [FILE] parameter

but

 grub2-editenv --help # does do  mention  " - " to fallback the  FILENAME parameter

where [FILE] and FILENAME refer to the same parameter with a default value of /boot/grub2/grubenv on Fedo34,
it used to be /boot/grub/grubenv

1 Like

Interesting and useful discussion, I appreciate your work! :+1:

2 Likes