Skip to content
Alexander Holbreich
Field Notes

GRUB cheat sheet

Table of Contents

Open Table of Contents

What GRUB does

When a machine starts, firmware runs first. On old systems that means BIOS. On modern machines it usually means UEFI. The firmware finds something bootable and then hands over to a bootloader.

On many Linux installations that bootloader is GRUB 2. GRUB knows how to show a menu, load a kernel, load an initramfs, pass kernel arguments and then start Linux.

The usual boot chain looks roughly like this:

Firmware / UEFI
  -> GRUB
  -> Linux kernel + initramfs
  -> systemd / userspace

In day-to-day usage I do not want to touch GRUB often. But when a kernel update, dual boot setup, NVIDIA driver, encrypted disk or Fedora upgrade goes wrong, these commands are good to have nearby.

First: BIOS or UEFI?

Check how the current system was booted:

if [ -d /sys/firmware/efi ]; then
  echo "UEFI boot"
else
  echo "Legacy BIOS boot"
fi

Useful UEFI inspection commands:

bootctl status
bootctl list
efibootmgr -v

bootctl is not only for systemd-boot. It can also show useful information about EFI boot entries and Boot Loader Specification entries.

Important files and directories

Common GRUB locations on Fedora-like systems:

/etc/default/grub             user-editable GRUB defaults
/etc/grub.d/                  scripts used by grub2-mkconfig
/boot/grub2/grub.cfg          generated GRUB config
/boot/grub2/grubenv           GRUB environment block
/boot/loader/entries/*.conf   Boot Loader Specification entries
/boot/efi/EFI/fedora/         Fedora EFI loader files on UEFI systems

Do not hand-edit generated files like:

/boot/grub2/grub.cfg
/etc/grub2.cfg
/etc/grub2-efi.cfg

Change /etc/default/grub, use grubby, or edit the correct BLS/kernel entry workflow instead.

To see where Fedora’s helper symlinks point:

readlink -f /etc/grub2.cfg 2>/dev/null
readlink -f /etc/grub2-efi.cfg 2>/dev/null

Fedora in 2026: BLS matters

Fedora uses Boot Loader Specification style entries by default. That means kernel boot entries live as small files under:

/boot/loader/entries/

A typical entry contains fields like:

title Fedora Linux (...)
version ...
linux /vmlinuz-...
initrd /initramfs-...
options root=... rhgb quiet

Because of this, on Fedora I usually reach for grubby when changing kernel arguments or default kernels. It knows about BLS entries.

Useful inspection:

sudo grubby --info=ALL
sudo grubby --default-kernel
sudo grubby --default-title
sudo grubby --default-index

List BLS entries directly:

ls -1 /boot/loader/entries/
bootctl list

Regenerate GRUB config

First generate to stdout and look for obvious errors:

sudo grub2-mkconfig

Then write the config.

On many Fedora systems this is enough:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

If you prefer using the Fedora symlink for your boot mode:

# Legacy BIOS style helper
sudo grub2-mkconfig -o /etc/grub2.cfg

# UEFI style helper
sudo grub2-mkconfig -o /etc/grub2-efi.cfg

Before doing this on an unfamiliar machine, check where those files point:

readlink -f /etc/grub2.cfg /etc/grub2-efi.cfg 2>/dev/null

My rule: regenerate GRUB only when I know why. Kernel installation usually updates boot entries automatically.

Show GRUB menu entries

Old-school way from generated GRUB config:

sudo awk -F\' '$1=="menuentry " {print $2}' /boot/grub2/grub.cfg

BLS-aware Fedora way:

sudo grubby --info=ALL
bootctl list

GRUB environment:

sudo grub2-editenv - list

The - means the default GRUB environment file, usually /boot/grub2/grubenv.

Set the default boot entry

With Fedora/BLS, I prefer grubby:

sudo grubby --default-kernel
sudo grubby --info=ALL
sudo grubby --set-default /boot/vmlinuz-<version>

Example:

sudo grubby --set-default /boot/vmlinuz-6.14.0-300.fc42.x86_64

You can also use an index:

sudo grubby --set-default-index=0

GRUB’s own command also works, but remember the requirement: /etc/default/grub should contain GRUB_DEFAULT=saved.

sudo grub2-set-default "Fedora Linux (...)"
sudo grub2-editenv - list

Boot something once

For a one-time boot into another entry:

sudo grub2-reboot "Fedora Linux (...)"
sudo reboot

Again, this depends on GRUB being able to write the environment block. On exotic storage layouts like some RAID/LVM setups this can be surprising, so check afterwards:

sudo grub2-editenv - list

With systemd tooling, if supported by your boot setup:

bootctl set-oneshot <entry-id>
systemctl reboot

Kernel arguments with grubby

Show current arguments:

sudo grubby --info=ALL

Add arguments to all current kernel entries:

sudo grubby --update-kernel=ALL --args="quiet splash"

Remove arguments from all current kernel entries:

sudo grubby --update-kernel=ALL --remove-args="rhgb quiet"

Add one argument to the default kernel only:

sudo grubby --update-kernel=DEFAULT --args="systemd.unified_cgroup_hierarchy=1"

Common temporary troubleshooting arguments:

systemd.unit=rescue.target
systemd.unit=multi-user.target
nomodeset
rd.break
selinux=0

Be careful with selinux=0. It disables SELinux and may require relabeling later. For a temporary test, enforcing=0 is often less invasive.

Temporarily edit a GRUB entry at boot

At the GRUB menu:

  1. Select the entry.
  2. Press e to edit.
  3. Find the line starting with linux, linuxefi or similar.
  4. Add the kernel argument at the end.
  5. Boot with Ctrl+x or F10.

This does not persist. It is perfect for testing nomodeset, rescue targets, or removing a bad argument once.

Show or hide the GRUB menu

Common settings in /etc/default/grub:

GRUB_TIMEOUT=5
GRUB_TIMEOUT_STYLE=menu
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=false

After changing /etc/default/grub, regenerate the config:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

On some machines the firmware or vendor logo hides the menu. Try Esc, Shift, or repeatedly pressing the firmware boot key during startup.

Windows first in dual boot

Find entries:

sudo awk -F\' '$1=="menuentry " {print $2}' /boot/grub2/grub.cfg
bootctl list

Set Windows as default with GRUB:

sudo grub2-set-default "Windows Boot Manager (on /dev/nvme0n1p1)"
sudo grub2-editenv - list

Or use firmware boot order for UEFI:

efibootmgr -v
sudo efibootmgr -o 0003,0001,0002

Be careful with efibootmgr -o. You are changing firmware boot order. Write down the old order first.

Reinstall GRUB: last resort

Do not start here. Reinstalling GRUB is for broken bootloader files, replaced disks, damaged EFI entries, or rescue work.

On Fedora UEFI, the packages and EFI files are usually managed by RPM. Reinstalling packages is often safer than manually improvising:

sudo dnf reinstall grub2-efi shim grub2-tools

For legacy BIOS installs, the classic shape is:

sudo grub2-install /dev/sda
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Use the disk, not a partition, for BIOS GRUB installation. Example: /dev/sda, not /dev/sda1.

For UEFI, be very careful with grub2-install. Fedora’s Secure Boot/shim setup is easy to damage if you copy random commands from old tutorials. Check Fedora documentation and your actual EFI layout first:

findmnt /boot /boot/efi
bootctl status
efibootmgr -v

Rescue checklist

If a system does not boot after a kernel or driver update:

  1. Try the previous kernel from the GRUB menu.

  2. If graphics is broken, temporarily add nomodeset.

  3. Boot to multi-user mode:

    systemd.unit=multi-user.target
  4. Check failed services:

    systemctl --failed
    journalctl -xb
  5. Rebuild initramfs if needed:

    sudo dracut --regenerate-all --force
  6. For NVIDIA/akmods on Fedora, check whether modules were built for the running kernel:

    uname -r
    rpm -qa '*akmod*' '*nvidia*'
    systemctl status akmods --no-pager
    sudo akmods --force
    sudo dracut --force
  7. Reboot and try again.

Boot entry tools overview

TaskTool
Inspect BLS entriesbootctl list
Inspect Fedora kernel entriesgrubby --info=ALL
Set default Fedora kernelgrubby
Edit kernel argumentsgrubby
Regenerate generated GRUB configgrub2-mkconfig
Inspect GRUB environmentgrub2-editenv - list
One-time GRUB bootgrub2-reboot
UEFI boot orderefibootmgr
Kernel install hookskernel-install

Commands I use most

# What boot mode is this?
test -d /sys/firmware/efi && echo UEFI || echo BIOS

# Show EFI/boot status
bootctl status
bootctl list
efibootmgr -v

# Show Fedora kernel entries
sudo grubby --info=ALL
sudo grubby --default-kernel

# Change kernel arguments
sudo grubby --update-kernel=ALL --args="some_arg=1"
sudo grubby --update-kernel=ALL --remove-args="some_arg=1"

# Regenerate GRUB config
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

# GRUB environment
sudo grub2-editenv - list

Notes for other distributions

Fedora/RHEL-like systems use grub2-* command names and BLS entries by default.

Debian/Ubuntu systems often use commands like:

sudo update-grub
sudo grub-install /dev/sda

Arch and others may be closer to upstream GRUB names:

grub-mkconfig -o /boot/grub/grub.cfg
grub-install ...

So: understand the distribution first, then copy commands.


Share this post on: