LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Booting into Winblows XP with GRUB (http://www.linuxquestions.org/questions/linux-software-2/booting-into-winblows-xp-with-grub-529645/)

Scotteh 02-16-2007 10:51 AM

Booting into Winblows XP with GRUB
 
I know this is a common problem, but I've tried every solution that I've seen, and nothing works.

My hard drive setup:
/dev/hda1 = Debian
/dev/hda2 = Winblows XP

Relevent menu.lst lines:
title Debian GNU/Linux, kernel 2.6.18-4-486
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-4-486 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.18-4-486
savedefault

title Windows XP Professional (BOO!)
root (hd0,1)
chainloader +1

I previously had Windows XP installed on my computer, and I could boot into either OS fine, but I repartitioned to give Debian more space, and when a finally had a reason to use Windows (I find Palm Desktop much better than KPilot), I installed Windows and now I can't get GRUB to work. When I select Windows XP from the GRUB menu, It flashes some output and then goes right back to the menu.

Anyone feel like helping me tackle this problem?

pljvaldez 02-16-2007 12:06 PM

You can try changing "root" to "rootnoverify". Also, you might check your device map in the boot menu and fdisk -l to make sure they agree with your setup.

saikee 02-16-2007 12:11 PM

Try add
Code:

makeactive
before the "chainloader +1" statement

Scotteh 02-17-2007 08:39 AM

I've tried having makeactive before chainloader before as well as having rootnoverify instead of root, but have had the same result.

Code:

~; sudo fdisk -l
  Device Boot      Start        End      Blocks  Id  System
/dev/hda1              1        7295    58597056  83  Linux
/dev/hda2  *        7296        9666    19045057+  c  W95 FAT32 (LBA)
/dev/hda3            9667        9729      506016  82  Linux swap / Solaris

That's really weird. It's still saying my Windows partition is the booting partition...

saikee 02-17-2007 09:40 AM

Just a very basic question.

How do you convince us that your XP has been installed and work satisfactorily?

You said XP has been re-installed and you expect Grub to boot it. Had XP been installed properly we would expect NTLDR to nuke Grub away and take over the MBR by now. Have you re-installed Grub back to the MBR since?

If you omitted the above step then may be your XP wasn't in a working order any way. In such a case Grub just loads a faulty system that isn't bootable.

Scotteh 02-18-2007 08:38 AM

Quote:

How do you convince us that your XP has been installed and work satisfactorily?
I get down on my knees and beg. ;) lol

I installed Windows and installed my Palm software, then restored GRUB by using the Debian install disk. NTLDR did nuke GRUB, but I couldn't get GRUB to work with Windows after I had reinstalled GRUB.

Is there still a chance that Windows wasn't installed correctly? I would expect not, but I don't know that much about this kind of stuff.

saikee 02-18-2007 09:03 AM

OK I accept you have tested the XP before restoring Grub.

Let's get into the meat of it then.

You have Debian Grub. At the boot screen instead of choosing a system to boot press the "c" key to drop into a Grub prompt. You then boot both systems manually.

For XP try commands
Code:

root (hd0,1)
chainloader +1
boot

for Debian use
Code:

root (hd0,0)
kernel /boot/vmlinuz-2.6.18-4-486 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.18-4-486
boot

If you don't want to do typing the red bits can be replaced by the bule bit below
Code:

configfile /boot/grub/menu.lst
Pay attention to the Grub response if any system that doesn't boot and report back.

If Grub boots both system then then the Grub in MBR may be defective. You can restore Grub again by these two commands in a Grub prompt
Code:

root (hd0,0)
setup (hd0)


Scotteh 02-19-2007 08:24 AM

Code:

grub> root (hd0,0)
Filesystem type is reiserfs, partition type 0x83

grub> kernel /boot/vmlinuz-2.6.18-4-486 root=/dev/hda1 ro
[Linux-bzimage, setup=0x1e00, size=0x127d63]

grub> initrd /boot/initrd.img-2.6.18-4-486
[Linux-initrd @ 0xfbc0000, 0x42b3e1 bytes]

grub> boot

Success. Now for Winblows...

Code:

grub> root (hd0,1)
Filesystem type is fat, partition type 0xc

grub> chainloader +1

grub> boot
GRUB Loading stage2...

And back to the GRUB menu... :mad:

Code:

grub> root (hd0,0)
Filesystem type is reiserfs, partition type 0x83

grub> setup (hd0)

That succeeded, but booting into Windows still didn't work. The same thing happened - it just went right back to the GRUB menu.

I'm concerned about my fdisk -l output.
Code:

~; sudo fdisk -l
  Device Boot      Start        End      Blocks  Id  System
/dev/hda1              1        7295    58597056  83  Linux
/dev/hda2  *        7296        9666    19045057+  c  W95 FAT32 (LBA)
/dev/hda3            9667        9729      506016  82  Linux swap / Solaris

I don't like the asterisk under "Boot" for Windows. Any thoughts?

dubz_444 02-19-2007 08:49 AM

for 2 weeks i booted my windows like this due to shear laziness
Code:

root (hd0,1)
rootnoverify
makeactive
chainloader +1
boot

if you just dump this straight into /boot/grub/menu.1st it shall work


important!!

root (hd0,1). make sure this is the correct partition. hd0 - first hd. 1 being second partition on first hd

although from your post that should be correct

saikee 02-19-2007 11:33 AM

The asterisk next to hda2 means it has been marked bootable. Since Debian doesn't use the bootable flag and you wouldn't touch it and so I didn't ask you to put in the statement
Code:

makeactive
as suggested by dubz 444.

The
Code:

rootnoverify
of dubz 444 also does little. Grub can save 1/100 second for no need to verify the XP partition but that is no concern of mind if it takes it another 1/100 second to verify it.

My conclusion on your current situation is that your XP may not be operational after the resizing exercise

I would drop a used floppy and save the Grub configuration in Debian terminal by command
Code:

sudo grub-install /dev/fd0
I shall then restore XP's MBR following the Task B1 or B2 in the last link of my signature, so that I can run XP and repair it. If I need Debian I use the floppy.

When both systems are back to normal I restore Grub back to the MBR by
Code:

sudo grub-install /dev/hd0

Scotteh 02-19-2007 04:25 PM

I just read something from your "Just booting tips" post, and it got me thinking... Would making my Windows Fat32 partition "logical" vs. "primary" make a difference? If so, is there a way to change the Windows partition to being primary without affecting my Linux partition? Reformatting my Linux partition is not an option I will entertain.

saikee 02-19-2007 06:39 PM

Your XP will not boot from a logical partition. XP can only be installed in a logical partition if you have another primary partition to house the NTLDR boot loader. In any case that is a re-installation you are talking about.

If you restore the XP's MBR then Linux is out of the way as far as XP is concerned and nobody can blame Linux if XP doesn't boot.

As with every resizing exercise you must check the health of the system after each step before leaping onto another one. Whenever a fat partition is involoved you should reboot otherwise you may be writing information wrongly because the Bios still working with the old hard disk setting.

The current information suggests when you boot XP Grub reported back it found partition type 0xc which is a fat32 and the only such partition is hda2. Therefore Grub has located it correctly but XP refuses to take control when it is given the driving seat by Grub.

My advice of restoring XP's MBR does not involve a re-installation but will get you back a 100% XP environment and so you will be able to see what error is being reported. At the moment you don't even know what is wrong with the XP partition.

Scotteh 02-20-2007 06:10 AM

So you're recommending I reinstall Windows to see what it says about being a logical partition?

Is there any way to change Windows to a primary partition without affecting the data on my Linux partition?

saikee 02-20-2007 07:11 AM

What make you think your XP is in a logical partition?

In Linux the first 4 partitions are reserved primaries. Since you do not have any partition higher than hda4 you haven't got any logical partition in your PC.

I do not recommend to reinstall XP.

I recommend to "restore" XP's MBR and that is the first 512 bytes of its boot loader.

MS has a common MBR. The role of this MBR is like a blind man searching the 4 primary partition. If it finds a primary partition has the booting flag in the "on" or "active" position (or marked bootable in Linux term) it loads that partition into the memory. That is why a standalone MS system must be installed in a primary partition.

If you have restore MS MBR the it is MS's own MBR booting XP. Grub is removed. The hard disk is under 100% MS system control. Hopefully you will see some error messages.

Restoring XP's MBR is a reversible operation.

Re-installing XP "may" not be reversible unless you know what you are doing.


All times are GMT -5. The time now is 01:11 AM.