Booting into OS using grub2 rescue mode

I booted the system up and it took me to the rescue prompt. How did this happen – that’s another story, will post it sometime.

error: no such partition.
grub rescue>

Help was not working
grub rescue>help
Unknown command ‘help’

Tried to check for the env variables
grub rescue>set

This gave me info on the problem. I have sync’d the data from my 1TB Cavair Black to another 650GB disk. During the process, I removed the last 2 partitions. This resulted in removal of the “boot” directory along with the boot partition.

In order to fix it, I pointed it to another partition which had a boot directory:
grub rescue>set prefix=(hd0,5)/boot/grub
grub rescue>set root=hd0,5

Loaded required modules using:
grub rescue>insmod normal help chain boot linux configfile

The configfile module was a life saver here. Tried the following:
grub rescue>configfile /boot/grub/grub.cfg

and the grub menu was there. I made a couple of changes to the menu entries and was able to boot into the OS.

After logging into the machine, I made required changes to fstab for the partition UUID. Then, ran update-grub2 so that grub.cfg file can be populated with correct partition information. But the system took me to boot rescue after restarting the machine.
grub-install /dev/sda fixed the following:

grub rescue>set
grub rescue>set

One thought on “Booting into OS using grub2 rescue mode

Leave a Reply

Your email address will not be published. Required fields are marked *