Modifying GRUB2 Boot Configuration (CentOS)

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

The GRUB2 bootloader provides many improvements over its predecessor GRUB. This includes support for UUIDs, LVM, and RAID, and a more programmatic approach to configuration. In this hands-on lab, we have been tasked with updating the GRUB configuration and applying these changes.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Update /etc/default/grub

Use a text editor to edit /etc/default/grub and ensure that the following options and values are present:

GRUB_TIMEOUT=45
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
Create a Custom Menu Entry

Copy the menuentry for a line that starts with menuentry 'CentOS Linux (3.10...) /boot/grub2/grub.cfg and add it to /etc/grub.d/40_custom.

Once copied, remove the rhgb and quiet options from the kernel line and change the title to Verbose Output Enabled.

Create a Backup of the Configuration File

Use the cp command to create a backup of grub.cfg.

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bkp
Generate a New Configuration File with the Changes

Use the grub2-mkconfig command to generate a new grub.cfg file.

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

Additional Resources

One of the servers we administer has been having some issues during the boot process. The system ultimately boots but is missing some key functionality. Given these recurring issues, we have been tasked with creating a custom kernel entry in the GRUB configuration file to isolate and troubleshoot the issue.

First, we need to update the /etc/default/grub file with the following changes: the GRUB timeout should be set to 45 seconds, the GRUB default should be set to saved, and the GRUB save default should equal true.

Next, we need to add a custom menuentry to /etc/grub.d/40_custom using the menuentry for the 3.10.0-957.27.2.el7.x86_64 kernel as a base. Once the entry has been copied to 40_custom, the title should be updated to “Verbose Output Enabled” and the rhgb and quiet parameters on the kernel line should be removed.

Finally, we need to back up the existing grub.cfg in /boot/grub2/ and name it grub.cfg.bkp. Then we need to generate a new configuration file for grub.cfg with the changes we've made.

Note: All tasks should be performed as the root user.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?