This is not actually a question. It's a solution. I've gotten so much help over the last few months from google searches that ended up pointing me at linuxquestions.org, that I thought I'd help give something back by posting a solution to a problem I had. I'm hoping someone else with the same problem ends up benefitting from this in some random google search.
The Problem
Okay, did this ever happen to you?
You're doing a kernel update, and as part of that process you decide to run grub-install,
and you have a dual-boot system with Windows XP on the first partition of the same disk as your linux installation. (for example: windows = /dev/hda1, and linux = /dev/hda2)
And then your stupid habitual fingers, going faster than your brain, make the mistake of typing this:
Code:
grub-install /dev/hda1
when you should have typed this:
Code:
grub-install /dev/hda
And as a result, you've just clobbered your windows XP boot loader. You didn't destroy grub from the MBR, and therefore you still see the grub menu as the first thing when you boot, but now if you pick Windows XP from the menu, nothing happens. It pops you right back to the menu again.
Another symptom of this problem is that you will be unable to mount the windows partition from linux, even if you have the linux ntfs driver in place - the ntfs driver will no longer recognize the partition as being of type ntfs even though it really is.
Well, that's exactly what happened to me. I looked around for a solution but everything I found kept telling me all about the master boot record (MBR) and that's not what I'd clobbered. What I needed to do was put the windows boot loader program back where it was on /dev/hda1.
The Solution
Here is the list of steps that fixed this for me:
0 - Make sure you have both your Windows XP installation CD and your Linux rescue boot CD on hand.
1 - Boot from the Windows XP installation CD. After a few minutes of hardware
discovery, you will get to a menu. Pick "R" - the option to recover an installation.
2 - This dumps you to a recovery C:\> prompt. At this prompt, use BOTH the
FIXMBR and
FIXBOOT commands (no parameters). Most other online advice just mentions FIXMBR because it is trying to address a simpler problem than what I had.
3 - type
at the recovery prompt - this triggers a reboot - remove the CD and let the machine boot from the hard drive.
4 - Now the system will come up into Windows XP and act as if the Linux partition is not there. Don't worry. It's still there. It's just that the grub boot loader got clobbered. Putting it back is the next step.
5 - After verifying that Windows XP is back again and working, reboot the computer and this time use the linux rescue CD to boot from.
6 - boot into rescue mode (for example, enter "linux rescue" at the boot prompt for redhat or fedora installations.)
7 - mount your linux partition to a temp dir, eg:
Code:
mkdir /mnt/my_system
mount -t ext3 /dev/hda2 /mnt/my_system
(Obviously that example assumes your linux partition is /dev/hda2 and that it is of type EXT3. Alter the command appropriately for your system.)
8 - change-root to the system so paths from '/' are on your linux partition and not the rescue CD's ramdisk:
Code:
chroot /mnt/my_system
9 - Assuming you haven't fiddled with your grub.conf file, it should still be set up correctly the way it was before. To put grub back in charge again instead of Windows' brain-damaged boot loader, re-run grub-install now
Code:
grub-install /dev/hda
CAREFUL not to make the same mistake as before by saying /dev/hda1 again. Check, double check, and triple check that you are writing to the device name for the disk as a whole, not to the device name for one of its partitions.
10 - That should do it.
, and give it a try. Your grub menu should be restored as it once was, and if it had an entry for booting into Windows XP that should be working again.