The grubby command in Linux is used to view and modify kernel boot entries managed by the GRUB2 bootloader. System administrators commonly use it to change the default kernel, list installed kernels, and add or remove kernel boot parameters without manually editing GRUB configuration files. The utility is primarily available on RHEL-based distributions such as RHEL, Rocky Linux, AlmaLinux, and Fedora.
grubby Command Quick Reference Cheat Sheet
| Task | Command |
|---|---|
| List all installed kernels | grubby --info=ALL |
| List kernel paths only | grubby --info=ALL | grep ^kernel |
| Display details of a specific kernel | grubby --info="/boot/vmlinuz-$(uname -r)" |
| Get the default kernel path | grubby --default-kernel |
| Get default kernel index | grubby --default-index |
| Display default kernel title | grubby --default-title |
| Set default kernel using path | grubby --set-default=/boot/vmlinuz-$(uname -r) |
| Set default kernel using index | grubby --set-default-index=1 |
| Add kernel argument to default kernel | grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="ipv6.disable=1" |
| Add kernel arguments to all kernels | grubby --update-kernel=ALL --args="console=ttyS0" |
| Remove kernel argument from default kernel | grubby --update-kernel=/boot/vmlinuz-$(uname -r) --remove-args="quiet" |
| Remove kernel argument from all kernels | grubby --update-kernel=ALL --remove-args="quiet" |
| Replace kernel arguments | grubby --update-kernel=/boot/vmlinuz-$(uname -r) --remove-args="quiet" --args="console=ttyS0" |
| Add a new kernel entry | grubby --add-kernel=/boot/vmlinuz-new --initrd=/boot/initramfs-new.img --title="Custom Kernel" |
| Copy arguments from default kernel | grubby --add-kernel=/boot/vmlinuz-new --initrd=/boot/initramfs-new.img --copy-default |
| Remove kernel entry | grubby --remove-kernel=/boot/vmlinuz-old |
| Set root device for kernel entry | grubby --update-kernel=/boot/vmlinuz-$(uname -r) --root=/dev/sda1 |
| Specify bootloader explicitly | grubby --grub2 --info=ALL |
| Display help for grubby | grubby --help |
Understanding grubby in Linux
grubby command syntax
The basic syntax of the grubby command is:
grubby [options]The command is used to manipulate bootloader-specific configuration files, primarily for systems that use the GRUB2 bootloader. It allows administrators to list kernel entries, modify boot parameters, change the default kernel, and add or remove kernel arguments.
Common syntax examples include:
grubby --info=ALL
grubby --default-kernel
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="kernel_args"What the grubby command does
The grubby utility is designed to manage kernel boot entries without manually editing GRUB configuration files.
It provides functionality such as:
- Listing installed kernel entries
- Viewing kernel boot parameters
- Changing the default kernel
- Adding or removing kernel boot arguments
- Adding or removing kernel entries
Instead of modifying files like /boot/grub2/grub.cfg directly, grubby updates the appropriate configuration files automatically.
How grubby works with GRUB2 bootloader
Modern Linux systems use the GRUB2 bootloader to manage kernel boot entries. Each installed kernel typically has its own configuration entry that contains:
- Kernel path
- Initial RAM disk (initrd)
- Kernel boot arguments
- Boot entry title
The grubby command modifies these entries safely by updating the boot configuration files associated with GRUB2.
This approach avoids manual editing of GRUB configuration files and reduces the risk of breaking the bootloader configuration.
Where kernel boot entries are stored
Kernel boot entries are stored in configuration files under the following directory:
/boot/loader/entries/Each file represents one kernel entry.
Example:
ls /boot/loader/entries/Example output:
d88fa2c7ff574ae782ec8c4288de4e85-4.18.0-193.el8.x86_64.conf
d88fa2c7ff574ae782ec8c4288de4e85-4.18.0-193.1.2.el8_2.x86_64.confThese files contain information about the kernel version, initramfs image, and kernel boot parameters.
Another important file used by GRUB2 is:
/boot/grub2/grubenvThis file stores environment variables such as kernelopts, which contain default kernel arguments.
Supported Linux distributions for grubby
The grubby command is primarily available on RHEL-based Linux distributions. It is commonly used in enterprise environments where GRUB2 is the default bootloader.
Supported distributions include:
- Red Hat Enterprise Linux (RHEL)
- Rocky Linux
- AlmaLinux
- CentOS Stream
- Fedora
Some Debian-based distributions do not include grubby by default because they manage boot entries differently.
List Installed Kernels
grubby list all kernels
To list all kernels configured in the bootloader, use:
grubby --info=ALLThis command displays detailed information about every kernel entry available in the system's boot configuration.
Example output:
index=0
kernel="/boot/vmlinuz-4.18.0-553.83.1.el8_10.x86_64"
args="ro console=tty0 console=ttyS0,115200n81 crashkernel=auto intremap=off edd=off nomodeset audit=1 audit_backlog_limit=8192"
root="UUID=22fdf631-6b15-4787-9143-1b7848c8e1b1"
initrd="/boot/initramfs-4.18.0-553.83.1.el8_10.x86_64.img"
title="Rocky Linux (4.18.0-553.83.1.el8_10.x86_64) 8.10 (Green Obsidian)"
id="f412309c04004990a89a8eed99f36e29-4.18.0-553.83.1.el8_10.x86_64"
index=1
kernel="/boot/vmlinuz-4.18.0-477.27.1.el8_8.x86_64"
args="ro console=tty0 console=ttyS0,115200n81 crashkernel=auto intremap=off edd=off nomodeset audit=1 audit_backlog_limit=8192"
root="UUID=22fdf631-6b15-4787-9143-1b7848c8e1b1"
initrd="/boot/initramfs-4.18.0-477.27.1.el8_8.x86_64.img"
title="Rocky Linux (4.18.0-477.27.1.el8_8.x86_64) 8.8 (Green Obsidian)"
id="f412309c04004990a89a8eed99f36e29-4.18.0-477.27.1.el8_8.x86_64"Each entry corresponds to a kernel available in the GRUB boot menu.
This command displays information such as:
- Kernel index
- Kernel path
- Kernel arguments
- Root device
- Initrd image
- Boot entry title
Identify installed kernel paths
If you only want to list the kernel paths, you can filter the output.
Example:
grubby --info=ALL | grep ^kernelExample output:
kernel="/boot/vmlinuz-4.18.0-425.el8.x86_64"
kernel="/boot/vmlinuz-4.18.0-372.el8.x86_64"These paths represent the kernel binaries used during system boot.
Compare grubby output with uname -r
You can compare the list of installed kernels with the currently running kernel.
First check the running kernel:
uname -rExample output:
4.18.0-425.el8.x86_64Then compare it with the kernels listed by grubby:
grubby --info=ALL | grep ^kernelThis helps verify whether the currently running kernel is the same as the default kernel configured for boot.
Get Information About Kernel Entries
grubby --info for specific kernel
You can display detailed information about a specific kernel entry using the --info option.
Example:
grubby --info="/boot/vmlinuz-$(uname -r)"Example output:
index=1
kernel="/boot/vmlinuz-4.18.0-425.el8.x86_64"
args="ro quiet rhgb"
root="/dev/mapper/rhel-root"
initrd="/boot/initramfs-4.18.0-425.el8.x86_64.img"
title="Red Hat Enterprise Linux (4.18.0-425.el8.x86_64)"This command is useful when you want to inspect the configuration of a specific kernel entry.
grubby --info=ALL explained
The --info=ALL option prints detailed information for every kernel entry available in the bootloader configuration.
Example:
grubby --info=ALLThis command displays details such as:
- Kernel index number
- Kernel path
- Boot arguments
- Root device
- Initrd image
- Boot title
This is helpful when identifying which kernel entry should be modified.
Understand kernel arguments in boot entries
Kernel arguments define how the Linux kernel behaves during boot.
These parameters may include options for:
- Debugging
- Hardware configuration
- Security settings
- Network configuration
Example kernel arguments:
quiet rhgb ipv6.disable=1 console=ttyS0You can view the arguments for a kernel using:
grubby --info="/boot/vmlinuz-$(uname -r)"These parameters can later be modified using the --args or --remove-args options.
Find Default Kernel
grubby --default-kernel
The default kernel is the kernel version that the system will boot into after a restart. You can check the path of the default kernel using the --default-kernel option.
grubby --default-kernelExample output:
/boot/vmlinuz-4.18.0-425.el8.x86_64This shows the kernel image that GRUB2 will use during the next system boot.
grubby --default-index
Each kernel entry in GRUB2 has an index number. You can retrieve the index of the default kernel using:
grubby --default-indexExample output:
1This means the kernel entry with index 1 is currently set as the default boot kernel.
To see the mapping between index and kernel path:
grubby --info=ALL | grep -E "^index|^kernel"grubby --default-title
You can also display the title of the default kernel entry shown in the GRUB boot menu.
grubby --default-titleExample output:
Red Hat Enterprise Linux (4.18.0-425.el8.x86_64)This title appears in the GRUB2 menu during system startup.
Verify default kernel before reboot
Before rebooting the system, it is recommended to verify the current default kernel.
Check the kernel configured for boot:
grubby --default-kernelCheck the currently running kernel:
uname -rIf the two values differ, the system will boot into a different kernel version after reboot.
Change Default Kernel
Set default kernel using kernel path
You can change the default kernel by specifying the kernel path using the --set-default option.
Example:
grubby --set-default=/boot/vmlinuz-4.18.0-372.el8.x86_64Example output:
The default is /boot/loader/entries/xxxxxxxx-4.18.0-372.el8.x86_64.confThis sets the specified kernel as the default boot entry.
Set default kernel using index number
Instead of providing the kernel path, you can also change the default kernel using the index number.
First list kernel entries with their indexes:
grubby --info=ALL | grep -E "^index|^kernel"Example output:
index=0
kernel="/boot/vmlinuz-4.18.0-425.el8.x86_64"
index=1
kernel="/boot/vmlinuz-4.18.0-372.el8.x86_64"Then set the default kernel using the index value:
grubby --set-default-index=1Verify default kernel change
After modifying the default kernel, confirm the change using:
grubby --default-kernelExample output:
/boot/vmlinuz-4.18.0-372.el8.x86_64This ensures the correct kernel will be used during the next reboot.
Add Kernel Arguments
grubby add args to default kernel
Kernel arguments allow you to control how the Linux kernel behaves during boot. You can add arguments to the default kernel using the --update-kernel option.
Example:
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="ipv6.disable=1"This command disables IPv6 by adding the ipv6.disable=1 parameter.
grubby --update-kernel with arguments
The --update-kernel option modifies an existing kernel entry.
Example:
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="console=ttyS0"This adds the console logging parameter to the kernel boot arguments.
You can verify the change using:
grubby --info="/boot/vmlinuz-$(uname -r)"Add kernel parameters to all kernels
If you want to apply a kernel parameter to all installed kernels, use ALL instead of specifying a kernel path.
Example:
grubby --update-kernel=ALL --args="audit=1"This command enables kernel auditing for all kernel entries.
Remove Kernel Arguments
grubby remove args from kernel
If a kernel argument is no longer required, it can be removed using the --remove-args option.
Example:
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --remove-args="ipv6.disable=1"This removes the previously added IPv6 disabling parameter.
Remove kernel parameters safely
Before removing kernel arguments, it is recommended to inspect the current kernel configuration.
Check existing kernel parameters:
grubby --info="/boot/vmlinuz-$(uname -r)"After confirming the parameters, remove them using --remove-args.
Example:
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --remove-args="quiet"Remove arguments from all kernels
To remove a kernel argument from every kernel entry, use the ALL option.
Example:
grubby --update-kernel=ALL --remove-args="quiet"This removes the quiet parameter from all installed kernel boot entries.
Update Kernel Boot Entry
grubby --update-kernel explained
The --update-kernel option is used to modify an existing kernel boot entry. It allows administrators to update kernel parameters without manually editing GRUB configuration files.
Example:
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="audit=1"This command updates the boot entry of the currently running kernel and adds the audit=1 parameter.
You can also apply updates to all kernels using:
grubby --update-kernel=ALL --args="audit=1"Modify existing kernel boot parameters
Kernel boot parameters define how the Linux kernel behaves during system startup. Using grubby, you can modify these parameters directly.
Example:
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="console=ttyS0"This adds the console=ttyS0 parameter to enable serial console logging.
To verify the modification:
grubby --info="/boot/vmlinuz-$(uname -r)"This command displays the updated kernel arguments.
Update kernel arguments without editing GRUB
Traditionally, kernel parameters were edited in GRUB configuration files such as:
/etc/default/grubHowever, editing these files requires rebuilding the GRUB configuration using commands like grub2-mkconfig.
The grubby utility simplifies this process by updating the boot entry configuration files directly, eliminating the need to regenerate the entire GRUB configuration.
Example:
grubby --update-kernel=ALL --remove-args="quiet"This removes the quiet parameter from all kernel entries without modifying GRUB configuration files manually.
Add New Kernel Entry
grubby add kernel entry
You can add a new kernel entry manually using the --add-kernel option. This is useful when testing custom kernels or adding manually compiled kernels.
Example:
grubby --add-kernel=/boot/vmlinuz-custom --initrd=/boot/initramfs-custom.img --title="Custom Kernel"This creates a new boot entry that will appear in the GRUB boot menu.
Copy arguments from existing kernel
If you want the new kernel entry to inherit parameters from the current default kernel, use the --copy-default option.
Example:
grubby --add-kernel=/boot/vmlinuz-custom --initrd=/boot/initramfs-custom.img --title="Custom Kernel" --copy-defaultThis copies all kernel arguments from the default kernel entry.
Add custom kernel boot entry
You can also specify custom kernel parameters when adding a new entry.
Example:
grubby --add-kernel=/boot/vmlinuz-custom --initrd=/boot/initramfs-custom.img --title="Debug Kernel" --args="console=ttyS0 debug"This creates a new boot entry with debugging parameters.
After creating the entry, verify it using:
grubby --info=ALLRemove Kernel Entry
grubby remove kernel entry
If a kernel entry is no longer required, it can be removed using the --remove-kernel option.
Example:
grubby --remove-kernel=/boot/vmlinuz-4.18.0-372.el8.x86_64This removes the specified kernel entry from the bootloader configuration.
Identify kernel before removal
Before removing a kernel entry, it is recommended to verify which kernels are installed.
Example:
grubby --info=ALL | grep ^kernelExample output:
kernel="/boot/vmlinuz-4.18.0-425.el8.x86_64"
kernel="/boot/vmlinuz-4.18.0-372.el8.x86_64"This helps ensure that the correct kernel entry is selected for removal.
Safely remove unused kernels
Removing unused kernels helps maintain a clean system and reduces boot menu clutter.
Example:
grubby --remove-kernel=/boot/vmlinuz-old-kernelAfter removal, verify the remaining kernel entries:
grubby --info=ALLAlways ensure that at least one working kernel remains installed to prevent boot failures.
grubby vs grub2-editenv
When to use grubby
The grubby command is used to modify kernel boot entries and kernel parameters. It is ideal for tasks such as:
- Changing the default kernel
- Adding or removing kernel arguments
- Viewing kernel boot entries
- Managing multiple kernel configurations
It directly updates kernel entry files used by GRUB2.
When to use grub2-editenv
The grub2-editenv command manages GRUB environment variables stored in the file:
/boot/grub2/grubenvThis tool is commonly used to:
- Set GRUB environment variables
- Modify saved boot entries
- Configure boot options dynamically
Example:
grub2-editenv listThis displays the environment variables stored in the GRUB environment file.
Differences in kernel configuration tools
Both tools interact with the GRUB bootloader but serve different purposes.
| Tool | Purpose |
|---|---|
grubby | Modify kernel boot entries and arguments |
grub2-editenv | Manage GRUB environment variables |
In most cases, administrators use grubby for kernel management and grub2-editenv for managing GRUB environment settings.
Frequently Asked Questions
1. What is the grubby command in Linux?
The grubby command is a Linux utility used to view and modify kernel boot entries and arguments in GRUB2 bootloader configuration.2. How do I list installed kernels using grubby?
You can list installed kernels using the command grubby --info=ALL which displays all kernel entries available in the bootloader configuration.3. How do I change the default kernel using grubby?
You can change the default kernel using grubby --set-default followed by the kernel path or by using grubby --set-default-index with the kernel index number.4. What Linux distributions support grubby?
The grubby utility is commonly available on RHEL, Rocky Linux, AlmaLinux, CentOS Stream, and Fedora systems that use GRUB2 bootloader.Summary
The grubby command is a powerful Linux utility used to manage kernel boot entries in systems that use the GRUB2 bootloader. It allows administrators to list installed kernels, view kernel configuration details, change the default boot kernel, and add or remove kernel boot parameters without manually editing GRUB configuration files.
In this guide, we explored practical scenarios such as listing installed kernels, retrieving kernel entry information, changing the default kernel, and modifying kernel boot arguments. Using grubby simplifies kernel management tasks and helps ensure boot configuration changes are applied safely across multiple kernel entries.
Understanding how to use grubby is particularly useful for system administrators working with RHEL-based distributions, where managing kernel parameters and boot entries is a common task during troubleshooting, performance tuning, and system maintenance.
Official Documentation
For a complete list of options and advanced usage details, refer to the official grubby manual page:





