How to boot XP first instead of SUSE?

First of all, let me introduce myself. I am a first year computer science student, and the only reason why I have SUSE installed really is because my lecturer asked us to. :smiley: Nice to meet you all.

Okay I have got a bit of an unusual situation here. I originally have Windows XP installed on my local harddisk, and I installed SUSE on a USB harddisk. But because SUSE overwrote the booting software, I can now only turn on my computer if I have my USB harddisk plugged in.

Is there a way to solve this so that I can load windows normally, and load SUSE when the USB harddisk is plugged in? Thank you.

Well, we only help willing users, so see ya 'round . . .

Just kidding :wink:

Unfortunately, this can get rather complex. The reason is that what works is dependent upon the bios in more than one way - first, whether the bios can boot from USB and second what the bios writes to its hardware map because this is all the boot loader can see.

You don’t mention your version of Windows. If you have Vista, the Vista boot loader can be configured to optionally boot the USB drive. This is the best solution, if possible.

If you have XP, then the simplest approach is if the bios can boot from USB; can it? (Some bios’s offer an on-the-fly boot disk menu, thus avoiding having the make the change to cmos.) If it can, then you just set up both OS’s boot independently of one another, i.e., when the Windows disk is configured to boot, you get Windows. And when you want to boot openSUSE, you switch the boot configuration to the USB drive. Unfortunately, the XP boot loader (ntldr) cannot chain across the USB channel even if the bios supports it, unlike the linux boot loader (which is what is happening now).

So, will either of the above work on your machine? If so, I’ll give you instructions.

Thanks for the reply,

I am using Windows XP right now, and I can choose to boot from USB in my BIOS. If I set up seperate boot configuration for each OS, and I place the USB drive before the internal drive in the BIOS boot seqeucne, that should mean I would only boot SUSE if the USB drive is plugged in right? (All this computing stuff is… scary.)

Thank you very much.

All you have to do is goto yast system bootloader highligjt windows and set as default then your system will boot into windows

All you have to do is goto yast system bootloader highligjt windows and set as default then your system will boot into windows

Sorry, but this is not correct. OP needs to boot Windows without USB drive engaged. Currently grub is in internal drive’s MBR with a pointer to SuSE’s root partition on the USB drive, which is why the USB must be on for boot to work.

I am using Windows XP right now, and I can choose to boot from USB in my BIOS. If I set up seperate boot configuration for each OS, and I place the USB drive before the internal drive in the BIOS boot seqeucne, that should mean I would only boot SUSE if the USB drive is plugged in right? (All this computing stuff is… scary.)

You are correct. In this approach, you setup the USB and the internal to boot independently of one another. The controlling factor will not be whether the USB is engaged or not, but rather the bios boot sequence configuration. This is changed in either the bios setup program and saved to cmos, or with some bios’s there is an option to change the boot sequence on-the-fly (like with a boot menu or a hot-key sequence) thus eliminating the need to go into the bios setup.

There is more than one way to do this. First, do you by chance have an XP installation CD? Second, does you machine have a floppy drive? Third, is your machine a laptop or a desktop; if a desktop, is the internal disk easily accessible? Fourth, please boot into openSUSE, open a terminal window, switch to root (the “su” command), and then do this:


fdisk -lu

And post the output back here along with the answers to the questions. Then I can give you the detailed instructions.

If it works it is correct I have had OS’s on usb and easily changed from usb boot to internal hd boot with this method.

That depends on the machine, i.e., how the bios handles USB boot, what the bios writes to the hardware map, what boot code is installed to the IPL of the MBR, whether grub is installed to the PBR, and how grub is configured. In this case grub’s stage1 has already been installed to the internal drive’s IPL with an embedded pointer to grub’s stage2 on the USB drive. Consequently, booting from the internal with the USB drive powered off/disconnected will cause grub stage1 to fail because it cannot find stage2. And booting directly from the USB will fail because there is no IPL installed on that drive. Simply reconfiguring the grub control file to chainload to the Windows PBR will not resolve this. Furthermore, the XP boot loader cannot be used to chainload to grub in the USB root PBR because ntldr does not read the bios map; it is limited to looking for a chainloading sector in its own partition (however, Vista can do this, and would be the solution I would have advised if the machine had Vista rather than XP).

I don’t have the Windows XP installation Disk unforunately - new IBM laptops have a built in recovery software, so an installtion CD is not necessary.

My computer is a laptop, and it doesn’t have a floppy drive.

Disk /dev/sda: 100.0 GB, 100030242816 bytes
240 heads, 63 sectors/track, 12921 cylinders, total 195371568 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xcccdcccd

Device Boot Start End Blocks Id System
/dev/sda1 * 63 185114159 92557048+ 7 HPFS/NTFS
/dev/sda2 185114160 195365519 5125680 12 Compaq diagnostics

Disk /dev/sdb: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders, total 195371568 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x4dba1ab7

Device Boot Start End Blocks Id System
/dev/sdb1 * 63 133114589 66557263+ 7 HPFS/NTFS
/dev/sdb2 133114590 195366464 31125937+ f W95 Ext’d (LBA)
/dev/sdb5 133114653 137323619 2104483+ 82 Linux swap / Solaris
/dev/sdb6 137323683 161035559 11855938+ 83 Linux
/dev/sdb7 161035623 195366464 17165421 83 Linux

sda is the internal disk, and sdb is the USB drive. The sda2 partition is the built in IBM recovery software.

Again, thanks for the help.

The questions were to determine what the prospects were of doing this the easy way. With an XP installation CD, you could quickly replace the MBR boot code on sda, which you need to do. (The recovery partition only permits re-imaging the disk with the OS as it left the factory - this is a MS licensing constraint). You could have also got this done creating an XP boot floppy and copying code from it, but that’s out too. So . . .

I suggest downloading a free utility called MbrFix. It runs from the command line and is easy to do; it comes with documentation. It can be downloaded from many sites (just google it, you’ll get a lot of hits), I suggest looking for the later version with includes Vista support, but any version will do. Reinstall the MBR boot code and set the internal drive for boot from the bios and XP should boot.

Then you will need to install and set up the boot loader in the USB drive. What did you install openSUSE with, LiveCD or DVD?

The questions were to determine what the prospects were of doing this the easy way. With an XP installation CD, you could quickly replace the MBR boot code on sda, which you need to do. (The recovery partition only permits re-imaging the disk with the OS as it left the factory - this is a MS licensing constraint). You could have also got this done creating an XP boot floppy and copying code from it, but that’s out too. So . . .

I suggest downloading a free utility called MbrFix. It runs from the command line and is easy to do; it comes with documentation. It can be downloaded from many sites (just google it, you’ll get a lot of hits), I suggest looking for the later version with includes Vista support, but any version will do. Reinstall the MBR boot code and set the internal drive for boot from the bios and XP should boot.

But hold off replacing the XP boot code until we have determined how you are going to install and set up the boot loader in the USB drive. What do you have, LiveCD or DVD? Boot into openSUSE, open a terminal window, and as root do the following and post the outputs back here:

cat /boot/grub/device.map
cat /boot/grub.menu.lst
cat /etc/grub.conf

CHAVAZ:/home/thomas # cat /boot/grub/device.map
(hd0) /dev/sda
(hd1) /dev/sdb
CHAVAZ:/home/thomas # cat /boot/grub.menu.1st
cat: /boot/grub.menu.1st: No such file or directory
CHAVAZ:/home/thomas # cat /etc/grub.conf
setup --stage2=/boot/grub/stage2 (hd0) (hd1,5)
quit

Actually, my father does have an XP installation disc, but it is of an older version of XP. Would that work?

I have the LiveCD version of SUSE. btw, what does “cat” stand for in the commands that you gave me?

Thanks.

snapperfishes wrote:
>> CHAVAZ:/home/thomas # cat /boot/grub/device.map
>> (hd0) /dev/sda
>> (hd1) /dev/sdb
>> CHAVAZ:/home/thomas # cat /boot/grub.menu.1st
>> cat: /boot/grub.menu.1st: No such file or directory
>> CHAVAZ:/home/thomas # cat /etc/grub.conf
>> setup --stage2=/boot/grub/stage2 (hd0) (hd1,5)
>> quit
>
> Actually, my father does have an XP installation disc, but it is of an
> older version of XP. Would that work?
>
> what does “cat” stand for in the commands that you gave me?

Hey, ‘cat’ is a command line program…cat is short for concatenate…

cat /boot/grub/menu.lst (note, that is l as in L not 1 as in one) will print
out the full contents of the file named menu.lst, located in /boot/grub/

in yours, above mingus had accidentally typed a . between grub and menu AND then
you typed a 1 instead of an l…

try again and report the output back to mingus725 :slight_smile:

above mingus had accidentally typed a . between grub and menu

Thanks for the catch. Sorry about that.

Yes, AFAIK any version of XP will work. That is definitely preferable to a program that only runs within Windows; the installation media is bootable.

And I forgot to ask for this file as well, so please do:

cat /etc/fstab

And post the contents back here along with the menu.lst.

CHAVAZ:~ # cat /boot/grub/menu.lst

Modified by YaST2. Last modification on Mon Dec 1 01:15:50 GMT 2008

default 0
timeout 8
gfxmenu (hd1,5)/boot/message

###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

###Don’t change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe – 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 showopts ide=nodma apm=off acpi=off noresume nosmp noapic maxcpus=0 edd=off x11failsafe vga=0x345
initrd /boot/initrd-2.6.25.18-0.2-pae

###Don’t change this comment - YaST2 identifier: Original name: windows 1###
title windows 1
rootnoverify (hd1,5)
chainloader (hd0,0)+1

###Don’t change this comment - YaST2 identifier: Original name: Vendor diagnostic###
title Vendor diagnostic
rootnoverify (hd1,5)
chainloader (hd0,1)+1

###Don’t change this comment - YaST2 identifier: Original name: windows 2###
title windows 2
rootnoverify (hd1,5)
chainloader (hd1,0)+1

CHAVAZ:~ # cat /etc/fstab

/dev/disk/by-id/usb-ST910082_4A-0:0-part5 swap swap defaults 0 0
/dev/disk/by-id/usb-ST910082_4A-0:0-part6 / ext3 acl,user_xattr 1 1
/dev/disk/by-id/usb-ST910082_4A-0:0-part7 /home ext3 acl,user_xattr 1 2
/dev/disk/by-id/scsi-SATA_HTS541010G9SA00_MP2ZM4X0JXEHLR-part1 /windows/C ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_GB.UTF-8 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0

Too many weird words… I can’t interpret the output at all…rotfl!

er… looks like the forum automatically removes extra spaces. Now everything is cramped up together.

Bump - 10 char

I think you meant:su -c ‘cat /boot/grub/menu.lst’ #and enter root password when prompted.

Right. That was caught in post #11 above.

@snapperfishes -

I missed your response several days ago. I’ll take a look and get back to you a bit later.

yes … apologies … I’m bad. :open_mouth: I should have kept on reading the thread.

OK, first to review a few important details . . .

If I set up seperate boot configuration for each OS, and I place the USB drive before the internal drive in the BIOS boot seqeucne, that should mean I would only boot SUSE if the USB drive is plugged in right?

Probably. On my test machine, this is exactly what happens, that is, the bios not finding the USB drive it goes to the next configured boot device which is the internal drive, and it boots. Having said that, on this very same machine with the boot loader on a USB stick, which also boots fine, if the USB stick is removed the bios does not go to the next device, it just hangs. The behavior of USB boot devices is highly unpredictable; it is a consequence of how the bios is written to handle these devices.

Next, there is a grub design attribute that is critical to understand. Grub needs to know the sequence of boot devices as configured in the bios - and that is going to be the opposite of when booting from the internal disk. In other words, when booting from the internal disk, sda = grub’s (hd0). But when booting from the USB, it is sdb = (hd0) because sdb is first now instead. So there are 3 steps to do, to accomplish your objective: Install grub to the USB’s MBR, change grub’s device.map that defines the new boot sequence, and change grub’s menu.lst to be consistent with that. By the way, strongly advise you print all this. And please take your time to do this carefully, one typo could mess it up.

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, 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 following:

###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, going into the bios and changing the boot configuration to be USB first, internal second. Save, reboot. You should see the changed menu per above, and selecting the “11.0 USB Boot” choice should boot openSUSE.

Now reboot, removing the USB drive first. What should happen 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, or alternatively, reboot from the XP CD, navigate into the Recovery Console, and at the command line use the /fixmbr command. (Note: the CD will ask you for the XP “Administrator” user password; you must know that to get in!). Now reboot and you should go straight into Windows. 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.

Good luck!

Thanks for the instructions… but it seems like there is still one more problem left to solve.

I followed your instructions up to this line

Save the file. Close down and reboot, going into the bios and changing the boot configuration to be USB first, internal second. Save, reboot. You should see the changed menu per above, and selecting the “11.0 USB Boot” choice should boot openSUSE.

Just as you said, selecting the USB Boot choice boots into SUSE. However, when I unplug the USB drive and reboot the computer, a grub error appears instead of the text menu. So I went to the BIOS, and changed the boot sequence to internal HDD first. Reboot and the same error message appears. I plugged in the USB, rebooted and now the text menu appeared.

Since it is sort of working now, I continued on and inserted the Windows XP CD. I removed the USB and then rebooted the computer using the CD. However, when the CD finishes loading it gave an error saying “No harddrive detected”.

It seems like that for some reason the internal HDD cannot run without running the USB HDD first. Do you think you can help me with this?

Thank you very very much.