16

Answers to a very old question suggest to edit

/etc/default/grub

That file has the following contents:

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

The timeout I'm witnessing when booting the system is 10 seconds. According to the configuration file it's 0 seconds though. So, where is the timeout actually defined in Ubuntu 20.04?

5 Answers5

13

It's kind of a bug in GRUB.

In /etc/grub.d/30_os-prober, here's the code snippet that causes the problem...

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 }

To change/fix the 10 second timeout, edit /etc/grub.d/30_os-prober with:

sudo -H gedit /etc/grub.d/30_os-prober

and either:

  1. set quick_boot="1" to quick_boot="0"
  2. set set timeout=10 to set timeout=3

Note: or edit /etc/default/grub and set GRUB_TIMEOUT=3, or something between 1 and 10.

sudo update-grub

Note: See here for more details/options.

heynnema
  • 73,649
7

I am using update-grub 2.02-2ubuntu8.23.

In the file /etc/default/grub I added:

GRUB_RECORDFAIL_TIMEOUT=5

The default value was 30 seconds for efi.

When I set the value to 5, it worked and I no longer have to wait 30 seconds if I don't respond to the menu.

It may be that GRUB_RECORDFAIL_TIMEOUT does not apply to all versions of grub. I could not find it documented. To see if it applies to your version of grub, search /etc/grub.d, which is a set of files for creating the grub configuration:

$ grep GRUB_RECORDFAIL_TIMEOUT *
00_header:  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
00_header:  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
John Klug
  • 171
0

It's important to understand if some cases like EFI Boot active or ex-dual boot when you remove one of these partitions and grub menu continuing to show on startup the correct file to change these situations it's in the boot Grub. In case this before answer procedures doesn't work, You need to change the line 119 value in "/boot/grub". If you dont no, the command is "sudo gedit /boot/grub".

In the part:

  if [ $grub_platform = efi ]; then
  set timeout=00
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
  fi
fi

Change the second line set timeout=30 value 30 to 00, and save (you need to be a root) and restart.

0

For me, i had to:

chmod uog+w /boot/grub/grub.cfg

...in order to make it writable, you might want to only hit o+w if there are others who use the machine, as the command above gives everyone write access to the file. Then, after hitting gedit /boot/grub/grub.cfg

i changed line 111 (set timeout=-1) to what i wanted:

 if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=hidden
    set timeout=-1

This eliminates the timeout, if you just want a more or less grub time, just change the value to number of seconds without the "-".

-1

Answer from Thiago Lucio did the trick for me.

I have to change

"if [ \$grub_platform = efi ]; then
  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}"

to

"if [ $grub_platform = efi ]; then
  set timeout=3" 

in /etc/grub.d/00_header

I use a dual boot with EFI.

Artur Meinild
  • 31,035
Bruno
  • 1