Ubuntu – How to disable grub menu at boot time in Ubuntu 20.04

20.04bootdual-bootgrub2

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_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# 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 ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

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

# 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'
#GRUB_GFXMODE=640x480

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

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

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

How do I disable it?

Best Answer

Tested with Dual boot of 2 Ubuntu 20.04 OS'es

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

GRUB_TIMEOUT=10

like this

GRUB_TIMEOUT=0

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

quick_boot="1"

to

quick_boot="0"

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

prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
quick_boot="1"

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

. "$pkgdatadir/grub-mkconfig_lib"

found_other_os=

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
fi
EOF
  fi
}

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

GRUB_DEFAULT=0

to

GRUB_DEFAULT=2

then run the below command

sudo update-grub

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