grub rescue> shows if GRUB can`t find its configuration (grub.cfg) or its modules.
It happens if:
- Move or delete the /boot partition
- Disk`s UUID changed
- Trouble with MBR or UFI
Common commands grub rescue>:
- ls – shows disks and partitions (hd0) (hd0,msdos1)
- set – shows or changes (prefix, root)
- set root=(hd0,msdos1) – there are must be folders /var, /opt, /etc, /proc ….
- set prefix=(hd0,msdos1)/boot/grub – grub config and modules
- insmod normal – load a module normal
- normal – go to the grub menu
#Example
ls
set root=(hd0,msdos1)
set prefix=(hd0,msdos1)/boot/grub
insmod normal
normal
If it’s correct, then the grub menu shows up.
grub> it is a CLI GRUB and it shows:
- Then “c” was pressed
- The grub menu can`t be found, but modules were loaded
Here are more commands than in the grub rescue mode. You can manually load a kernel.
#Example
ls
set root=(hd0,msdos1)
linux /boot/vmlinuz-6.8.0 root=/dev/sda1 ro
initrd /boot/initrd.img-6.8.0
boot
GRUB: BIOS and UEFI recovery
General algorithm:
- Boot from LiveCD/LiveUSB Linux (Ubuntu, Debian, etc.).
- Determine where the system root and EFI partition are (for UEFI): lsblk,fdisk -l
- Mount the system.
- Make a chroot into the installed system.
- Reinstall GRUB and update the configuration.
- Reboot.
#Example for BIOS (Legacy)
# Use LiveCD/LiveUSB Linux
# Find the "/"
lsblk
fdisk -l
sudo mount /dev/sdXY /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
#
sudo chroot /mnt
#
grub-install /dev/sdX
update-grub
#
exit
#
sudo umount /mnt/dev /mnt/proc /mnt/sys
sudo umount /mnt
reboot
#Example for UEFI
# Use LiveCD/LiveUSB Linux
# Find the "/"
lsblk
fdisk -l
sudo mount /dev/sdXY /mnt
# 100–500 MB, type EFI System Partition
sudo mount /dev/sdXZ /mnt/boot/efi
#
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
#
sudo chroot /mnt
#
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
update-grub
#
exit
#
sudo umount /mnt/dev /mnt/proc /mnt/sys
sudo umount /mnt/boot/efi
sudo umount /mnt
reboot
#Auto-repair (boot-repair)
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt update
sudo apt install -y boot-repair
boot-repair