When you turn on your computer, the boot loader is the first program that starts up and is responsible for loading and transferring control to an underlying operating system. Nowadays, almost any modern Linux distribution uses the GRand Unified Bootloader version 2 (GRUB2) for starting the system. It has a lot of flexibility in configuration and supports a lot of different operating systems. In this recipe, we will show how to customize the GRUB2 boot loader by disabling the waiting time of the menu display and therefore improving the time it takes for booting the system.
To complete this recipe, you will require access to an already installed CentOS 7 operating system (minimal or any other CentOS 7 installation type will work) with root privileges. Also, you need to have some basic experiences with a text based editor, such as nano, for changing the configuration files.
We begin this recipe by opening the main GRUB2 configuration file with our text editor of choice and modifying it.
cp /etc/default/grub /etc/default/grub.BAK
yum install nano
):nano /etc/default/grub
GRUB_HIDDEN_TIMEOUT=0
#
sign to the beginning of the following line, as shown:GRUB_TIMEOUT=0
dmesg | grep -Fq "EFI v"
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
grub2-mkconfig
is successful, it will print Done.
Now reboot your system using the following command:reboot
Having completed this recipe, we now know how to customize the GRUB2 boot loader. In this very easy recipe, we only showed you very basic modifications to the boot loader but it can do much more! It supports a broad variety of filesystems and can boot almost any compatible operating system. This is also particularly useful if you plan to run multiple operating systems on the same machine. To learn more about GRUB2's configuration file syntax type the info grub2
| less
command and go to the section 6.1 Simple configuration handling
(read the recipe Navigating text files with less in Chapter 2, Configuring the System to learn how to browse this document).