Subscribe to our RSS feed to get alerted every time SUBSCRIBE!

How to Change Default GRUB Entries and Timeout on AlmaLinux / Rocky Linux

GRUB is the default boot loader for Enterprise Linux. It load all the Linux distributions as well as other operating system with ease. It provides a menu which shows all the the operating system in one place. The GRUB has advanced feature as well as some basic features that makes it effective on all enterprise grade Linux. This guide provides to change the default GRUB Entries as well as to change the timeout according to the user requirements on respective Enterprise Linux that supports the GRUB.

Step-1 (Login to the root user)
 su -
Step-2 (List all the GRUB2 boot entries)
 grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2

Sample Output

CentOS Linux 8 (Core), with Linux 3.10.0-229.el7.x86_64
CentOS Linux 8 (Core), with Linux 0-rescue-7e890c03ebb940a9a67163adaef14894
Windows 11 (loader) (on /dev/sda1)
menuentry "Windows 11 (loader) (on /dev/sda1)"
Step-3 (Change the default boot entry)

These command is use to set the entry as a default.

 grub2-set-default 3

Note you can change the 3 according to your choice of entries this is the default entries to boot.

Step-4 (Check whether it is added to the default entry)

This command shows the list of GRUB entries.

 grub2-editenv list

Sample Output

Step-5 (Save all the changes in GRUB2)
 grub2-mkconfig -o /boot/grub2/grub.cfg

Sample output

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7e890c03ebb940a9a67163adaef14894
Found initrd image: /boot/initramfs-0-rescue-7e890c03ebb940a9a67163adaef14894.img
Found Windows 11 (loader) on /dev/sda1

Login to the root user

 su -
Step-6 (Change GRUB menu time out)
 vi /etc/default/grub

Sample Output

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"

Note: You can make change “GRUB_TIMEOUT=ANY-POSITIVE-NUMBER” to it for making change the timeout period according to your choice.

Step-7 (Save all the changes in GRUB)

This command loads all the entries during boot time and apply those changes.

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

Congratulations now you have change the GRUB entries and time on Enterprise Linux.