After so long time i am writing a new blog post. This post is about recent error i encountered on my dual boot machine. What i did was made some changes in my hard disk partitions. After that i restarted my pc and we had to call Huston!!!!
It was GRUB rescue which greeted me. GRUB rescue is linux-alike command prompt with limited commands. What went wrong is as i have changed partitions, it lost all it references to GRUB`s configuration file. Now i had two options. One was get bootable CD/DVD/PenDrive of Linux and reinstall GRUB. That was not possible for me as i didn’t have another machine to prepare any of such media. So i have to use GRUB rescue and get it running.
So i started like this. The problem was GRUB lost references to hard disk partitions. The solution coud be point grub to new partitions. With this in mind i started to search where is grub actually located on my hard disk.
After little Googling i came to know that i can use “ls” to list all my hard disk partitions with numbers. It goes as follows.
grub rescue> ls
grub rescue> (hd0), (hd0,msdos8), (hd0,msdos9), (hd0,msdos6), (hd0,msdos7)
Your output may be different but it should be like (hdX,msdosXX). Here big X after hd shows the number of storage attached with machine. One can have hd1, hd2 if more than one storage is attached with the machine. The msdos part says that the partition type is of msdos. It can also be different.
Lets move on. After using ls command we have to find where is GRUB. This can be done using suffix /boot.
grub rescue>ls (hd0)/boot
…. some error/not found
grub rescue>ls (hd0,msdos8)/boot
…. some error/not found
grub rescue>ls (hd0,msdos9)/boot
…. list of files like inintrd.img, vmlinuz and others…
Finally, Found it…
So my GRUB files are in msdos9. Now we just have to boot from here. Lets tell GRUB to boot from msdos9. Just follow below given small commands.
grub rescue> set root=(hd0,msdos9)
grub rescue> set prefix=(hd0,msdos9)/boot/grub
grub rescue> insmod normal
grub rescue> normal
Thats it…After writing last command you should see regular grub prompt. One final thing left.
Go to your linux command prompt and follow these commands. We are reinstalling grub with new references.
sudo grub-install /dev/sda
( In case, you have multiple storage installed, you have to find on which storage you are supposed to install GRUB. In my case i was installing on “sda”. ).
Now it`s time to say..
Huston we are up and running. Earth looks nice from here….
#GRUB #GRUB2 #rescue #grubrescue #Linux #reinit