grubby
Manage GRUB2 bootloader configuration
TLDR
Add kernel boot arguments to all kernel menu entries
Remove existing arguments from the entry for the default kernel
List all kernel menu entries
SYNOPSIS
grubby [OPTIONS]
grubby --add-kernel=PATH [OPTIONS]
grubby --update-kernel=PATH [OPTIONS]
grubby --set-default=INDEX|PATH
grubby --info=INDEX|PATH
grubby [--default-index | --next-index]
PARAMETERS
--add-kernel=PATH
Adds a new kernel entry to the boot configuration based on the specified kernel image path.
--update-kernel=PATH
Updates an existing kernel entry identified by its path, modifying its associated arguments.
--remove-kernel=PATH
Removes a specified kernel entry from the boot configuration.
--set-default=INDEX|PATH
Sets the default boot entry for the next boot, using either its numerical index or the kernel image path.
--info=INDEX|PATH
Displays detailed information about a specific boot entry, including its kernel path and arguments.
--args=ARGS
Adds specified arguments to the kernel command line for the entry being operated upon.
--remove-args=ARGS
Removes specified arguments from the kernel command line for the entry being operated upon.
--make-default
Makes the newly added or updated kernel entry the default boot entry.
--copy-default
Copies kernel arguments from the current default boot entry to a newly added or updated entry.
--default-index
Prints the numerical index of the currently configured default boot entry.
--next-index
Prints the numerical index that the next new kernel entry would occupy in the boot menu.
--bootloader-version
Displays the detected GRUB bootloader version that grubby is interacting with.
--config-file=PATH
Specifies an alternative grubby configuration file to use instead of the default.
--grub-config=PATH
Specifies an alternative GRUB 2 main configuration file (e.g., /boot/grub2/grub.cfg) for operations.
--quiet
Suppresses informational and warning output, showing only critical error messages.
--debug
Enables verbose debug output, useful for troubleshooting issues with grubby operations.
--version
Displays the grubby utility's version information and exits.
DESCRIPTION
grubby is a command-line tool designed to query and update the GRUB 2 bootloader configuration. It provides a safer and more automated way to manage boot entries, especially for kernel installations and removals, than directly editing grub.cfg. System administrators and package management tools often use grubby to ensure that new kernel versions are correctly added to the boot menu and old ones are cleaned up. It abstracts away the complexities of GRUB 2's configuration files, allowing for programmatic manipulation of boot entries, default kernel selection, and modification of kernel command-line arguments. This is particularly useful in environments where automated updates are critical. It typically works by maintaining a configuration or database that GRUB then uses to generate its grub.cfg.
CAVEATS
grubby primarily manages entries within GRUB 2. While it abstracts grub.cfg, direct manual edits to grub.cfg or grubenv can lead to inconsistencies or be overwritten by grubby or other system tools during updates. It is often specific to Red Hat-based distributions and might not be present or behave identically on other Linux families (e.g., Debian/Ubuntu, Arch). Using it incorrectly can lead to unbootable systems, so caution is advised.
CONFIGURATION FILES
grubby works by managing boot entries that are then reflected in the main GRUB 2 configuration file, typically /boot/grub2/grub.cfg. It might also interact with grubenv for default boot entry persistence. Unlike direct grub.cfg editing, grubby often uses a more robust internal mechanism or specific files (e.g., in /etc/grub.d/ or within /boot/grub2/) to ensure changes are properly integrated and persistent across grub2-mkconfig runs.
INTEGRATION WITH PACKAGE MANAGERS
One of grubby's primary uses is its integration with package management systems such as DNF or YUM. When new kernel packages are installed or old ones removed, scripts triggered by the package manager invoke grubby to automatically add or remove the corresponding boot entries, ensuring the boot menu is always up-to-date without manual intervention.
HISTORY
grubby emerged as a utility on Red Hat-based Linux distributions (like Fedora, RHEL, CentOS) to simplify and automate the management of GRUB 2 boot entries. Before tools like grubby, maintaining boot configurations, especially after kernel updates, often involved manual editing of complex GRUB configuration files, which was error-prone. grubby provides a high-level abstraction, allowing package managers (like dnf or yum) to seamlessly integrate kernel installations and removals into the boot process without human intervention. Its development was driven by the need for robust and automated bootloader management in enterprise and frequently updated desktop environments.