Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.


RHCSA - Deploy, Configure, & Maintain Systems: Modify the System Bootloader

GRUB2 (GRand Unified Bootloader 2) serves as the initial software that loads the operating system into memory during the computer's startup process. Offering a user-friendly interface and support for multiple filesystems, GRUB2 allows users to select the desired operating system or kernel to boot, configure system parameters, and even troubleshoot boot issues.

Modifying the Bootloader

The main configuration file for GRUB2 is /etc/default/grub. In the configuration file, you can modify various parameters to customize the bootloader behavior. Some common modifications include changing the default boot entry, setting the timeout for the boot menu, and configuring kernel parameters.

Modifying the bootloader:

To change the default boot entry you modify the value in /etc/default/grub for GRUB_DEFAULT. The default entry is saved which remembers the last kernel booted into, however amending this to a numerical value will ensure the system boots into a specified kernel. This value is an index starting at 0 for the first (latest installed) kernel.

Update the GRUB_DEFAULT setting to 0:

sudo vim /etc/default/grub

Amend variable to display as follows and leave the file open for further modifications:

GRUB_DEFAULT=0

When the system boots, by default you get 5 seconds at the GRUB2 boot menu to interrupt the boot process. This may not be long enough so the value can be updated to give more time. This is done with setting GRUB_TIMEOUT.

Update the GRUB_TIMEOUT variable to give yourself 10 seconds to interrupt the boot process and leave the file open for further modifications:

GRUB_TIMEOUT=10

There may situations that you want the boot process to be more verbose, or just want to tweak other kernel parameters. This is done via the GRUB_CMDLINE_LINUX variable.

Update the GRUB_CMDLINE_LINUX variable, removing rhgb and quiet from the end of the line, which will make the boot process more verbose:

The below variable is how my system looks after removing rhgb & quiet. DO NOT COPY THIS. Instead remove the settings yourself:

GRUB_CMDLINE_LINUX="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/os_vg-swap rd.lvm.lv=os_vg/root rd.lvm.lv=os_vg/swap"

You can now save and exit the configuration file.

After making the modifications to the /etc/default/grub you will need to run the grub2-mkconfig to recreate the grub2 boot configuration file, which may be a different file depending on whether the system is BIOS or UEFI.

To determine if your system is BIOS or UEFI you can run the following, which will echo to screen what your system is using:

Determine if system is BIOS or UEFI:

[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

For BIOS systems, the configuration file is /boot/grub2/grub.cfg.

For UEFI systems, the configuration file is /boot/efi/EFI/redhat/grub.cfg.

Update the grub.cfg file with amended settings from /etc/default/grub

For BIOS systems:

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

For UEFI systems:

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

Now the grub.cfg file has been updated, you can reboot your system and observe that the changes have taken effect.


Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.