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.cfgand/etc/grub2-efi.cfgare 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(orrocky,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=hiddenandGRUB_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/gruband runupdate-grub:GRUB_TIMEOUT_STYLE=menu GRUB_TIMEOUT=5
2. Edit a boot entry for one boot
- Select the entry with the arrow keys and press
e. - Go to the line that starts with
linuxand pressCtrl+Eto jump to its end. - Add, change or delete kernel parameters, for example:
systemd.unit=rescue.targetfor single user mode (full steps in how to boot into single user mode).- Remove
rhgb quietto see the boot messages. fsck.mode=forceto check the file systems at boot. systemd 258 and later (Ubuntu 26.04) ignore the old/forcefsckfile.init=/bin/bashfor a forgotten root password on version 10, where therd.breakshell asks for the root password first.
- Press
Ctrl+XorF10to boot.Escthrows 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
- Show the current default and the list of entries:
grubby --default-kernel grubby --info=ALL | grep -E '^(index|kernel)'
- 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
- The choice is stored as
saved_entry;grub2-editenv listshows it.
A kernel update can make the newest kernel the default again, so check grubby --default-kernel after updates.
Ubuntu and Debian
- 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
- In
/etc/default/grub, setGRUB_DEFAULT=savedand runupdate-grub. - 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-grubafter every change to/etc/default/grub. It is a short script that runsgrub-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 ingrub.cfgitself: itsblscfgcommand reads/boot/loader/entries/at boot. In our test, a new value inGRUB_CMDLINE_LINUXreached those entries only withgrub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline, the command Red Hat documents for this. For kernel parameters,grubbyis simpler. - Your own menu entries go in
/etc/grub.d/40_custom, never ingrub.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=0always boots the first entry; usesavedas above. On the RHEL family, set the default again withgrubby. - 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.