If you have ever mistakenly installed grub (or any other boot manager) onto the MBR of the wrong drive (usually during setting up additional multi-boot OSs), you’ll know it can be a pain to get rid of. Most sources out there are for when you accidentally override the windows boot manager with an common *nix one (grub or lilo). This involves using the windows “repair” console on the CD. When you are running a pure linux system, this isn’t a useful option. This is the solution I found to wipe and re-install grub:
This will probably need to be done from a live CD, as if your MBR is broken, you probably can’t boot your installed system.
1. Wipe the MBR
The first 446 bytes of the drive make up the Master Boot Record, the next 66 (totalling 512) is partition information, you probably don’t want to wipe that unless you intend of re-partitioning (and/or formatting) your disk anyway.
Use dd
to “zero” those 446 bytes:
1
|
|
2. Chroot into your installed system
Set up and chroot
into your main OS
1 2 3 4 5 |
|
3. Reinstall grub in the correct MBR
Start the grub
console
1
|
|
then, at the grub prompt:
1 2 3 |
|
If you “boot” is not on a seperate partition, you the first line might need to be
1
|
|
Assuming your configuration is correct (i.e doesn’t need to be changed since before it broke) you should now be able to boot into your installed system again.