Boot From Grub

Overview

When you get the grub command prompt:
grub >
It means something went wrong with the grub boot leader whether it was not installed properly or it cannot find your hard drive to boot into the OS. From this screen you can attempt to boot to the OS.

Locating the hard drive

Run the command:
ls
which will list the hard drives / partitions it can see. The list will look something like this:
(hd0,1) (hd1,0) (hd2,0) (hd3,0)

You can then look at the contents of the drive to try and find out which one is the correct drive to boot into:
ls (hd0,1)

by going through each in turn you should be able to find out which one. If I remember correctly you can even go into the directories by adding the file separator after the hard drive e,g:
ls (hd1,0)/etc

Booting

Once you have found out which is the correct drive you can do the following:

grub> set root=(hd0,1)
grub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1
grub> initrd /boot/initrd.img-3.13.0-29-generic
grub> boot

This assumes (hd0,1) is the correct drive. Replace the vmlinuz- and initrd.img files with the correct version. You can use tab key to auto complete.

Permanent fix

To fix grub forever running the following command after booting into Ubuntu:
sudo update-grub

Summary

Hopefully the above will help boot up to whichever operating system if Grub throws a wobbly.

How to Rescue a Non-booting GRUB 2 on Linux

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux and tagged , , . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.