I have installed Ubuntu 20.04 alongside Windows. When I boot the system, it shows the grub menu for 10 seconds to choose between Ubuntu and Windows. I don't want that menu, just want to boot it up right after pressing the power button. I have looked into this thread and added GRUB_HIDDEN_TIMEOUT_QUIET=true and even changed GRUB_TIMEOUT to 0 and then ran sudo update-grub. But it didn't work, menu is still being shown at boot time. This is my /etc/default/grub file-

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)

# Uncomment to disable graphical terminal (grub-pc only)

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux

# Uncomment to disable generation of recovery mode menu entries

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

How do I disable it?


3 Answers 3


Solution / tl;dr

echo 'set timeout_style=hidden
set timeout=0' | sudo tee /boot/grub/custom.cfg


Though UnKNOWn's approach does indeed work, the modification of files installed by the base system should be avoided, if possible. In this case (i. e. Ubuntu 20.04), apt-file shows that /etc/grub.d/30_os-prober belongs to the package grub-common (this is also true for all files located in /etc/grub.d/, which are used by the update-grub command to compile the final GRUB configuration file):

Output of "apt-file search /etc/grub.d/30_os-prober"

If the package grub-common gets updated in the future, apt would detect the change and prompt you to decide what it should do (as both options - the file modified by you as well as the unmodified file from the distributor - are valid). In the worst-case scenario you would have to compare and merge the file contents manually.

So, what are our options if we want to hide the GRUB menu in a multiboot environment? For once, the grub-common package only wants to make sure that each and every user can switch between the installed operating systems. Because of that, the script /etc/grub.d/30_os-prober contains the following code snippet:

adjust_timeout () {
  if [ "$quick_boot" = 1 ] && [ "x${found_other_os}" != "x" ]; then
    cat << EOF
set timeout_style=menu
if [ "\${timeout}" = 0 ]; then
  set timeout=10

This script (which is evaluated once the update-grub command gets executed) basically allows you to set a custom timeout even for multiboot environments - but it will not allow a timeout of 0, as novice users would perhaps not know how to boot their other operating systems without an obvious menu. This means that you could set GRUB_TIMEOUT to 1, and so the GRUB menu would show up for just a second before booting the default boot option.

But how can we hide the GRUB menu for good without touching files installed by system packages? Luckily, the grub-common package provides a facility to apply one-off settings. Have a look at the last file evaluated by the update-grub command, /etc/grub.d/41_custom:

cat <<EOF
if [ -f  \${config_directory}/custom.cfg ]; then
  source \${config_directory}/custom.cfg
elif [ -z "\${config_directory}" -a -f  \$prefix/custom.cfg ]; then
  source \$prefix/custom.cfg;

OK, so a file named custom.cfg, which must be placed in the same location as the actual GRUB configuration file (/boot/grub/grub.cfg), gets sourced every time the GRUB configuration file gets evaluated (i. e. at boot time). So let us add our desired settings to this file (/boot/grub/custom.cfg):

GRUB will now hide the menu and instead boot the default boot option immediately. Other operating systems can still be booted by using the UEFI.

  • Can you explain a little bit "Other operating systems can still be booted by using the UEFI." Is there another way to select boot OS?
    – AndresR
    Oct 16, 2020 at 11:47
  • 2
    Well, many UEFI implementations are able to list the available operating systems (since all of them will store the files required for their boot process on a common ESP, short for EFI System Partition). Most of the time they will also allow you to select the operating system that should boot from this list once you have entered the UEFI user interface. Note that the steps needed to enter the UEFI user interface differ between vendors and implementations. Most of the time you will have to press Escape, Delete or one of the function keys on system startup.
    – opx
    Oct 17, 2020 at 13:04

Tested with Dual boot of 2 Ubuntu 20.04 OS'es

Edit the below line in the file /etc/default/grub file


like this


and run the below command

sudo update-grub

this makes the timeout to 0 with condition that if there is Single OS it will stick to 0 otherwise it will be overwrite to 10.

In the /etc/grub.d/30_os-prober file, change the line




This will prevent in multi OS'es cases from changing the timeout value to 10seconds..

see the function "adjust_timeout" from the file /etc/grub.d/30_os-prober


export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"

. "$pkgdatadir/grub-mkconfig_lib"


adjust_timeout () {
  if [ "$quick_boot" = 1 ] && [ "x${found_other_os}" != "x" ]; then
    cat << EOF
set timeout_style=menu
if [ "\${timeout}" = 0 ]; then
  set timeout=10

When you want to see grub menu, pressing the Esc key at rite time will show you. (rite time varies based on conditions, generally after the BIOS menu hand overs to grub menu time)

In case if you wish to change Default OS, you can set from the same file /etc/default/grub.

for the first time, get to the grub menu by hitting Esc at the rite time. Then count the number starting from 0 from top to list your favorite OS Entry..

For example, I have two 20.04 OS'es.. one in /dev/sda2 and other in /dev/sda6 /dev/sda2 is the default one. If I want to make the one in /dev/sda6 as the default OS, I need to find its number like below..

enter image description here

So, its position is at number 2.

Edit the file /etc/default/grub and change the line




then run the below command

sudo update-grub

System will boot straight to Ubuntu 20.04 on /dev/sda6


As of ubuntu 22.10 i recommend this:

edit the file /etc/default/grub:

sudo nano /etc/default/grub

Make sure you have this lines:


Save and exit run updater:

sudo update-grub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.