Change the Default Kernel on RHEL, Rocky Linux, AlmaLinux and Fedora

Use grubby on RHEL, Rocky Linux, AlmaLinux, CentOS Stream, Oracle Linux, and Fedora to check the running kernel, pick a persistent default, and verify the choice before reboot.

Published

Updated

Read time 10 min read

Reviewed byDeepak Prasad

Change the default boot kernel on RHEL-family Linux and Fedora with grubby

After a kernel update on RHEL, Rocky Linux, AlmaLinux, CentOS Stream, Oracle Linux, or Fedora, the newest build is commonly selected for the next boot. However, the running kernel and configured default may still differ. When a new kernel misbehaves, you need a safe way to point GRUB at an older build you already trust.

This guide uses grubby to inspect the running kernel, list boot entries, set a persistent default by kernel path, and verify the choice before you reboot. Current Fedora releases also use BLS-style kernel entries and provide grubby for inspecting and changing kernel defaults, although package versions and boot-menu behaviour can differ from enterprise Linux.

Tested on: Rocky Linux 10.2 (Red Quartz); kernel 6.12.0-211.16.1.el10_2.0.1.x86_64; grubby 8.40-83.el10.

IMPORTANT
This article covers selecting an installed kernel as the persistent default on RHEL-family systems and Fedora. It does not cover installing or compiling kernels, full GRUB administration, kernel parameter tuning, or removing old kernels. For cleanup after you settle on a working default, see remove old kernels with DNF or YUM. For older RHEL/CentOS 7 boot layouts and additional legacy GRUB methods, see set the default boot kernel on RHEL 7.

Check the Running and Default Kernel

The kernel in memory and the kernel GRUB will load on the next reboot are two different questions. Changing the default with grubby does not replace the running kernel—you need a reboot for that. After an update you have not rebooted into yet, uname -r and grubby --default-kernel often disagree, and that is normal.

Term Meaning
Running kernel Kernel currently loaded in memory
Default kernel Kernel configured for the next normal boot
Fallback kernel Older tested kernel retained for recovery
One-time selection Kernel chosen only for the next boot via grub2-reboot or the GRUB menu

Start with the kernel your session is using right now:

bash
uname -r

Sample output:

output
6.12.0-211.16.1.el10_2.0.1.x86_64

That is the build loaded in memory. Next, ask GRUB which kernel it will boot on a normal restart:

bash
grubby --default-kernel

Sample output:

output
/boot/vmlinuz-6.12.0-211.28.1.el10_2.x86_64

On this host the running kernel is older than the configured default—a typical post-update state where the new package is queued for the next boot but this session has not rebooted yet.

The default index is the position of that entry in the boot menu list. The newest kernel commonly appears at index 0, but do not assume that ordering without checking grubby --info=ALL:

bash
grubby --default-index

Sample output:

output
0

Index 0 here matches the newer vmlinuz path returned by --default-kernel. If you set a fallback kernel, expect this number to change.

For the human-readable menu title GRUB shows:

bash
grubby --default-title

Sample output:

output
Rocky Linux (6.12.0-211.28.1.el10_2.x86_64) 10.2 (Red Quartz)

The version string in parentheses should match the kernel release you intend to boot.


List Installed Kernels and Boot Entries

Before you change the default, confirm which kernel packages are on disk and which paths grubby knows about. A package can be installed while its boot entry is missing—or the other way around if cleanup was interrupted.

List installed kernel packages

On current RHEL-family releases, a kernel installation consists of several related packages, commonly including kernel, kernel-core, kernel-modules, and sometimes kernel-modules-core or kernel-modules-extra. Fedora package composition can differ by release, so treat the exact set as distribution-specific.

Query kernel and kernel-core to list the standard distribution kernel versions installed on current RHEL-family systems:

bash
rpm -q kernel kernel-core

Sample output:

output
kernel-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-6.12.0-211.28.1.el10_2.x86_64
kernel-core-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-core-6.12.0-211.28.1.el10_2.x86_64

On current RHEL-family releases, kernel-core contains the bootable kernel image while kernel is the associated install-only package. Fedora and alternative kernels may use different package names. Real-time, debug, vendor, or third-party kernels may require separate queries.

The version strings here should match the vmlinuz files under /boot. For a wider inventory that also lists tools and development packages, run:

bash
rpm -qa 'kernel*' | sort -V

Sample output:

output
kernel-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-6.12.0-211.28.1.el10_2.x86_64
kernel-core-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-core-6.12.0-211.28.1.el10_2.x86_64
kernel-modules-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-modules-6.12.0-211.28.1.el10_2.x86_64
kernel-modules-core-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-modules-core-6.12.0-211.28.1.el10_2.x86_64
kernel-modules-extra-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-tools-6.12.0-211.16.1.el10_2.0.1.x86_64
kernel-tools-libs-6.12.0-211.16.1.el10_2.0.1.x86_64

That output is useful for inventory, not as a list of bootable kernels—entries such as kernel-tools or kernel-devel are not boot menu targets. For broader RPM query patterns, see the linked guide when you need filters beyond kernel*.

List boot entries with grubby

grubby --info=ALL prints the boot entries known to the active bootloader configuration. You do not need every field on day one—focus on these:

  • index — menu position; can change when kernels are added or removed
  • kernel — path to the vmlinuz image; use this with --set-default
  • initrd — paired initramfs; must exist or boot fails
  • title — label shown in the GRUB menu
  • id — BLS entry identifier under /boot/loader/entries/
bash
grubby --info=ALL

Sample output:

output
index=0
kernel="/boot/vmlinuz-6.12.0-211.28.1.el10_2.x86_64"
args="ro resume=UUID=26765c90-fea0-4216-9293-9936cabf9135 rd.lvm.lv=rlm/root"
root="/dev/mapper/rlm-root"
initrd="/boot/initramfs-6.12.0-211.28.1.el10_2.x86_64.img"
title="Rocky Linux (6.12.0-211.28.1.el10_2.x86_64) 10.2 (Red Quartz)"
id="28a80846932844369fe693bfcdfb81bb-6.12.0-211.28.1.el10_2.x86_64"
index=1
kernel="/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"
...
index=2
kernel="/boot/vmlinuz-0-rescue-28a80846932844369fe693bfcdfb81bb"
...

Each block is one boot menu entry. Copy the kernel= path for --set-default or the id= value for grub2-reboot.

For a shorter list of kernel paths only:

bash
grubby --info=ALL | grep '^kernel='

Sample output:

output
kernel="/boot/vmlinuz-6.12.0-211.28.1.el10_2.x86_64"
kernel="/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"
kernel="/boot/vmlinuz-0-rescue-28a80846932844369fe693bfcdfb81bb"

The rescue entry is a recovery boot image created by the installation or kernel-install workflow. It is separate from the normal versioned kernel entries and may not match your newest installed kernel. Keep it unless you have verified another recovery method.

Inspect one entry in detail with --info and the full vmlinuz path:

bash
grubby --info="/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"

Sample output:

output
index=1
kernel="/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"
args="ro resume=UUID=26765c90-fea0-4216-9293-9936cabf9135 rd.lvm.lv=rlm/root"
root="/dev/mapper/rlm-root"
initrd="/boot/initramfs-6.12.0-211.16.1.el10_2.0.1.x86_64.img"
title="Rocky Linux (6.12.0-211.16.1.el10_2.0.1.x86_64) 10.2 (Red Quartz)"
id="28a80846932844369fe693bfcdfb81bb-6.12.0-211.16.1.el10_2.0.1.x86_64"

Confirm the initrd= path exists on disk before you set this entry as default.


Change the Default Kernel with grubby

Use the full /boot/vmlinuz-* path as the primary method. grubby updates the bootloader's saved default to reference the selected kernel entry. You do not need to edit /boot/grub2/grub.cfg or the BLS files under /boot/loader/entries/ manually.

Set an older kernel as default

Suppose the newest kernel misbehaves and you want the previous build to boot every time until you finish testing. Point grubby at the older vmlinuz path:

bash
sudo grubby --set-default "/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"

Sample output:

output
The default is /boot/loader/entries/28a80846932844369fe693bfcdfb81bb-6.12.0-211.16.1.el10_2.0.1.x86_64.conf with index 1 and kernel /boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64

The confirmation line names the BLS config file and the new index.

Switch back to the latest kernel

When you are ready to default to the newest build again, set the path for that vmlinuz:

bash
sudo grubby --set-default "/boot/vmlinuz-6.12.0-211.28.1.el10_2.x86_64"

Sample output:

output
The default is /boot/loader/entries/28a80846932844369fe693bfcdfb81bb-6.12.0-211.28.1.el10_2.x86_64.conf with index 0 and kernel /boot/vmlinuz-6.12.0-211.28.1.el10_2.x86_64

Index-based selection is an alternative when you already verified the menu order:

bash
sudo grubby --set-default-index=1

Prefer kernel paths over indexes. Installing or removing a kernel can reorder entries, so an index that pointed at your fallback yesterday may point somewhere else tomorrow. More grubby examples cover title-based lookups and kernel argument updates.


Verify the Kernel Before and After Reboot

Always confirm the default before you reboot—especially on production systems where console access may be limited.

After setting the default, read it back:

bash
grubby --default-kernel

Sample output:

output
/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64

The path should match the vmlinuz you passed to --set-default. Check the index as well:

bash
grubby --default-index

Sample output:

output
1

Cross-check the boot entry details:

bash
grubby --info="/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"

Sample output:

output
index=1
kernel="/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"
...
title="Rocky Linux (6.12.0-211.16.1.el10_2.0.1.x86_64) 10.2 (Red Quartz)"

Reboot when you are satisfied with the configured default and have console or out-of-band access if something goes wrong:

bash
sudo reboot

After the system comes back, confirm the active kernel:

bash
uname -r

Sample output:

output
6.12.0-211.16.1.el10_2.0.1.x86_64

That release string should match the kernel path you selected.

Mistake Fix
Assuming the running kernel is the default Check uname -r and grubby --default-kernel separately
Selecting by index only Prefer the full kernel path
Removing the previous kernel immediately Keep a tested fallback until the new default is verified
Expecting the kernel to change without reboot Reboot and verify with uname -r
Editing generated GRUB files directly Use grubby
Using Ubuntu commands on RHEL-family systems Keep the workflows in separate articles

Test an Older Kernel Before Making It Default

Before changing the persistent default, you can select an older kernel for the next boot only.

List the available entries and note the id, title, or index for the kernel you want to test:

bash
grubby --info=ALL

Sample output:

output
index=0
kernel="/boot/vmlinuz-6.12.0-211.28.1.el10_2.x86_64"
...
title="Rocky Linux (6.12.0-211.28.1.el10_2.x86_64) 10.2 (Red Quartz)"
id="28a80846932844369fe693bfcdfb81bb-6.12.0-211.28.1.el10_2.x86_64"
index=1
kernel="/boot/vmlinuz-6.12.0-211.16.1.el10_2.0.1.x86_64"
...
title="Rocky Linux (6.12.0-211.16.1.el10_2.0.1.x86_64) 10.2 (Red Quartz)"
id="28a80846932844369fe693bfcdfb81bb-6.12.0-211.16.1.el10_2.0.1.x86_64"

Pass the entry id, exact title, or a verified index to grub2-reboot. Prefer the id when you have it:

bash
sudo grub2-reboot "28a80846932844369fe693bfcdfb81bb-6.12.0-211.16.1.el10_2.0.1.x86_64"

grub2-reboot exits silently on success. Reboot to use the one-time selection:

bash
sudo reboot

After login, verify the running kernel:

bash
uname -r

The one-time selection does not change the persistent default:

bash
grubby --default-kernel

Sample output:

output
/boot/vmlinuz-6.12.0-211.28.1.el10_2.x86_64

The path still points at the persistent default, not the kernel you booted once with grub2-reboot.

Prefer an entry id or exact title over a numeric index—kernel installation or removal can change the index order. You can also select the required kernel manually from the GRUB menu during startup.


Common Problems and Fixes

Symptom Likely cause Fix
grubby: command not found grubby package not installed Run dnf install grubby (or yum install grubby on older hosts)
Kernel missing from grubby --info=ALL BLS entry not generated or broken install Reinstall the matching kernel package and verify the transaction recreates the BLS entry, vmlinuz, and initramfs. Use kernel-install manually only when following instructions for your distribution and release
Default changes but another kernel boots Manual edits to GRUB files, or firmware loading a different GRUB installation Re-run sudo grubby --set-default with the path; on RHEL 9/10-family systems regenerate /boot/grub2/grub.cfg for both BIOS and UEFI—do not overwrite the UEFI stub under /boot/efi/EFI/
Default index changes after update New kernel inserted at index 0 Re-check grubby --info=ALL; set default by path, not index
Boot fails with missing initramfs initrd path in BLS entry does not match disk Confirm /boot/initramfs-<version>.img exists; reinstall the matching kernel-core package for that NEVRA
Removed kernel still configured as default Default pointed at deleted vmlinuz Set default to an installed path with sudo grubby --set-default; see kernel-core update notes before removing packages
GRUB menu never appears GRUB_TIMEOUT=0 or hidden timeout style Adjust /etc/default/grub timeout settings; on RHEL 9/10-family systems run sudo grub2-mkconfig -o /boot/grub2/grub.cfg for both BIOS and UEFI—older releases and some Fedora versions may differ, so verify the documentation for the installed release first
grubby changes are ignored Firmware is loading another GRUB installation, another ESP, or a nonstandard bootloader Check the active UEFI boot entry and mounted EFI System Partition before modifying files

Best Practices

  • Keep at least one known-working fallback kernel installed until you have rebooted into and exercised the new default.
  • Test an older kernel with grub2-reboot or the GRUB menu once before you make it the persistent default.
  • Prefer sudo grubby --set-default with the full /boot/vmlinuz-* path over --set-default-index.
  • Run grubby --default-kernel and grubby --default-index immediately before sudo reboot on remote systems.
  • Do not remove the running kernel or the kernel currently set as default—DNF will block the running build, but you can still break the next boot if you delete the configured default.
  • Maintain console, IPMI, or snapshot access when changing boot defaults on production hosts.

Summary

On RHEL-family systems and Fedora, grubby is the supported way to read and set the default boot kernel. Check the running kernel with uname -r, check the next boot target with grubby --default-kernel, list entries with grubby --info=ALL, and set the persistent default with sudo grubby --set-default and the full vmlinuz path. Use sudo grub2-reboot when you need a one-time boot only. Reboot and confirm with uname -r before you remove older kernels or declare the change complete.

Official references: grubby(8), GRUB2 on Red Hat Enterprise Linux, and Fedora kernel package management.


Frequently Asked Questions

1. Does changing the default kernel take effect immediately?

No. grubby updates the bootloader default for the next normal boot. The kernel already loaded in memory stays active until you reboot. Check uname -r after reboot to confirm what actually booted.

2. Should I use grubby --set-default or --set-default-index?

Prefer --set-default with the full /boot/vmlinuz-* path. Index numbers can shift when kernels are installed or removed. Use --set-default-index only when you understand the current menu order.

3. Why does grubby --default-kernel differ from uname -r?

uname -r shows the running kernel. grubby --default-kernel shows what GRUB will load on the next reboot. They often differ right after a kernel update you have not rebooted into yet.

4. Does this guide apply to Ubuntu or Debian?

No. Ubuntu and Debian normally use GRUB_DEFAULT, grub-set-default, and update-grub rather than the grubby workflow covered here.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …