Grub not loading after upgrade from Vista to Windows 7
On my work laptop, I dual-boot Windows Vista Enterprise (in case it's necessary at a customer site) and Gentoo (if I get to do things my way ;-) ). I recently decided to upgrade Vista to Windows 7, which worked just fine (after installing a meeljon updates - it had been a while).
As expected, Windows 7 obliterated my MBR. Bye-bye GRUB, Gentoo LiveCD to the rescue!
In the livecd I mounted my / (on /dev/sda3), /proc and /dev to /mnt/gentoo and chrooted in:
# mount /dev/sda3 /mnt/gentoo
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# chroot /mnt/gentoo /bin/bash
Now run grub, let it re-write itself to the MBR and everything's happyhappy-joyjoy again, right?
# grub
grub> root (hd0,2)
grub> setup (hd0)
grub> quit
# reboot
Right after POST, I get greeted by a blinking cursor, and that's it. No GRUB, no message, nothing. Just that blinking cursor, mocking me. Back to the livecd, and chrooting into my gentoo installation once again. I used to use grub-install, so I decided to try that again (important: after chrooting - it's not necessary but the command is different!)
# grub-install /dev/sda
/dev/sda does not have any corresponding BIOS drive
Apparently GRUB doesn't have a proper device map. Time to refresh it:
# grub-install --recheck /dev/sda
/dev/root: not found or not a block device
This one is new ... df -h reveals that / is mounted as /dev/root, instead of the expected /dev/sda3 and that /dev/root does not exist (of course - that bind command I used right before chrooting? /dev/root didn't exist in the livecd environment). A symlink ought to fix this:
# ln -s /dev/sda3 /dev/root
# grub-install /dev/sda
One reboot later my grub is back where it's always been, offering me the choice between Gentoo and Windows 7.
