Updated: 28 September 2026 · Applies to: GRUB 2.06 and 2.12 on AlmaLinux and Rocky Linux 9 and 10 and RHEL 9 and 10 (BIOS and UEFI); notes for Ubuntu and Debian
If a server stops at a "grub>" or "grub rescue>" prompt, or no longer finds its operating system after a disk change, the boot loader must be reinstalled. You do this from the installation or rescue media, by entering the installed system with chroot. The steps depend on whether the server boots with BIOS (legacy) or UEFI, and they follow Red Hat's documented procedure.
Before you start
- You need the server's console: IPMI or KVM on a dedicated server, or your VPS panel's console. If you cannot attach installation media yourself, ask your provider's support.
- Boot the AlmaLinux, Rocky Linux or RHEL installation image of the same major version and choose Troubleshooting › Rescue. Let it mount the installed system: it is placed under
/mnt/sysroot.
1. Enter the installed system
chroot /mnt/sysroot
Check which boot mode you are in: if /sys/firmware/efi exists, the server boots with UEFI; otherwise with BIOS.
2a. BIOS servers
- Find the boot disk (not a partition) with
lsblk, for example/dev/sda. - Install GRUB to it:
grub2-install /dev/sda
With software RAID 1, install it to every disk in the array so the server can boot from either. - Regenerate the menu:
grub2-mkconfig -o /boot/grub2/grub.cfg
2b. UEFI servers
Do not run grub2-install on UEFI systems. Reinstall the boot loader packages instead, which puts the signed boot files back in the EFI partition:
dnf reinstall grub2-efi shim grub2-tools grub2-common grub2-mkconfig -o /boot/grub2/grub.cfg
On RHEL 9 and 10, /boot/efi/EFI/*/grub.cfg is a small stub that points to /boot/grub2/grub.cfg; do not overwrite it with grub2-mkconfig. If the firmware lost its boot entry, recreate it with efibootmgr (check the existing entries with efibootmgr -v).
3. Leave and reboot
exit reboot
Remove the rescue media so the server boots from its disk.
Ubuntu and Debian
Boot a live or rescue system, mount the root file system on /mnt (and /mnt/boot/efi on UEFI), bind-mount /dev, /proc and /sys, run chroot /mnt, then grub-install /dev/sda (BIOS) or grub-install (UEFI), followed by update-grub.
Official documentation: Reinstalling GRUB (Red Hat).
Ucartz services for this topic
- 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.
