The Rescue Commands
At the grub rescue> prompt, find the partition that holds GRUB's files, point GRUB at it, and load the normal menu:
ls
ls (hd0,gpt2)/
set root=(hd0,gpt2)
set prefix=(hd0,gpt2)/boot/grub
insmod normal
normal
Replace (hd0,gpt2) with the partition you find in the next step. The prompt has no network, so you work in the server's console in your provider's control panel.
Why the Prompt Appears
The first stage of GRUB loaded, but it could not reach the /boot/grub folder and its modules. Common causes are a deleted, moved, or resized partition, a replaced or reordered disk, and an update that wrote GRUB to the wrong disk. Messages such as no such partition or unknown filesystem come before the prompt.
Step 1: Find the Partition with /boot
ls lists disks and partitions, for example (hd0) (hd0,gpt1) (hd0,gpt2); disks with an MBR partition table show msdos1 instead of gpt1. Look inside each partition:
ls (hd0,gpt2)/
The right one lists familiar folders such as boot/, etc/, and usr/. If /boot is a separate partition, it lists grub/ or grub2/ and kernel files directly. unknown filesystem means that partition is not the one, or it is a swap or EFI partition.
Step 2: Set Root and Prefix
- Debian and Ubuntu:
set prefix=(hd0,gpt2)/boot/grub. - AlmaLinux and Rocky Linux: the folder is
/boot/grub2. - Separate /boot partition: leave out
/boot, as in(hd0,gpt1)/grubor(hd0,gpt1)/grub2.
If insmod normal answers file not found, the prefix is wrong. ls $prefix/ should list a folder such as i386-pc or x86_64-efi. After normal, the usual menu appears and the server boots.
Step 3: Repair GRUB from the Booted System
The rescue commands last for one boot. Once the server is up, take a snapshot before you change the boot loader. Check whether it boots with UEFI: if /sys/firmware/efi exists, it does. Find the disk name with lsblk, and install to the disk, not to a partition.
| System, BIOS boot | Commands |
|---|---|
| Debian, Ubuntu | sudo grub-install /dev/vdasudo update-grub |
| AlmaLinux, Rocky Linux | sudo grub2-install /dev/vdasudo grub2-mkconfig -o /boot/grub2/grub.cfg |
On UEFI systems of the Red Hat family, do not run grub2-install. Reinstall the GRUB EFI and shim packages instead, which puts the signed boot files back on the EFI partition, then regenerate the configuration:
rpm -qa 'grub2-efi*' 'shim*'
sudo dnf reinstall 'grub2-efi-*' 'shim-*'
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
The first line shows which of these packages are installed; their names end in the architecture, such as x64.
On release 9 and later, the grub.cfg on the EFI partition is a small stub that points to /boot/grub2/grub.cfg; do not overwrite it. On Debian and Ubuntu with UEFI, mount the EFI partition at /boot/efi, then run sudo grub-install without a disk name and sudo update-grub.
When Normal Also Fails: Rescue Mode and chroot
If the server cannot boot at all, start the rescue system from your provider's control panel. It boots a small Linux from the network, as described in what is PXE boot. Mount the installed system and enter it:
lsblk -f
sudo mount /dev/vda2 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
If /boot or the EFI partition is separate, mount it under /mnt/boot or /mnt/boot/efi before the chroot. Run the repair commands from Step 3 inside the chroot, then exit, unmount, and reboot from the control panel.
The grub Prompt Without "rescue"
A plain grub> prompt means GRUB loaded its modules but found no configuration. It accepts more commands, including linux, initrd, and boot to start a kernel by hand. The permanent fix is the same: regenerate the configuration from the booted system.
Prevent It Next Time
- Snapshot first: before partition changes or system upgrades, as in snapshot vs backup.
- Reboot in a planned window: after kernel updates, check the result as in how to reboot a Linux server.
- Different symptom: a boot that stops in emergency mode is usually an
/etc/fstabproblem; see how to mount a drive in Linux.