Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been having major headaches with Grub2. I deleted the MBR (its a long story) and I am now trying to restore it. I already restored all of my files, now all I need to do is reinstall grub from my Fedora 18 live CD. I am using grub-install to install grub. /dev/sda is my harddrive. This is how I am executing grub2-install

 grub2-install --root-directory=/mnt /dev/sda

I have my old grub partition mounted to /mnt, and there is not a single thing wrong with it. I would expect this to work, however my computer will not boot. The partition is marked as active of course, and the boot signature has been set. I decided to investigate this my self, so I used hexedit to look at the MBR on /dev/sda. The first several bytes are all null. They should not all be null, the first 446 (or something like that) should contain the first stage bootloader machine code. However it does not. How can I install grub2 to my MBR, because grub2-install is not doing it. Also all I have is my Fedora 18 live CD, and I can not use any other live CDs (another long story)

share|improve this question

1) Boot up a Fedora live-cd macthing the version you are using.

2) Mount your normal system partition. X is the drive letter. Y is the partition number:
mount /dev/sdXY /mnt

3) Only if you have a separate boot partition (where sdXY is the /boot partition designation):
mount /dev/sdXY /mnt/boot

4) Mount the critical virtual filesystems.

mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
mount -t tmpfs /mnt/tmpfs /mnt/tmp

5) Chroot into your normal system device:
chroot /mnt

6) Reinstall GRUB 2 (substitute the correct device with sda, sdb, etc. Do not specify a partition number):
grub2-install /dev/sdX or grub2-install --force /dev/sdX

7) Recreate the GRUB 2 menu file (grub.cfg)
grub2-mkconfig -o /boot/grub2/grub.cfg

8) Exit chroot:
CTRL-D on keyboard

See also:

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .