Posted by: Odzangba | March 10, 2007

How to restore GRUB using the Ubuntu Live CD

After deleting my fiesty fawn partition late yesterday, Grub came choking with an Error 22 message. No big deal, I thought… all I have to do is re-install grub. So I got out my dapper livecd and fired the pc up. I executed the grub-install command with the appropriate options and rebooted the pc… Error 22 again! Repeated the process… no change. So I got out my breezy alternate install cd and skipped to the “install grub boot loader step”. Grub installation failed! Now I was in big trouble. If all else fails, google is the way. :) I found some instructions on using the grub shell to install grub and that worked! So for those who need to install grub using the ubuntu dapper (and above) livecd, here they are:
Open the terminal and enter the following commands

sudo grub
find /boot/grub/stage1
(Use the output from this command in the next command)
root (hd0,1)
setup (hd0)
quit

You may have to modify the hard disk parameters to suit your setup… that’s what the second command helps you do. My root partition is the second on my first hard disk. If yours is the first for instance, then you’ll have to modify the “root” step as follows:

root (hd0,0)

Hope this helps someone. :D


Responses

  1. Very Helpful. :)

  2. Glad it was of any help. :D

  3. good tutorial :)

  4. Thanx man. :)

  5. Quick and easy. Thanx

  6. After struggling for the whole night, trying to restore grub after a reinstall, had to install Suse on one of the vacant partitions, and then recovered Fiesta. Even so, UUID of swap has changed, and I am entering by Ctrl+D. Noted your commands for future use. Thanks a lot.

  7. Ah !! Thanks a lot :)
    I tried to install linux on my HP dv6000t laptop, which had XP only. I wanted it with dual boot xp and ubuntu. but I could not get XP (original that I got with laptop) and ubuntu together. However I am half the way through.

    This helped me :)

  8. [...] GRUB as Windows XP wiped out my MBR. I got out my Feisty disc and went through the steps listed here but it seems that way of doing things doesn’t work with Feisty. The machine was croaking with [...]

  9. Could anyone please help me and tell me why “sudo grub” doesn’t work from my ubuntu live cd (hoary hedgehog). it always says “bash: grub: command not found”….thanks in advance!

  10. Ubuntu 7.04 Feisty gives “Error 27: Unrecognized command” after typing “root(hd0,1)”.

    Me have no idea… me stuck :D

    I installed Windows 2003 and knew that I would come across this problem… but I though I could fix it… seems like not :D

    Still searching though…

    Thanks for the post anyway!

  11. http://ubuntuforums.org/showthread.php?t=224351

    This post is complete on the Ubuntu Forums on how to restore GRUB.

    It uses “find boot/grub/stage1″ to make sure you enter the correct drive to “root (hd?,?)”.

    The steps are then the same as you said. TNX!

  12. Thanks for mentioning the tip here, Ray. I’ll soon update my little how-to to include it.

    Cheers,
    Odzangba

  13. I still have problems after reinstalling grub says it cant mount the partition(ubuntu ext2 linux partition).

  14. Thanks dude!

  15. thanks for your nice activity,
    may be i need my self blog

  16. yes, it helped me a lot

  17. Yippie. Thanks so much for your time to put this on your blog :) )

  18. Thanks. It works for me ^^

  19. Thanks !

  20. when i went to vista partition it says mbrmgr missing
    crtl+alt+del to restart

  21. yeahhh thx!!! worked perfectlly! thank you fine sir very much ^^

  22. Thank you. Very helpful and it saved the day for me.

  23. Thanks!

  24. Поставте антиспам

  25. Viagra is taken orally and helps men suffering from erectile dysfunction achieve and maintain an erection vaigra discount generic ! For cialis comprare very fast delivery Europe! Save your time – buy cheap levitra pill now… Fast to get levitra pills online. Find out more about erectile dysfunction at the official cialias cheap site…

  26. Cheap cialis is taken orally and helps men suffering from erectile dysfunction achieve and maintain an erection vaigra softtabs fast … For viagra gb very fast delivery Canada… Save your time -buy sexual health pills on line! Easy to get priaprism pills online.. Find out more about ed treatment at the online clialis cheap generic site

  27. It didn’t work correctly. I got grub installed and kubuntu loads fine, but when i try to load vista it says there is mbr missing. And is it normal that the interface is so dos-like?

  28. Thanks so much. This helped me to get my Intrepid happy again. (oO)
    jjjj

  29. it fails when I enter the command “setup (hd0)” here’s he message :
    “grub> root (hd0,5)

    grub> setup (hd0)
    Checking if “/boot/grub/stage1″ exists… yes
    Checking if “/boot/grub/stage2″ exists… yes
    Checking if “/boot/grub/e2fs_stage1_5″ exists… yes
    Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… 16 sectors are embedded.
    succeeded
    Running “install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,5)/boot/grub/stage2
    /boot/grub/menu.lst”… failed

    Error 12: Invalid device requested”

  30. please help me out with this :)

  31. if i am installing ubuntu os 100 hard disk per hour , i use ghost system , ( hard to hard copy ) , give me a solution how to grub repair with out loading live cd or easy system to repair grub


Leave a response

Your response:

Categories