Change GRUB behaviour to not require keypress on kernel update

Every kernel update requires me to plug in a keyboard and hit enter upon reaching GRUB menu. How to change the default GRUB behaviour to pick and boot newly installed kernel?

This would also need to work with automatic update system, so no manual intervention of setting the GRUB default flag before reboot for example.

Many thanks.

That’s quite strange. In the default configuration, grub waits some seconds for a keystroke to see if a user wants to intervene. If not, grub continues the boot process. You find the configuration in /boot/grub2/grub.cfg. Look for the parameter timeout=

But don’t modify the file! Instead, follow the instructions regarding grub2-mkconfig at the top of the file.

A more likely cause may be a setting in your computer’s BIOS.

1 Like

That is the usual experience - except in the event of a new kernel. In that scenario, the timeout is cancelled and the boot menu awaits user input. I doubt this is an experience unique to me.

Wandering into the realm of assumptions, I’m guessing that’s because the kernel install script wipes the default kernel flag, or has something to do with the GRUB option “GRUB_DEFAULT=saved”.

I doubt the guess is correct. On my system installing a new kernel then rebooting has always booted the newest kernel.

Striking any key while the grub boot menu is displayed does seem to stop the timer and requires the user to then press ‘enter’ to continue booting, which to me appears what you are seeing.

You seem to be, however, using server and not workstation so I cannot verify if there is a difference in the way grub works for booting new kernels there. To me it seems logical that a server would halt booting at the grub menu after installing a new kernel so that the admin could select which kernel to boot from.

What else do you have plugged in? What kind of system are you talking about? Is there any chance that there’s some HID peripheral connected that is sending a keypress event like Shift?

Well, I administer a bunch of off premise Fedora servers. If all of those waited for a keystroke, I would have a real problem. Not waiting for a keystroke is the default behavior for years now.

And if you have this issue for several kernel updates, the source of trouble is most likely buried in your individual system. Either something has gone completely wrong with your specific system setup or with your bios setting.

But to narrow that down, we need more information, e.g. which Fedora variant do you use, and since which kernel version the problem exists.

It’s a new f36 server install on bare metal. Nothing plugged into it other than network.

Fixed this by updating /etc/default/grub with the values:

GRUB_TIMEOUT=1
GRUB_TIMEOUT_STYLE=hidden

Then running grub2-mkconfig with the appropriate arguments.

This still allows user to hold shift during boot to reach grub menu if needed.