GRUB boot loader shows a menu or a list of operating systems that we have on our system for several seconds after we power up our PC or laptop. In this tutorial, we’ll look at how to modify the GRUB settings to remove the GRUB menu timeout.
All commands have been tested on GNU GRUB 2.06 running on Debian 11 Bullseye, but they should also work on most Linux distributions.
2. Introduction to the Problem
GRUB menu displays the menu for five seconds by default, and then it’ll boot the default entry, unless a key is pressed:
Pressing any key will remove the timeout and it will then wait for user input indefinitely:
As we can see in the screenshot above, pressing any key caused the countdown line to disappear.
A five-second timeout might be enough for most people, but if we have more than one operating system installed, we might need a longer timeout so we can select the right operating system to boot. Otherwise, GRUB will boot the default entry, and we’ll have to restart the system to start the bootloader again.
3. Removing the GRUB Menu Timeout
GRUB provides comprehensive configuration settings in the /etc/default/grub file.
Let’s remove the GRUB menu timeout by modifying the value of GRUB_TIMEOUT config variable:
$ sudo vi /etc/default/grub
[sudo] password for baeldung:
# If you change this file, run 'update-grub' afterwards to update
Unless we’re using a root account, we need to add sudo to be able to edit the config file.
The default timeout is five seconds. We need to set it to -1 to wait for user input indefinitely.
Besides -1 and positive integers, GRUB_TIMEOUT also accepts 0, where it will boot the default entry immediately without displaying the menu.
After editing the /etc/default/grub file, we need to update the /boot/grub/grub.cfg file to reflect the changes. We can do so by running the update-grub command:
$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Its output will be used to detect bootable binaries on them and create new boot entries.
Adding boot menu entry for UEFI Firmware Settings ...
Afterward, GRUB will display the menu and wait for user input indefinitely.
In this article, we learned how to remove the GRUB menu timeout to wait for user input indefinitely. This could be useful when we have more than one operating system installed and we need a longer timeout in order to select the right operating system to boot.