Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 Answer 1

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
reboot

See also: http://unix.stackexchange.com/questions/72592/chroot-in-to-reinstall-grub2-reinstall-mnt-is-empty
https://ask.fedoraproject.org/question/10666/install-grub2-to-a-partition/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.