Skip to main content
Welcome to this lesson on installing, configuring, and troubleshooting the Linux bootloader. The bootloader is one of the first programs loaded during system startup, and its primary function is to load the Linux kernel—the core component of the operating system. In our examples, we will use GRUB (Grand Unified Bootloader), the most popular bootloader on Linux systems. When the bootloader encounters issues and the system fails to boot, you can use installation media (such as a bootable USB stick, CD, or DVD created from a CentOS ISO file) to repair the system. Boot from the installation media, choose the Troubleshooting option, and then select “Rescue a CentOS Stream System” to begin the rescue process. As the rescue image loads, you will see boot messages similar to the following:
After these messages, you will be presented with several options as the rescue environment attempts to locate your Linux installation and mount it under /mnt/sysroot. The available options include:
  1. Continue (mount read-write)
  2. Read-only mount
  3. Skip to shell
  4. Quit (Reboot)
For this demonstration, choose option 1 to allow the rescue environment to locate and mount your installed system.
After mounting your system under /mnt/sysroot, change your root directory to this environment. Using the chroot command lets you operate as if you are working directly on your installed Linux system.
Once mounted, execute the following commands:
If your system uses EFI, the command above saves the GRUB configuration file in the EFI location. For BIOS-based systems, generate the configuration with:
After generating the GRUB configuration, the next step is to install GRUB onto the appropriate disk. For BIOS systems, GRUB must be installed to the first sectors of the boot disk. Start by identifying the disk with the lsblk command:
From the output, notice that the boot partition is on sda (with /boot on one partition and the root file system / on another). Install GRUB on the first sector of /dev/sda using:
For EFI-based systems, the installation process differs because the bootloader is stored as a file on a specially designated boot partition. In those cases, use your package manager (such as dnf on CentOS) to reinstall GRUB or place EFI boot files in the correct location. This installation command is not applicable for BIOS systems. After installing GRUB, exit the chroot environment and then the rescue shell to reboot your machine:
Once your system reboots (without the live installation medium), verify GRUB’s functionality by observing the boot menu. In this demonstration, the GRUB timeout is set to one second, so the menu appears briefly.

Configuring GRUB Settings

The primary configuration file, located at /etc/default/grub, is used by the grub-mkconfig utility to generate the final GRUB configuration file (grub.cfg). Editing /etc/default/grub requires root privileges. For example, you can open the file with Vim:
Inside this file, you will find various configuration options. A common adjustment is the GRUB timeout—the duration for which the boot menu is displayed. An example configuration might look like this:
You can change the timeout to a shorter or longer duration depending on your needs, and modify the GRUB_CMDLINE_LINUX option to pass different kernel parameters. After editing and saving the file (for Vim, press Esc, type :wq, and hit Enter), update the GRUB configuration by running:
For EFI systems, generate the configuration file in the EFI partition with:
Once the configuration file is regenerated, reboot your machine to observe the updated GRUB menu. With a timeout set to one second, the menu will only appear briefly during boot.
After confirming that your system boots correctly, you can fine-tune your GRUB settings further by editing /etc/default/grub and regenerating the configuration file as needed.
This concludes our demonstration on bootloader installation, configuration, and troubleshooting. Thank you for following along, and see you in the next article! For further reading, check out Kubernetes Documentation and Docker Hub.

Watch Video

Practice Lab