grubby — quick reference
Query boot entries
List kernels and boot metadata stored under /boot/loader/entries/ (Boot Loader Spec on modern RHEL/Fedora).
| When to use | Command |
|---|---|
| Show every installed kernel entry | sudo grubby --info=ALL |
| Show only kernel paths | sudo grubby --info=ALL | grep ^kernel |
| Inspect one kernel (running or specific path) | sudo grubby --info="/boot/vmlinuz-$(uname -r)" |
| Print path of the default kernel | sudo grubby --default-kernel |
| Print numeric index of the default entry | sudo grubby --default-index |
| Print GRUB menu title of the default entry | sudo grubby --default-title |
Change default kernel
Pick which kernel boots after the next reboot — by path or by menu index.
| When to use | Command |
|---|---|
| Set default by kernel image path | sudo grubby --set-default=/boot/vmlinuz-VERSION |
Set default by entry index from --info=ALL |
sudo grubby --set-default-index=1 |
| Make a newly added entry the default | sudo grubby --add-kernel=... --make-default |
Kernel arguments
Add or remove boot parameters on one kernel or on every entry.
| When to use | Command |
|---|---|
| Add an argument to one kernel | sudo grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="ipv6.disable=1" |
| Add an argument to all kernels | sudo grubby --update-kernel=ALL --args="audit=1" |
| Remove an argument from one kernel | sudo grubby --update-kernel=/boot/vmlinuz-$(uname -r) --remove-args="quiet" |
| Remove an argument from all kernels | sudo grubby --update-kernel=ALL --remove-args="quiet" |
| Replace args in one step (remove then add) | sudo grubby --update-kernel=ALL --remove-args="quiet" --args="console=ttyS0" |
Add or remove entries
Manage individual BLS snippets — use care when removing kernels.
| When to use | Command |
|---|---|
| Add a custom kernel entry | sudo grubby --add-kernel=/boot/vmlinuz-NEW --initrd=/boot/initramfs-NEW.img --title="Custom Kernel" |
| Copy args from the current default into a new entry | sudo grubby --add-kernel=... --initrd=... --copy-default --title="Copy of default" |
| Remove a kernel boot entry | sudo grubby --remove-kernel=/boot/vmlinuz-OLD |
Bootloader mode and help
| When to use | Command |
|---|---|
| Force GRUB2/BLS mode (default on x86_64 RHEL/Fedora) | sudo grubby --grub2 --info=ALL |
| Show installed grubby version | grubby --version |
| Show brief usage | grubby --help |
grubby — command syntax
Synopsis from grubby(8) on RHEL 9 (Boot Loader Spec + GRUB2):
grubby [--add-kernel=kernel-path] [--args=args] [--copy-default]
[--default-kernel] [--default-index] [--default-title]
[--grub2] [--info=kernel-path] [--initrd=initrd-path]
[--make-default] [--remove-args=args] [--remove-kernel=kernel-path]
[--set-default=kernel-path] [--set-default-index=entry-index]
[--title=entry-title] [--update-kernel=kernel-path] [--version]grubby reads and writes files under /boot/loader/entries/ and may update GRUB_CMDLINE_LINUX in /etc/default/grub when you pass --update-kernel=ALL. You cannot combine --set-default and --set-default-index in one run.
grubby — command examples
Essential List every kernel entry and its boot args
Before changing the default kernel or adding boot parameters, list what GRUB knows about. Each block shows index, kernel path, args, root, initrd, and title.
Run the command:
sudo grubby --info=ALLSample 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 audit=1"
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)"
index=1
kernel="/boot/vmlinuz-4.18.0-477.27.1.el8_8.x86_64"
args="ro console=tty0 console=ttyS0,115200n81 crashkernel=auto audit=1"
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)"Compare the running kernel with what is configured for the next boot:
uname -r
sudo grubby --default-kernelSample output:
4.18.0-553.83.1.el8_10.x86_64
/boot/vmlinuz-4.18.0-553.83.1.el8_10.x86_64If the version strings differ, the system will boot a different kernel after reboot.
Essential Check which kernel boots by default
Use three read-only queries when you need the path, menu index, or human-readable title of the default entry.
Run the commands:
sudo grubby --default-kernel
sudo grubby --default-index
sudo grubby --default-titleSample output:
/boot/vmlinuz-4.18.0-425.el8.x86_64
1
Red Hat Enterprise Linux (4.18.0-425.el8.x86_64)The index matches the index= lines from grubby --info=ALL. Use it when you prefer numbers over long kernel paths.
Essential Set default kernel by vmlinuz path
After installing an older kernel for rollback testing, point the default boot entry at that image.
Run the command (replace the version with one from grubby --info=ALL):
sudo grubby --set-default=/boot/vmlinuz-4.18.0-372.el8.x86_64Sample output:
The default is /boot/loader/entries/xxxxxxxx-4.18.0-372.el8.x86_64.confConfirm before rebooting:
sudo grubby --default-kernelSample output:
/boot/vmlinuz-4.18.0-372.el8.x86_64Common Set default kernel by menu index
When several kernels share similar paths, pick the default by index from grubby --info=ALL.
Run the command:
sudo grubby --set-default-index=1Verify:
sudo grubby --default-index
sudo grubby --default-kernelSample output:
1
/boot/vmlinuz-4.18.0-372.el8.x86_64Do not run --set-default and --set-default-index in the same command — grubby rejects that combination.
Common Add a kernel boot parameter
Disable IPv6 on the running kernel entry without editing files by hand — common for troubleshooting network stacks.
Run the command:
sudo grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="ipv6.disable=1"Check that the argument landed on the entry:
sudo grubby --info="/boot/vmlinuz-$(uname -r)" | grep ^argsSample output:
args="ro quiet rhgb ipv6.disable=1"Reboot (or kexec) for the new parameter to take effect on the running kernel.
Common Apply a boot parameter to every kernel
Enable auditing on all installed kernels — useful when a compliance baseline requires audit=1 everywhere.
Run the command:
sudo grubby --update-kernel=ALL --args="audit=1"On GRUB2 systems this may also refresh GRUB_CMDLINE_LINUX in /etc/default/grub. Spot-check one entry:
sudo grubby --info=ALL | grep -E '^index|^args'Sample output:
index=0
args="ro console=tty0 crashkernel=auto audit=1"
index=1
args="ro console=tty0 crashkernel=auto audit=1"Common Remove a kernel boot parameter
Remove quiet from the default kernel when you need full boot messages on the console.
Run the command:
sudo grubby --update-kernel=/boot/vmlinuz-$(uname -r) --remove-args="quiet"Verify:
sudo grubby --info="/boot/vmlinuz-$(uname -r)"Sample output:
index=1
kernel="/boot/vmlinuz-4.18.0-425.el8.x86_64"
args="ro 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)"Advanced Add a custom kernel boot entry
Register a manually built kernel so it appears in the GRUB menu — copy args from the current default so root and crashkernel settings stay consistent.
Run the command:
sudo grubby --add-kernel=/boot/vmlinuz-custom \
--initrd=/boot/initramfs-custom.img \
--title="Custom debug kernel" \
--copy-default --make-defaultList entries to confirm the new line:
sudo grubby --info=ALL | grep -E '^index|^kernel|^title'Sample output:
index=0
kernel="/boot/vmlinuz-custom"
title="Custom debug kernel"
index=1
kernel="/boot/vmlinuz-4.18.0-425.el8.x86_64"
title="Red Hat Enterprise Linux (4.18.0-425.el8.x86_64)"Advanced Remove an unused kernel entry
Clean up old kernel snippets after you confirmed another entry boots cleanly. Never remove the only working kernel.
Run the command (path must match --info=ALL):
sudo grubby --remove-kernel=/boot/vmlinuz-4.18.0-372.el8.x86_64Verify at least one entry remains:
sudo grubby --info=ALL | grep ^kernelSample output:
kernel="/boot/vmlinuz-4.18.0-425.el8.x86_64"Pair removal with dnf remove kernel-OLD or package-cleanup so the vmlinuz file is gone from disk too.
grubby — when to use / when not
| Use grubby when | Use something else when |
|---|---|
|
|
grubby vs grub2-editenv
| grubby | grub2-editenv | |
|---|---|---|
| Purpose | Edit kernel entries and boot args in BLS snippets | Read/write GRUB environment variables in /boot/grub2/grubenv |
| Typical task | Set default kernel, add ipv6.disable=1 |
Inspect saved_entry or kernelopts |
| Scope | Per-kernel entry files | Single environment block |
Both tools touch GRUB configuration but at different layers. Admins use grubby for kernel lifecycle work; grub2-editenv for one-off environment overrides.
Related commands
Kernel and boot-loader workflow on enterprise Linux.
| Command | One line |
|---|---|
| grubby | List and edit GRUB2 boot entries (this page) |
| dnf | Install and remove kernel packages |
| rpm | Query installed kernel RPMs |
| uname | Show running kernel release (uname -r) |
Browse the full index in our Linux commands reference.
grubby — interview corner
What is the grubby command used for?
On RHEL-family systems, grubby is the supported CLI for GRUB2 boot entries. It reads and writes Boot Loader Spec files under /boot/loader/entries/ — each file describes one kernel (vmlinuz path, initrd, cmdline args, title).
Admins use it to:
- List installed kernels (
--info=ALL) - Change the default boot kernel (
--set-defaultor--set-default-index) - Add or remove kernel parameters (
--update-kernelwith--args/--remove-args)
It is meant for scripts (kernel install hooks, kickstart) more than daily interactive editing. Ubuntu and Debian do not ship it.
A strong answer is:
"grubby manages GRUB2 boot entries on RHEL and Fedora — list kernels, set the default, and add or remove kernel args without manually editing grub.cfg. It works on BLS files under /boot/loader/entries/."
What is the difference between --set-default and --set-default-index?
Both pick the kernel that boots next, but they identify the entry differently:
| Option | You specify | Good when |
|---|---|---|
--set-default=/boot/vmlinuz-VERSION |
Full vmlinuz path | You know the exact package version string |
--set-default-index=N |
Integer from index= in --info=ALL |
Several entries look similar or paths are long |
They are mutually exclusive — grubby errors if you pass both in one invocation. After either command, confirm with grubby --default-kernel before rebooting.
A strong answer is:
"set-default takes a kernel path; set-default-index takes the numeric index from grubby --info=ALL. I verify with --default-kernel, and I never combine both flags in one command."
What does grubby --update-kernel=ALL do?
--update-kernel=ALL applies --args or --remove-args to every boot entry grubby knows about — not just the default.
On GRUB2 systems it can also sync GRUB_CMDLINE_LINUX in /etc/default/grub so future kernel installs inherit the same cmdline (unless --no-etc-grub-update is set).
Example — enable auditing everywhere:
sudo grubby --update-kernel=ALL --args="audit=1"Use ALL when a baseline must apply to every installed kernel (compliance, serial console, disabling IPv6). Use a specific vmlinuz path when only one entry needs a test parameter.
A strong answer is:
"update-kernel=ALL changes kernel args on every BLS entry and may update GRUB_CMDLINE_LINUX in /etc/default/grub. I use it for fleet-wide cmdline baselines; for one-off tests I target a single vmlinuz path."
Where does grubby store boot entry configuration?
Modern RHEL 8+ and Fedora use the Boot Loader Spec (BLS). Each kernel gets a .conf file in:
/boot/loader/entries/Example filenames look like d88fa2c7ff574ae782ec8c4288de4e85-4.18.0-193.el8.x86_64.conf. grubby edits these snippets; GRUB reads them at boot. Environment overrides may still live in /boot/grub2/grubenv.
Listing the directory shows raw files; grubby --info=ALL prints the parsed view admins actually use.
A strong answer is:
"On current RHEL/Fedora, boot entries live as BLS config files in /boot/loader/entries/. grubby modifies those; I list them with grubby --info=ALL rather than editing by hand."
When would you use grub2-editenv instead of grubby?
grubby changes per-kernel entry files (default kernel, args on each vmlinuz). grub2-editenv reads/writes the GRUB environment block — variables like saved_entry or kernelopts in /boot/grub2/grubenv.
Reach for grub2-editenv when you need to inspect or set environment state:
sudo grub2-editenv listUse grubby for kernel package lifecycle: new kernel installed, change default, add crashkernel= or console=ttyS0 across entries.
A strong answer is:
"grubby edits individual kernel BLS entries and default kernel selection; grub2-editenv manages the grubenv variable block. For kernel args and defaults I use grubby; for saved_entry-style overrides I use grub2-editenv."
Troubleshooting
| Symptom | Likely cause | What to try |
|---|---|---|
grubby: command not found |
Host is not RHEL/Fedora family, or minimal image without grubby RPM |
Install grubby on RHEL/Fedora; on Ubuntu use update-grub workflow instead |
--set-default reports no matching entry |
Kernel path typo or kernel RPM already removed | Run grubby --info=ALL; match the exact kernel="..." path |
| New kernel arg missing after reboot | Updated wrong entry or arg overridden in /etc/default/grub |
grubby --info on the default kernel; check GRUB_CMDLINE_LINUX |
--set-default and --set-default-index error |
Both options in one command | Run only one setter per invocation |
| System boots old kernel after update | Default not switched; new entry not --make-default |
grubby --default-kernel vs uname -r; set default explicitly |

