Restore GRUB in Ubuntu (if your MBR is messed up)


Puts GRUB back on the MBR (master boot record) of the hard drive instead of in the root parititon. This is fine for most people, but not if you already have an alternative boot manager.

In other words, if you use something like Boot Magic or System Commander, the commands you've just read will overwrite what you've got.

If you've installed GRUB into the Root Partition instead of the MBR, the commands are a little different. Here's are the instructions that I have for my system:

How to Restore the Grub Menu after a Re-Ghosting:

  1. Boot from a Live CD, like Ubuntu Live, Knoppix, Mepis, or similar.
  2. Open a Terminal. Go SuperUser (that is, type su). Enter root passwords as necessary.
  3. Type grub which makes a GRUB prompt appear.
  4. Type find /boot/grub/stage1. You'll get a response like (hdx,y) or in my case (hd0,3). Use whatever your computer spits out for the following lines.
  5. Type root (hd0,3).
  6. Type setup (hd0,3). This is key. Other instructions say to use (hd0), and that's fine if you want to write GRUB to the MBR. If you want to write it to your linux root partition, then you want the number after the comma, such as (hd0,3).
  7. Type quit.
  8. Restart the system. Remove the bootable CD.

Hope this helps. Since I use Norton Ghost to make regular backups and restores (I do a lot of testing), I do this all the time...


Here is another way:


  1. Boot with any live CD (I've done it with Knoppix 3.x and Ubuntu)
  2. Get a root shell and make a folder (mkdir ubuntu)
  3. mount the root (/) partition of ubuntu (e.g. mount /dev/hdb ubuntu if you have two disks)
  4. chroot the mounted partition (chroot ubuntu)
  5. grub-install /dev/hda *
  6. Exit the shell
  7. Reboot
* NOTES: If you are multi-booting with Windows, make sure you do NOT install the MBR on the active partition (say /dev/hda1) but on the drive (/dev/hda). At least with Windows XP, you will have to re-install it (FIXMBR/FIXBOOT won't work).

4 comments:

Harsh J said...

Can you link me to that Grub theme you're using there? I just _have_ to have it, it really fits Gutsy Gibbon! :(

Hope you don't mind sharing it, else its okay .. :)

FRIS said...

Hars j, you can make and customize yourself grub and ubuntu splash theme with some tools. For info, you can read here and here.
Make up over your Boot Menu and Splash. Enjoy!

Harsh J said...

Um, I was looking for that theme which is in your screenshot above. I know how to create and all but can you just link me to that _particular_ theme as shown in the post? The one with a monkey or something juggling?

Gregory Burd said...

Seriously, we (me and the other posters) want that boot screen image/animation. It's just plain cool. :) Can you blog/post/explain how to do that?

Delicious Digg Technorati Reddit Furl BlinkList Yahoo! NewsVine Netscape Google Live Bookmark Netvouz Squidoo StumbleUpon Magnolia.png