Situation:
You have Windows XP installed on your computer’s internal drive, and then you installed openSUSE in an external hard drive. The installation has overwritten the booting sequence in your internal drive, and you can no long boot into Windows directly without the external drive.
Before starting, please print all of this. And take your time to do this carefully, one typo could mess it up.
Also, your BIOS boot sequence should be set as external first, then internal. (Otherwise your computer won’t be able to boot up anyway.)
Solution:
So first, boot into openSUSE, open a terminal window, switch to root (the “su -” command), and do:
grub
root (hd1,5)
setup (hd1) (hd1,5)
quit
The setup command should tell you it found grub stage1 and stage2, and should tell you it succeeded installing to (hd1), which is the USB MBR (remember, having booting from the internal, at this moment the USB is (hd1), not yet (hd0)).
Now press Alt-F2 and type this in the run dialog box:
kdesu kwrite /boot/grub/device.map
If you are using gnome, substitute “gnomesu gedit” for “kdesu kwrite”. Change what you have now which is this:
(hd0) /dev/sda
(hd1) /dev/sdb
to this; the reverse:
(hd1) /dev/sda
(hd0) /dev/sdb
And save the file. Now while still in kwrite/gedit, open /boot/grub/menu.lst. For safety, we will create a new stanza for your new boot configuration, before removing what is there now. So copy the first stanza, which should look like this:
###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.0 - 2.6.25.18-0.2
root (hd1,5)
kernel /boot/vmlinuz-2.6.25.18-0.2-pae root=/dev/disk/by-id/usb-ST910082_4A-0:0-part6 resume=/dev/sdb5 splash=silent showopts vga=0x345
initrd /boot/initrd-2.6.25.18-0.2-pae
paste it just below what you copied, being sure to allow a blank line in-between the preceding and following stanzas, and change the pasted text to this:
###Don't change this comment - YaST2 identifier: Original name: linux2###
title openSUSE 11.0 - USB Boot
root (hd0,5)
kernel /boot/vmlinuz-2.6.25.18-0.2-pae root=/dev/disk/by-id/usb-ST910082_4A-0:0-part6 resume=/dev/sdb5 splash=silent showopts vga=0x345
initrd /boot/initrd-2.6.25.18-0.2-pae
Note that lines 1,2, and 3 are changed. Now on this line near the top, change this:
gfxmenu (hd1,5)/boot/message
to this:
gfxmenu (hd0,5)/boot/message
Save the file. Close down and reboot. You should see the changed menu per above, and selecting the “11.0 USB Boot” choice should boot openSUSE.
Now reboot, and change the BIOS boot sequence to internal first, then external. What should happen now is that you should see the openSUSE menu again, but it will be a text menu instead and you’ll see an error telling you it could not find the grub graphical screen. This is because grub is still in the internal disk’s MBR pointing to that same grub menu file.
Select Windows and boot into it. Now use the FixMbr utility to reinstall the Windows MBR into the internal disk. You can download this here. Extract the content of the compressed file to C:/Document and Settings/[your user name]. Now go to Run and type in cmd. To be safe, remove the external drive first. Now type in the following
MbrFix /drive 0 driveinfo
You should get 6 lines of information about your internal drive. This will confirm that drive 0 is your internal drive. Now type in the following.
mbrfix /drive 0 fixmbr /yes
Oddly enough, you won’t actually see anything happen. Your screen may flash for 1/10 of a second, but other than that, nothing interesting. Now reboot and you should go straight into Windows. Plug the external drive in, switch the bios back to booting USB first, and you should get the openSUSE menu.
Once you have it all working you may want to clean up the /boot/grub/menu.lst file, e.g., removing the first stanza which will not work now and changing the third stanza to use the same root line as the one you changed. You also don’t need that “windows 2” stanza.
Further information for Vista users ONLY:
Now type in the following.
MbrFix /drive 0 fixmbr /yes /vista
Oddly enough, you won’t actually see anything happen. Your screen may flash for 1/10 of a second, but other than that, nothing interesting. Now reboot and you should go straight into Windows. Plug the external drive in, switch the bios back to booting USB first, and you should get the openSUSE menu.
(Note that “/vista” is added behind the code.")
Additional credits:
Thanks to Mingus725 for technical guidance that permitted the creation of this how-to.