Skip to content

Instantly share code, notes, and snippets.

@aont
Created September 13, 2025 11:14
Show Gist options
  • Select an option

  • Save aont/7214d95206e51bc371f707cd01014653 to your computer and use it in GitHub Desktop.

Select an option

Save aont/7214d95206e51bc371f707cd01014653 to your computer and use it in GitHub Desktop.

Managing Default Kernels with Grubby on Linux

When working with Linux systems that support multiple kernel versions, it’s often useful to manage which kernel is selected by default at boot. The grubby utility provides a convenient command-line interface for viewing available kernels, checking or changing the default kernel, and managing boot indexes. This article explains how to perform these operations step by step.


Checking the Kernel List

To view all available kernel entries that grubby knows about, run:

grubby --info=ALL

This will output detailed information about each installed kernel, including:

  • Kernel version and path
  • Initramfs path
  • Arguments (boot parameters)
  • Index numbers (used when selecting kernels)

For a simpler list of kernel paths, you can use:

grubby --default-kernel

This shows the current default kernel path directly.


Checking and Changing the Default Kernel

The default kernel is the one the system will boot into unless another is chosen at boot time. To check which kernel is currently set as default:

grubby --default-kernel

To change the default kernel to a specific version, specify its kernel image path. For example:

grubby --set-default /boot/vmlinuz-5.14.0-362.el9.x86_64

After this, confirm the change with:

grubby --default-kernel

Checking and Changing the Default Index

Each kernel entry has an index number assigned to it. You can check the current default index with:

grubby --default-index

To set the default kernel by index instead of by path, use:

grubby --set-default-index=1

(where 1 is the index of the kernel you want to boot by default).

This method is especially useful if you’ve already looked at the kernel list (--info=ALL) and want to quickly select based on the entry order.


Summary

  • Check kernel list: grubby --info=ALL
  • Check default kernel: grubby --default-kernel
  • Set default kernel: grubby --set-default /boot/vmlinuz-<version>
  • Check default index: grubby --default-index
  • Set default index: grubby --set-default-index=N

With these commands, you can easily manage multiple kernels on your system and control which one is selected at boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment