How to Change Default GRUB2 Entries and Timeout on CentOS 7 / RHEL 7

How to Change Default GRUB2 Entries & GRUB2 Menu Timeout on CentOS 7 / RHEL 7 / SL 7 / OL 7.  GRUB2 is the default boot loader for all Enterprise Linux 7. It load all the Linux Distro as well as other operating system with ease. It provides a menu which shows all the the operating system in one place. The GRUB2 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 2 Entries as well as to change the timeout according to the user requirements on respective Enterprise Linux that supports the GRUB2.

How to Change Default GRUB2 Entries on EL7

Step-1 (Login to the root user)
[gopal@techbrown ~]$ su -
Password:
Step-2 (List all the GRUB2 boot entries)
[root@techbrown ~]# grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
Sample Output
CentOS Linux 7 (Core), with Linux 3.10.0-229.el7.x86_64
CentOS Linux 7 (Core), with Linux 0-rescue-7e890c03ebb940a9a67163adaef14894
Windows 7 (loader) (on /dev/sda1)
menuentry "Windows 7 (loader) (on /dev/sda1)"
Step-3 (Change the default boot entry)
[root@techbrown ~]# 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)
[root@techbrown ~]# grub2-editenv list
Sample Output
saved_entry=3
Step-5 (Save all the changes in GRUB2)
[root@techbrown ~]# 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 7 (loader) on /dev/sda1
done

How to add Windows 7 boot entries in GRUB 2 for EL7

You need to follow the tutorial for that purpose.

How to Change Default GRUB2 Menu Timeout on EL7.

Step-1 (Login to the root user)
[gopal@techbrown ~]$ su -
Password:
Step-2 (Change GRUB2 menu time out)
[root@techbrown ~]# vi /etc/default/grub
Sample Output
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

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

Step-5 (Save all the changes in GRUB2)
[root@techbrown ~]# 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 7 (loader) on /dev/sda1
done

Final Result.

Congratulation now you have completed all the steps to change the default boot entries in GRUB2 and as changed the default timeout period in GRUB2. hope you enjoyed this article if you have issues regarding this topic you may use the comment section below for further help and support for the issues and difficulties.

Hot Right Now

Related Post

COMMENTS