16.3 Modify the System Bootloader

Key Takeaways

  • RHEL uses GRUB2; prefer grubby for kernel argument and default-kernel changes, and understand /etc/default/grub plus grub2-mkconfig for regenerating grub.cfg.
  • Persistent kernel parameters belong in bootloader config (grubby --update-kernel=ALL --args=… or GRUB_CMDLINE_LINUX in /etc/default/grub then grub2-mkconfig)—not only a one-boot GRUB edit.
  • Know where grub.cfg lives (BIOS vs UEFI paths), how to list kernels with grubby --info=ALL, and how to set a default kernel index or path.
  • After modifying bootloader config, reboot to prove the kernel command line (cat /proc/cmdline) matches the requirement.
  • Coordinate with recovery skills (Ch8): one-boot edits help repair; deploy tasks need lasting bootloader changes.
Last updated: August 2026

16.3 Modify the System Bootloader

Quick Answer: List kernels with grubby --info=ALL. Add persistent kernel args with sudo grubby --update-kernel=ALL --args="quiet foo=bar" (and --remove-args= to drop). Set default kernel with grubby --set-default. Alternatively edit /etc/default/grub (GRUB_CMDLINE_LINUX) and run grub2-mkconfig -o …/grub.cfg. Prove after reboot with cat /proc/cmdline.

Why bootloader modification is a deploy skill

Operate chapters taught booting, targets, and interrupting GRUB once for recovery. This objective is modify the system bootloader so changes stick:

  • Add or remove kernel command-line parameters (e.g. console=, systemd.unit=, vendor-required args, removing rhgb/quiet for noisier boot).
  • Change which kernel is default after installs/updates.
  • Ensure configuration is correct on BIOS or UEFI layout used by the VM.

Typical wording: “Persistently configure the bootloader so the kernel boots with parameter X,” or “Set the default boot kernel to ….”

GRUB2 on RHEL: mental model

PieceRole
Firmware (BIOS/UEFI)Loads GRUB
GRUB menu / grub.cfgEntries for kernels/initramfs
Kernel cmdlineParameters passed to the kernel/systemd
/etc/default/grubHuman-edited defaults used when regenerating config
grubbyRed Hat-friendly tool to edit kernel entries/args
BLS / boot entriesUEFI boot variables (related, not always the exam focus)

Generated config paths (know both):

Firmware styleCommon grub.cfg path
BIOS (legacy)/boot/grub2/grub.cfg
UEFI/boot/efi/EFI/redhat/grub.cfg
# Discover what this system uses
ls /sys/firmware/efi 2>/dev/null && echo UEFI || echo BIOS-or-no-efi-sysfs
ls -l /boot/grub2/grub.cfg /boot/efi/EFI/redhat/grub.cfg 2>/dev/null

Never hand-edit grub.cfg as your first choice—it is generated and package updates may overwrite careless edits. Prefer grubby or /etc/default/grub + grub2-mkconfig.

grubby: preferred RHEL interface

Inventory

sudo grubby --info=ALL
sudo grubby --default-kernel
sudo grubby --default-index
sudo grubby --info=$(sudo grubby --default-kernel)
uname -r
cat /proc/cmdline

Each boot entry has an index, kernel path, args, initrd, etc.

Add or remove kernel arguments (persistent)

# Add args to ALL installed kernels (common exam pattern)
sudo grubby --update-kernel=ALL --args="console=ttyS0,115200"

# Add to the running/default kernel only
sudo grubby --update-kernel=DEFAULT --args="systemd.unit=multi-user.target"

# Add to one specific kernel file
sudo grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="foo=bar"

# Remove args
sudo grubby --update-kernel=ALL --remove-args="rhgb quiet"
# Verify grubby view
sudo grubby --info=DEFAULT | grep -E 'args|kernel'

After reboot:

cat /proc/cmdline
# must contain the new tokens; removed tokens must be gone

ALL vs DEFAULT: If the task says every kernel or you just installed updates, --update-kernel=ALL avoids “works only on the old default.” If only current matters, DEFAULT may be enough—read the task.

Change default kernel

sudo grubby --info=ALL | grep -E '^index=|^kernel='
# Set by kernel path:
sudo grubby --set-default /boot/vmlinuz-5.x.x-x.el10.x86_64
# or by index:
sudo grubby --set-default-index=0
sudo grubby --default-kernel

Kernel RPMs install new vmlinuz-* under /boot; default may stay on the newest depending on install scripts—explicitly set default when the task names a version.

/etc/default/grub and grub2-mkconfig

Classic durable pattern:

sudo cp -a /etc/default/grub /etc/default/grub.bak
sudo vim /etc/default/grub

Important variables:

VariableMeaning
GRUB_TIMEOUTMenu timeout seconds
GRUB_DEFAULTDefault menu entry (saved/index)
GRUB_CMDLINE_LINUXKernel args applied when config is generated
GRUB_CMDLINE_LINUX_DEFAULTSometimes used for non-recovery style entries (distro-dependent; on RHEL focus on GRUB_CMDLINE_LINUX)
GRUB_DISABLE_SUBMENUMenu layout

Example:

# Ensure a parameter is in GRUB_CMDLINE_LINUX="... existing ... audit=1"
grep GRUB_CMDLINE_LINUX /etc/default/grub

Regenerate config:

# BIOS-style path
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

# UEFI-style path (RHEL)
sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

On many RHEL systems a convenience wrapper exists:

sudo grub2-mkconfig -o $(readlink -e /etc/grub2.cfg 2>/dev/null || readlink -e /etc/grub2-efi.cfg 2>/dev/null)
# or follow Red Hat docs for the platform:
# BIOS:  grub2-mkconfig -o /boot/grub2/grub.cfg
# UEFI:  grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
ls -l /etc/grub2.cfg /etc/grub2-efi.cfg 2>/dev/null

Mismatch trap: Running grub2-mkconfig to the BIOS path on a UEFI VM (or the reverse) updates a file firmware does not use—boot looks unchanged. Detect EFI vs BIOS first, write the correct output path.

grubby vs grub2-mkconfig together

  • grubby edits BLS/bootloader entries and is the least error-prone for args and default kernel on modern RHEL.
  • /etc/default/grub + grub2-mkconfig is the traditional regeneration path; still required knowledge when tasks mention those files.

If you use both, avoid fighting yourself: after heavy grubby use, understand that regenerating from /etc/default/grub re-applies GRUB_CMDLINE_LINUX to entries—keep that file consistent with desired args.

One-boot GRUB edit vs persistent change

MethodPersistent?Use
Edit menu entry once (e key)NoRecovery, Ch8
grubby --args / --remove-argsYesEX200 deploy
GRUB_CMDLINE_LINUX + grub2-mkconfigYesEX200 deploy
systemd.unit= only on one bootNoTemporary target

If the grader reboots twice, only persistent methods pass “configure the bootloader.”

Password and menu aesthetics (light touch)

EX200 focuses less on GRUB passwords than on cmdline and defaults. Still know:

grep GRUB_TIMEOUT /etc/default/grub
# change timeout, then grub2-mkconfig to the correct grub.cfg

Do not set a GRUB password unless asked—you can lock recovery paths.

Kernel install interaction

sudo dnf install -y kernel    # may add a new entry
sudo grubby --info=ALL
sudo grubby --default-kernel

After kernel updates, confirm default and args still meet the task. Re-apply --update-kernel=ALL --args=… if a new kernel lacks required parameters.

Verification checklist

# 1) Before reboot
sudo grubby --info=DEFAULT
grep GRUB_CMDLINE_LINUX /etc/default/grub

# 2) Reboot
sudo systemctl reboot

# 3) After login
uname -r
cat /proc/cmdline
sudo grubby --default-kernel

Optional:

journalctl -b -0 | head
# confirm system came up with expected console/target behavior

Exam workflows

Workflow A — Persist a kernel parameter with grubby

sudo grubby --update-kernel=ALL --args="audit=1"
sudo grubby --info=DEFAULT | grep args
sudo systemctl reboot
# cat /proc/cmdline | grep audit=1

Workflow B — Remove quiet boot noise

sudo grubby --update-kernel=ALL --remove-args="rhgb quiet"
sudo systemctl reboot
cat /proc/cmdline

Workflow C — /etc/default/grub path

sudo vi /etc/default/grub   # add token inside GRUB_CMDLINE_LINUX="..."
# UEFI example:
sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
# BIOS example:
# sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo systemctl reboot
cat /proc/cmdline

Workflow D — Set default kernel to a specific version

ls /boot/vmlinuz-*
sudo grubby --set-default /boot/vmlinuz-WANTEDVERSION
sudo grubby --default-kernel
sudo systemctl reboot
uname -r   # expect WANTEDVERSION

Workflow E — Confirm firmware path before mkconfig

if [ -d /sys/firmware/efi ]; then
  sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
else
  sudo grub2-mkconfig -o /boot/grub2/grub.cfg
fi

Common traps

  1. Only editing GRUB once at the menu—lost on next reboot.
  2. grub2-mkconfig to the wrong path (BIOS vs UEFI).
  3. Hand-editing only grub.cfg without updating /etc/default/grub or using grubby—fragile.
  4. Adding args to one old kernel while the system boots a newer default without those args.
  5. Typos in cmdline (audit = 1 with spaces may not mean what you want)—use key=value forms cleanly.
  6. Forgetting reboot verification via /proc/cmdline.
  7. Confusing systemctl set-default (target) with bootloader default kernel.
  8. Removing critical args that break console or root device (rare on VMs but possible).
  9. Assuming grubby alone updated /etc/default/grub—keep mental model clear; verify with grubby --info and /proc/cmdline.
  10. Kernel update overwriting expectations—re-check defaults after dnf upgrade.

Relationship to other chapters

  • Ch8 operate-boot: one-shot GRUB edits and rescue; this section owns persistence.
  • 15.3 default target: prefer systemctl set-default for multi-user/graphical; bootloader systemd.unit= is alternate/one-boot style unless task says bootloader parameter.
  • 16.2 software updates: new kernels → grubby defaults/args.
  • Storage/root: cmdline root= and rd.lvm settings are advanced; do not invent unless repairing a known lab breakage.

Section checkpoint

You should inventory entries with grubby --info=ALL, persistently add/remove kernel args, set the default kernel, edit /etc/default/grub and regenerate the correct grub.cfg with grub2-mkconfig, distinguish BIOS vs UEFI paths, avoid relying on one-boot menu edits for deploy tasks, and verify with cat /proc/cmdline after reboot. That is the EX200 standard for modifying the system bootloader on RHEL 10.

Test Your Knowledge

Which approach best adds a persistent kernel command-line parameter to all installed kernels on RHEL?

A
B
C
D
Test Your Knowledge

After a supposed bootloader change, which file best shows the kernel arguments used for the running system?

A
B
C
D
Test Your Knowledge

You are on a UEFI RHEL system and regenerate GRUB configuration. Which output path is the usual Red Hat UEFI location?

A
B
C
D
Test Your Knowledge

Which command identifies the current default kernel path as managed by grubby?

A
B
C
D