From http://distrowatch.com/weekly.php?issue=20100111:

Restoring GRUB

Can't-boot-any-more asks: Distro hopping wiped out my GRUB. How can I reconstruct it?

DistroWatch answers: Sometimes when making changes to a hard drive, such as installing a new operating system, the disk's master boot record (MBR) will get wiped or corrupted. When that happens, GRUB will no longer function. This has the unfortunate side effect of preventing the user from being able to boot their operating system and, in those cases, it's important to be able to get the system up and running again, preferably without re-installing the operating system(s) from scratch.

The easiest way to get GRUB back on-line is with a live CD. It doesn't really matter which live CD, so long as it comes with a copy of GRUB. Place the live CD into the computer and boot from it. We're then going to venture into command-line territory. The next thing to do is run the "grub" command as root or, if you are running a live CD that uses sudo, run "sudo grub". This will start GRUB and provide us with a prompt.

     grub>

We'll then find out where the GRUB files are located:

     grub> find /boot/grub/stage1

The find command will return a disk location for us. Probably "(hd0,0)" or "(hd0,1)". We now know where the GRUB files are stored. Next, we'll tell GRUB to use this location in the future. In the following step, type "root", followed by the location we were given above. In my case:

     grub> root (hd0,1)

GRUB now knows where its files are located and we need to re-setup GRUB in the master boot record. To do this, we type:

     grub> setup (hd0)

The above step should work for most people, who have GRUB installed in the MBR. For folks who have installed GRUB onto a partition, the "setup" command can be modified to include the partition number. The catch is, you need to know where you originally installed GRUB. In these cases, remember that GRUB starts counting partitions from zero, not one. So, for example, if GRUB was installed on the third partition of the first hard drive, the "setup" command will look like this:

     grub> setup (hd0,2)

When we get back to the prompt again, we can quit GRUB:

     grub> quit

And then reboot the computer. Remove the live CD from the drive and we should be back to normal.

From http://peppermintos.net/viewtopic.php?f=42&t=1292:

Reinstall Grub 2

If you end up with a Mint, Ubuntu, or Peppermint partition that can not be used because Grub has been destroyed (say, by installing a version of Windows and having it overwrite the boot sector) you can reinstall Grub by using the live installation CD. (Assuming the Linux partition is intact except for Grub)

1. Boot the live CD to the desktop.
2. Open a terminal and enter "sudo mount /dev/sda1 /mnt". replacing sda1 with the proper partition number for your Linux / (root) partition.
3.Once the Linux partition is mounted, reinstall Grub by entering "sudo grub-install --root-directory=/mnt/ /dev/sda".
4. Reboot to check that it worked.

In the situation described where a Windows installation destroys Grub, you should get the full dual boot menu. If not, but the Linux OS boots, try running "sudo update-grub" to pick up the Windows Partition.

Alternative: Boot with Super Gub2 Disk and 'grub-install /dev/sda'.

Comments are closed.