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.
To view all available kernel entries that grubby knows about, run:
grubby --info=ALLThis 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-kernelThis shows the current default kernel path directly.
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-kernelTo 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_64After this, confirm the change with:
grubby --default-kernelEach kernel entry has an index number assigned to it. You can check the current default index with:
grubby --default-indexTo 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.
- 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.