How to reinstall Grub from a live CD

From episode 21 I mentioned that my Grub bootloader got hosed when I installed Windows 7 on a second partition on my laptop. I wanted to take the time to write a quick how to in case this happens to you and you find that you cannot boot into Linux because your Grub menu doesn’t show up.
I got this info from the Ubuntu forums
First off you need to boot to your Linux Mint live CD. You can also use just about any live Linux disk but I used Linux Mint.
Once your live cd has booted open a terminal and type

sudo grub

This is going to enter the grub shell. You can only perform certain grub tasks while in this shell but it will make the re-install super easy.
Next you need to find what hard drive and partition your grub files are on. For that type in

find /boot/grub/stage1

This will let grub search your hard drives for your /boot folder along with the other necessary files grub needs to boot. This will show you what drive and partition the grub files are on. It will look something like hd0,1. That stands for hard drive 0, partition 1. (remember computers start counting with 0, not 1)
We are going to tell grub where the files are located with this command

root (hd?,?)

Replace the ?’s with what the find command returned. eg. root (hd0,1)
Now you need to actually reinstall grub to the first hard drive’s master boot record. To do the install simply type in

setup (hd0)

That’s it! now just get out of the grub shell with

quit

And you are all set. Reboot your computer and your grub menu should be exactly as you left it before installing the second operating system.


5 Replies to “How to reinstall Grub from a live CD”

  1. Charlie Anderson

    What am I doing wrong?

    I can’t find the link to the audio file (.mp3 or .ogg)

    I was able to download last weeks show, but I can’t find the link for even that.

    • Rothgar

      Great tip. It has been so long since I have used super grub disk that I forgot all about it. Thanks for the tip. I guess the only benefit from doing it from a LM disk is most users will already have one of those burned. So no need to keep 2 discs for this.

Leave a Reply

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

Linux Mint

The distribution that spawned a podcast. Support us by supporting them. Donate here.

Archive.org

We currently host our podcast at archive.org. Support us by supporting them. Donate here.

Audacity

They’ve made post-production of our podcast possible. Support us by supporting them. Contribute here.

mintCast on the Web

This work is licensed under CC BY-SA 4.0

This Website Is Hosted On:

Thank You for Visiting