Skip to content

How to Edit the GRUB Boot Menu and Change the Default Entry

Updated 6 min read

Updated: 18 October 2026 · Applies to: GRUB 2 on AlmaLinux, Rocky Linux and RHEL 9 and 10 (tested on AlmaLinux 10.2: GRUB 2.12, grubby 8.40), Ubuntu 24.04 (GRUB 2.12) and 26.04 (GRUB 2.14), Debian 13 (GRUB 2.12)

To edit the GRUB boot menu for one boot, restart the server, select the entry, press e, change the line that starts with linux and press Ctrl+X. To change the default entry for good, do not edit grub.cfg by hand: on AlmaLinux, Rocky Linux and RHEL run grubby --set-default, and on Ubuntu and Debian set GRUB_DEFAULT in /etc/default/grub and run update-grub.

Where is the GRUB config?

  • AlmaLinux, Rocky Linux, RHEL 9 and 10: settings in /etc/default/grub; the generated menu in /boot/grub2/grub.cfg (for BIOS and UEFI; /etc/grub2.cfg and /etc/grub2-efi.cfg are links to it); one file per kernel in /boot/loader/entries/; the saved default in /boot/grub2/grubenv. On UEFI, /boot/efi/EFI/almalinux/grub.cfg (or rocky, redhat) is only a small stub that loads /boot/grub2/grub.cfg.
  • Ubuntu and Debian: settings in /etc/default/grub (plus any files in /etc/default/grub.d/); the generated menu in /boot/grub/grub.cfg; the scripts that build it in /etc/grub.d/.
  • grub.conf or menu.lst: these names come from GRUB Legacy on very old releases such as CentOS 6. Current systems do not use them.

Each file is explained in GRUB2 configuration files explained.

1. Open the console and show the menu

GRUB runs before the network starts, so SSH cannot reach it. On a Ucartz VPS, open the VNC console from the client area as shown in how to access your VPS via VNC. On a dedicated server, use the IPMI or KVM console.

  • AlmaLinux, Rocky Linux, RHEL and Debian 13 show the menu for a few seconds (Debian's default is GRUB_TIMEOUT=5). Press an arrow key to stop the countdown.
  • Ubuntu 24.04 and 26.04 hide it: their default file has GRUB_TIMEOUT_STYLE=hidden and GRUB_TIMEOUT=0. According to the GRUB manual, pressing Esc or F4, or holding Shift, while GRUB starts shows the menu. To show it on every boot, set these two lines in /etc/default/grub and run update-grub:
    GRUB_TIMEOUT_STYLE=menu
    GRUB_TIMEOUT=5

2. Edit a boot entry for one boot

  1. Select the entry with the arrow keys and press e.
  2. Go to the line that starts with linux and press Ctrl+E to jump to its end.
  3. Add, change or delete kernel parameters, for example:
    • systemd.unit=rescue.target for single user mode (full steps in how to boot into single user mode).
    • Remove rhgb quiet to see the boot messages.
    • fsck.mode=force to check the file systems at boot. systemd 258 and later (Ubuntu 26.04) ignore the old /forcefsck file.
    • init=/bin/bash for a forgotten root password on version 10, where the rd.break shell asks for the root password first.
  4. Press Ctrl+X or F10 to boot. Esc throws the edit away. GRUB does not save the change: the next boot is normal again.

To keep a kernel parameter, see how to change the kernel command line permanently.

3. Change the default boot entry

AlmaLinux, Rocky Linux and RHEL 9 and 10

  1. Show the current default and the list of entries:
    grubby --default-kernel
    grubby --info=ALL | grep -E '^(index|kernel)'
  2. Set the default by kernel path (or by number with grubby --set-default-index=1). In our AlmaLinux 10.2 lab:
    grubby --set-default=/boot/vmlinuz-6.12.0-211.7.3.el10_2.x86_64
    The default is /boot/loader/entries/<machine-id>-6.12.0-211.7.3.el10_2.x86_64.conf with index 1 and kernel /boot/vmlinuz-6.12.0-211.7.3.el10_2.x86_64
  3. The choice is stored as saved_entry; grub2-editenv list shows it.

A kernel update can make the newest kernel the default again, so check grubby --default-kernel after updates.

Ubuntu and Debian

  1. List the menu titles:
    grep -E "^\s*(menuentry|submenu) " /boot/grub/grub.cfg | cut -d"'" -f2
    Lab output on Ubuntu 24.04 (shortened):
    Ubuntu
    Advanced options for Ubuntu
    Ubuntu, with Linux 6.8.0-146-generic
    Ubuntu, with Linux 6.8.0-146-generic (recovery mode)
    Ubuntu, with Linux 6.8.0-141-generic
  2. In /etc/default/grub, set GRUB_DEFAULT=saved and run update-grub.
  3. Choose the entry. An entry inside the "Advanced options" submenu is written as submenu>entry:
    grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-141-generic"

You can also put that title straight into GRUB_DEFAULT="..." and run update-grub. In our test, grub-set-default had no effect while GRUB_DEFAULT=0 was set: the generated menu kept set default="0".

For the next boot only

Run grub2-reboot 1 (RHEL family) or grub-reboot "TITLE" (Ubuntu, Debian), then reboot. This sets next_entry, which GRUB uses once and then clears.

4. Update the GRUB config

  • Ubuntu and Debian: update-grub after every change to /etc/default/grub. It is a short script that runs grub-mkconfig -o /boot/grub/grub.cfg. Lab output:
    Sourcing file `/etc/default/grub'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-6.8.0-146-generic
    Found initrd image: /boot/initrd.img-6.8.0-146-generic
    Found linux image: /boot/vmlinuz-6.8.0-141-generic
    Found initrd image: /boot/initrd.img-6.8.0-141-generic
    Adding boot menu entry for UEFI Firmware Settings ...
    done
  • AlmaLinux, Rocky Linux, RHEL: grub2-mkconfig -o /boot/grub2/grub.cfg. The kernels are not listed in grub.cfg itself: its blscfg command reads /boot/loader/entries/ at boot. In our test, a new value in GRUB_CMDLINE_LINUX reached those entries only with grub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline, the command Red Hat documents for this. For kernel parameters, grubby is simpler.
  • Your own menu entries go in /etc/grub.d/40_custom, never in grub.cfg, which is overwritten on every update.

After the reboot, cat /proc/cmdline shows the parameters the running kernel started with.

Common problems

  • Pressing e asks for a user name and password: a GRUB password is set. Enter it, or ask whoever set it.
  • The default changes back after a kernel update: on Ubuntu and Debian, GRUB_DEFAULT=0 always boots the first entry; use saved as above. On the RHEL family, set the default again with grubby.
  • The server stops at a grub> or grub rescue> prompt: see GRUB rescue commands. On a Ucartz VPS you can also enable rescue mode in Virtualizor.

Official documentation: Red Hat: managing, monitoring and updating the kernel and GNU GRUB manual.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket