How to change the grub timeout period in Red Hat Enterprise Linux?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 5
  • grub

Issue

  • How to increase the grub timeout so that it will wait longer before booting.
  • How to change the grub timeout so that it will never expire before booting, without user input.
  • How to disable or hide the grub menu so that it will not show during boot.
  • The grub screen is too fast and does not show on boot, but the system boots with no issue. How can we correct the timeout so we have more time to choose a kernel?

Resolution

How to change the grub menu timeout

RHEL 5 and 6

  • The timeout parameter in /boot/grub/grub.conf controls the delay before grub boots the default kernel, which by default is set to a value of 5 seconds.
[root@example ~]# egrep -v "^#|^$" /boot/grub/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-358.el6.x86_64)
      root (hd0,0)
      kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/myvg-rootvol rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=myvg/rootvol  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
      initrd /initramfs-2.6.32-358.el6.x86_64.img
  • The timeout option can be set to any of the following:

    • timeout=0 - prevents the grub screen from showing at boot.

    • timeout=-1 - will cause grub to never timeout and requires manual intervention to boot.

    • timeout=n where n is > 0 - will cause grub to wait n seconds before booting the default kernel.

  • Note: If the timeout is set to 0 then the ctrl key must be held during boot to get the menu to display.

RHEL 7, 8 and 9

If the host is RHEL 7 please see the section Chapter 26.5. Working with GRUB 2 Red Hat Enterprise Linux 7 and edit the GRUB_TIMEOUT value in /etc/default/grub to be a longer timeout, such as 30 or 60, as the value is set in seconds. The default should look something like:

$ cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Changes to /etc/default/grub require rebuilding the grub.cfg.

On BIOS-based machines, issue the following command as root:

# grub2-mkconfig -o /boot/grub2/grub.cfg

On UEFI-based machines, issue the following command as root:

# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Additional Resources:

Diagnostic Steps

  • The grub menu delay before booting the default kernel is too short / long.

  • The grub menu does not display or disappears before it can be seen when connecting to a VMware or Red Hat Enterprise Virtualization (RHEV) guest console.

Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.