Deactivate GRUB2 recordfail feature

Last modified: Friday December 1st, 2023

From this article, you will learn how to deactivate GRUB2 recordfail feature.

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

Was this article helpful?
Views: 163

10 Years Beehosting!
Celebrate with 70% OFF + FREE Site Transfer.

Beehosting.pro website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Menu