Grub Rescue Mode is a troubleshooting environment within the server's bootloader system. It activates automatically when there are challenges loading the operating system, often due to issues such as corrupted or missing system files.
If you get the following message after accessing your VPS through the Browser Terminal:
grub rescue>
It means your VPS entered Grub Rescue Mode. To fix it, follow these steps:
Step 1 - Preparations
Enable the VPS emergency mode
Locate your server's main partition by referring to this guide: VPS Emergency Mode: Where to Find Files
Step 2 - Unmount the Partition
After connecting to Emergency Mode SSH, run the following command:
lsblk
The output will show the details about the storage devices detected by the system and their associated information. It will look similar to this example:
root@machine:/# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 63.4M 1 loop /snap/core20/1974
loop1 7:1 0 111.9M 1 loop /snap/lxd/24322
loop2 7:2 0 53.3M 1 loop /snap/snapd/19457
loop3 7:3 0 40.9M 1 loop /snap/snapd/20290
loop4 7:4 0 63.5M 1 loop /snap/core20/2015
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 49.9G 0 part /mnt/sda1
├─sda14 8:14 0 4M 0 part
└─sda15 8:15 0 106M 0 part /mnt/sda15
/boot/efi
sdb 8:16 0 2.2G 0 disk
├─sdb1 8:17 0 2.1G 0 part /
├─sdb14 8:30 0 4M 0 part
└─sdb15 8:31 0 106M 0 part
sr0 11:0 1 4M 0 rom
The main partition can be identified as the largest in size. In the example above, the largest partition is sda1
, designated witht the mount point /mnt/sda1
If the MOUNTPOINTS column for your device is empty, skip this part and proceed directly to the next step.
Unmount the main partition if the MOUNTPOINTS column for your device is not empty by entering the following command:
umount mountpoint
Replacing mountpoint
with your main partition's mount point. In this example, it would look like this:
umount /mnt/sda1
If you receive a warning stating that the device is busy, ensure that there are no ongoing accesses to this directory from other sources such as the File Manager, SSH, or FTP.
Step 3 - Restore the File System
Once the main partition is unmounted, run the following command:
xfs_repair /dev/device
Replacing device
with your device name. Following the same example:
xfs_repair /dev/sda1
Make sure to leave the /dev directory at the beginning of the path, as this is the directory that stores all devices, whether mounted or not.
Step 4 - Restart Your VPS
After repairing the file system on your main partition, reboot the server - the filesystem will be fixed and your VPS should start working.