PDA

View Full Version : HOWTO: Restore GRUB (if your MBR is messed up)



Pages : 1 [2]

wilberfan
August 6th, 2011, 08:33 PM
Forgive me if this has already been mentioned, but Rescatux has saved my GRUBby butt on more than one occassion!

Highly recommended... http://www.supergrubdisk.org/rescatux/

YannBuntu
January 12th, 2012, 09:47 AM
THE METHOD I'M ABOUT TO SHOW YOU CAN BE DONE FROM:

. A LIVE DISK/CD/DVD
. A LIVE USB
. ANY OTHER LIVE MEDIA
. AN INSTALLED VERSION OF UBUNTU

The absolute EASIEST WAY, to (re)install GRUB is to use a little program called Boot-Repair. It does all that work to do with commands in the Terminal to reinstall GRUB for you, and it's really noob friendly, with a simple GUI, that you merely have to indicate which OS you want as your main Operating System etc, IF YOU WANT TO! This is all under advanced options, but really, it's not so advanced, anyway to get Boot-Repair:

Do this in the Terminal:



sudo add-apt-repository ppa:yannubuntu/boot-repair

sudo apt-get update; sudo apt-get install -y boot-repair
Now, run the program (search for it in Unity, or go to: System ----> Administration ----> Boot Repair, in Gnome 2/ Classic Mode in 11.04 Natty Narwhal)

Info for this can be found by:

a) going to: https://help.ubuntu.com/community/Boot-Repair
b) messaging me here.

Hope this helped...

x-D :guitar:

Hello
little update:
- the package to install is now "boot-repair" (not "boot-repair-ubuntu").
- And i confirm Boot-repair automatically does grub-update, so doing it manually is not necessary.

Trent T
January 15th, 2012, 05:56 AM
Thanks, pritam_par, for your excellent instructions!

Your method worked well when I tried it, except for a small change
needed in step 9:

You posted,
9. Verify the install

sudo grub-install

It worked for me when I left out 'sudo'


grub-install

Thanks again!

Trent T


Here are the few steps in which you can install Grub from CD

1.Boot from the Ubuntu Desktop

2. In Terminal tpye sudo fdisk -l .
It will display all partiton of the disk.


(http://3.bp.blogspot.com/-HRTk2qtrWYg/Tei7c9KYgbI/AAAAAAAAAJE/HTEtCP4CnSw/s1600/Grub+rescue+install.png)
3. Mount the ubuntu partition drive
sudo mount /dev/sdXX /mnt

4.Only if you have a separate boot partition:
sudo mount /dev/sdYY /mnt/boot.
5. Mount the virtual filesystems:

sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

6. To ensure that only the grub utilities from the LiveCD get executed, mount /usr
sudo mount --bind /usr/ /mnt/usr
sudo chroot /mnt

7. update-grub
or update-grub2
8.Now reinstall Grub
grub-install /dev/sdX (eg. grub-install /dev/sdaDo not specify the partition number.
9. Verify the install
sudo grub-install --recheck /dev/sdX
10. Exit chroot : CTRL-D on keyboard.
11. Unmount virtual filesystems:
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys

12. Unmount the LiveCD's /usr directory:
sudo umount /mnt/usr

13. Unmount last device:
sudo umount /mnt

14. Reboot.
sudo reboot.

divyanshu308
January 30th, 2012, 04:51 PM
Hi everyone I've got a very bad situation.
I have a Dell inspiron 15r.
It had dual boot windows7 and Ubuntu.
I wanted to make a fresh install of both windows and Ubuntu.
When i booted win 7 DVD i accidentally deleted the Ubuntu swap partition.
Now the laptop doesn't turns on.
it's stuck at the boot screen.
I even removed the hard disk and tried to connect it to my desktop using sata to USB converter but it's not being detected it's spinning even showing an icon as if there is a USB device connected but no partitions showing.
I live booted Ubuntu without the hare disk plugged in and it works fine but obviously since no hard disk is connected there is no place to install.
Even when it's live booted up when i connected the hard disk nothing shows up.
Please help....

See the progress at the page below.
i apologize for repeating my problem but I'm helpless..

ubuntuforums.org/showthread.php?t=1916953

sheds
March 27th, 2012, 05:48 AM
Don't forget that this method, as described, 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 "(hd0)" 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...

-Warr

Hey man, I did these steps but error 2 keeps getting displayed. I installed puppy linux, lucid pup, and it does install a bootable grub. The mint installer is the one that cannot do this. Any ideas?

Just a FYI, lucid puppy does install well and boots off ok, so I guess this is a problem with the mint installer.