Deactivate GRUB2 recordfail feature

Last change on 2021-05-07 • Created on 2020-03-13 • ID: RO-BD00A

Introduction

With GRUB2, there is a recordfail feature. If there is a failed boot attempt, GRUB2 will automatically stop at the boot menu during the next boot.

You may not want this in some situations, so you can change it. Depending on the GRUB version, you either need to change the file /etc/grub.d/00_header or the variable GRUB_RECORDFAIL_TIMEOUT in the file /etc/default/grub.

Deactivate GRUB2 recordfail feature

First, search for the following in the file /etc/grub.d/00_header

if [ ${recordfail} = 1 ]; then
   set timeout=-1
else
  set timeout=${GRUB_TIMEOUT}
fi

If you find this (the exact wording), then simply add comment characters:

#if [ ${recordfail} = 1 ]; then
#    set timeout=-1
#else
    set timeout=${GRUB_TIMEOUT}
#fi

Or, if you find the following,

if [ "${recordfail}" = 1 ]; then
 set timeout=${GRUB_RECORDFAIL_TIMEOUT:--1}
else
 set timeout=${2}
fi

then edit the file /etc/default/grub and add the line

GRUB_RECORDFAIL_TIMEOUT=5

for a 5 second timeout.

In either case, to update the configuration, run update-grub.

Now GRUB2 will always use the set timeout.

Manual reset the recordfail value

You can manually reset the value for grubenv:

grub-editenv set recordfail=0

Or you can even remove it:

grub-editenv unset recordfail

Table of Contents