Linux System Administration for Beginners

Operation of Running Systems

Install configure and troubleshoot bootloaders

When a Linux system powers on, the very first program it executes is the bootloader. Its primary role is to initialize hardware and load the Linux kernel—the core of your operating system. GRUB (Grand Unified Bootloader) is the most widely used bootloader in Linux environments. In this guide, we’ll walk through installing, configuring, and troubleshooting GRUB on CentOS Stream systems.

Prerequisites

  • A CentOS installation ISO on USB, CD, or DVD
  • Familiarity with basic Linux commands and partitioning
  • Backup of important data before making bootloader changes

1. Boot into Rescue Mode

  1. Insert your CentOS installation media and boot from it.
  2. At the menu, select Troubleshooting.
  3. Choose Rescue a CentOS Stream System.

Once the rescue image loads, you’ll see service stop messages:

[  OK  ] Stopped dracut mount hook.
[  OK  ] Stopped target Local File Systems (Pre).
...
[  OK  ] Reached target Switch Root.
Starting Switch Root...

When prompted, select option 1 to auto-detect and mount your system under /mnt/sysroot:

=======================================================================
Rescue

The rescue environment will now attempt to find your Linux installation and
mount it under the directory: /mnt/sysroot. You can then make any changes
required to your system.
  1) Continue
  2) Read-only mount
  3) Skip to shell
  4) Quit (Reboot)

Please make a selection from the above: 1

After mounting completes, switch into your installed system’s root:

sh-4.4# chroot /mnt/sysroot
bash-4.4#

2. Generate a New GRUB Configuration

Inside the chroot, generate a fresh GRUB config file:

System TypeCommand
BIOS-basedgrub2-mkconfig -o /boot/grub2/grub.cfg
EFI-basedgrub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

Example for BIOS:

bash-4.4# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done
bash-4.4#

3. Install GRUB to the Disk

First, identify your boot disk:

bash-4.4# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda       8:0    0   20G  0 disk
├─sda1    8:1    0    2G  0 part /boot
├─sda2    8:2    0    2G  0 part [SWAP]
└─sda3    8:3    0   17G  0 part /

Install GRUB onto /dev/sda (or your boot disk):

bash-4.4# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
bash-4.4#

EFI Installation

On EFI systems, reinstall the GRUB EFI packages instead of grub2-install:

dnf reinstall grub2-efi shim

4. Exit Rescue and Reboot

Leave the chroot and reboot into your system’s internal disk:

bash-4.4# exit
exit
sh-4.4# exit
Rebooting...

5. Edit GRUB Defaults

After a successful reboot, open /etc/default/grub to adjust boot settings. For example, to set the GRUB menu timeout:

[fixit@localhost ~]$ sudo vim /etc/default/grub

Locate and edit:

GRUB_TIMEOUT=5
GRUB_CMDLINE_LINUX="crashkernel=auto resume=UUID=YOUR-UUID rhgb quiet"

Change the timeout value as needed (e.g., GRUB_TIMEOUT=1), then save and exit (:wq).


6. Regenerate and Apply the GRUB Configuration

After editing defaults, regenerate the config:

System TypeCommand
BIOS-basedsudo grub2-mkconfig -o /boot/grub2/grub.cfg
EFI-basedsudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

Example for BIOS:

[fixit@localhost ~]$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done

7. Final Reboot and Verification

Reboot one last time to confirm your changes:

[fixit@localhost ~]$ sudo reboot

Watch for your updated GRUB menu and timeout.


References

Watch Video

Watch video content

Practice Lab

Practice lab

Previous
Boot or change system into different operating modes