Philippines, Technology, Mobile, Android, Games, Mac, Linux, WordPress
Google+TwitterLinkedinFacebook
Subscribe
HomeLinux / UbuntuHow to reinstall the grub boot manager on Ubuntu Linux

How to reinstall the grub boot manager on Ubuntu Linux

My new Compaq CQ20 noteobook has a “recovery button” feature which I really haven’t gotten to checkout. The other day while setting up Ubuntu, I inadvertently pressed on the button which resulted to a “missing operating system” message when I got my notebook restarted. That recovery button should really be moved to a separate location or better yet have a disable feature option. I know that my data is still intact and that maybe the boot sector was the only area on the disk that was affected.

I took my Ubuntu Intrepid installer usb stick and booted it. Once Ubuntu was running, I checked my hard disk’s partition table using the program fdisk. I did the following on a terminal:

$ sudo -s# fdisk /dev/sda

After issuing the “p” command of fdisk, I found that my partition is still intact. This got me to thinking that my hard disk’s grub boot manager was the thing that was actually erased. I ran grub and restored my the boot sector. Here’s how I did it:

While still logged in as root, run grub.

# grub

If you know what the root for grub for your system is then key in the root command for grub. You should have something like the one below after the “grub>” prompt:

grub> root (hd0,1)

If you don’t know where it should be then let grub find it by:

grub> find /boot/grub/stage1

At last, now to install the grub boot manager:

grub> setup (hd0)

That’s it, you should now have your Grub boot manager back in the MBR.

Update: Adrimaxi posted a link below to Super Grub Disk — a menu driven way to restore your grub boot loader. Thanks Adrimaxi.

Responses

  1. Adrimaxi says

    Why didn’t you used the supergrubdisk that does it automaticaly from either your usb thumb or a cd-r…
    http://www.supergrubdisk.org/
    It’s is so easy to recover your grub (or windows mbr) with no command lines.
    Cdy,

Leave a Reply

  • Hi, I'm Gerry. Welcome to my blog and sites about mobile, technology, The Pinoy, #crazyidea, games, WordPress, Ubuntu, Mac, iOS, Android, Symbian... I started sites like Ortigas Online and iMakati which focuses on local community information. Read more about Gerry
    Status (Twitter, Linkedin, Facebook...)

    Just found out that the Android-based HTC Sensation XL phone is now in the Philippines for about Php 28,000.

  • Visit my other sites

    • Apps & Games

      Reviews, news of mobile apps & games for Android, iOS, Blackberry, Symbian...

    • Connected Phone

      The computer is the mobile phone. The always connected phone evolution.

    • Mobile/Web Development

      Mobile/Web apps, development, services for Android, iPhone & WordPress.

    • Pinoy Me

      Pinoy businesses, enterprises, startups, professionals all over the world

    • Java Midlet

      Java mobile apps & games - news, reviews, tips, mobile phone & devices

  • PINOI Sites

    Are you interested in putting up your own PINOI-enabled local community site? Contact me

    • PINOI

      Enabling local communities on the Internet

    • Makati

      iMakati.com is a site that provides information about Makati City.

    • Ortigas

      Community site that provides information about the Ortigas Center.