Unix Technical Forum

Dual boot Win XP / Linux, using grub

This is a discussion on Dual boot Win XP / Linux, using grub within the Linux Operating System forums, part of the Unix Operating Systems category; --> Hi! I just installed Win XP on the first (primary) partition, which was working fine. Then I set up ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 08:33 AM
=?ISO-8859-1?Q?Stefan_S=F6ffing?=
 
Posts: n/a
Default Dual boot Win XP / Linux, using grub

Hi!

I just installed Win XP on the first (primary) partition, which was
working fine. Then I set up Linux (Debian) on the second partition using
a boot floppy, which was still ok.

Then I decided to use grub as boot loader. Since I haven't had any
experience with it, I must have done something wrong here:

I used 'grub-install /dev/hda' to write grub into the MBR and set up the
operating systems in /boot/grub/menu.lst as follows:

---
title Linux
root (hd0,1)
kernel /vmlinuz root=/dev/hda2

title WinXP
rootnoverify (hd0,0)
makeactive
chainloader +1
---

Now I can boot to Linux, but I can't start Windows XP any more (it
simply restarts when selecting the WinXP item).

I wonder where windows XP stores its boot loader. If it was in the MBR
it is overwritten now. But where should I have installed grub instead?

And how can I restore WinXP's boot loader (ntldr)? The problem is, that
I can't boot from CD, so I'm not able to start the Recovery Console.

Is there anyone who could tell what I should have done to get things
working? If someone had a solution to my problem I'd be even more happy,
of course.

Stefan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2008, 08:33 AM
Douglas Mayne
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

On Tue, 21 Oct 2003 23:13:06 +0200, Stefan Söffing wrote:

> Hi!
>
> I just installed Win XP on the first (primary) partition, which was
> working fine. Then I set up Linux (Debian) on the second partition using
> a boot floppy, which was still ok.
>
> Then I decided to use grub as boot loader. Since I haven't had any
> experience with it, I must have done something wrong here:
>
> I used 'grub-install /dev/hda' to write grub into the MBR and set up the
> operating systems in /boot/grub/menu.lst as follows:
>
> ---
> title Linux
> root (hd0,1)
> kernel /vmlinuz root=/dev/hda2
>
> title WinXP
> rootnoverify (hd0,0)
> makeactive
> chainloader +1
> ---
>
> Now I can boot to Linux, but I can't start Windows XP any more (it
> simply restarts when selecting the WinXP item).
>
> I wonder where windows XP stores its boot loader. If it was in the MBR
> it is overwritten now. But where should I have installed grub instead?
>
> And how can I restore WinXP's boot loader (ntldr)? The problem is, that
> I can't boot from CD, so I'm not able to start the Recovery Console.
>
> Is there anyone who could tell what I should have done to get things
> working? If someone had a solution to my problem I'd be even more happy,
> of course.
>
> Stefan
>

It should work- if there are no other errors. I think grub-install failed
for some reason.

I prefer setting up from within the "grub shell," as opposed to
grub-install. From the interactive shell, you can see if there are any
problems with the setup.

$grub
grub>root (hd0,1)
grub>setup (hd0)
grub>quit

Watch for error messages after each command.

Notice the command root (hd0,1) specifies where menu.lst and the rest of
grub is located, not the root filesystem.

--Douglas Mayne
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 08:33 AM
=?ISO-8859-1?Q?Stefan_S=F6ffing?=
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

Douglas Mayne wrote:
> On Tue, 21 Oct 2003 23:13:06 +0200, Stefan Söffing wrote:
>
>
>>Hi!
>>
>>I just installed Win XP on the first (primary) partition, which was
>>working fine. Then I set up Linux (Debian) on the second partition using
>>a boot floppy, which was still ok.
>>
>>Then I decided to use grub as boot loader. Since I haven't had any
>>experience with it, I must have done something wrong here:
>>
>>I used 'grub-install /dev/hda' to write grub into the MBR and set up the
>> operating systems in /boot/grub/menu.lst as follows:
>>
>>---
>>title Linux
>> root (hd0,1)
>> kernel /vmlinuz root=/dev/hda2
>>
>>title WinXP
>> rootnoverify (hd0,0)
>> makeactive
>> chainloader +1
>>---
>>
>>Now I can boot to Linux, but I can't start Windows XP any more (it
>>simply restarts when selecting the WinXP item).
>>
>>I wonder where windows XP stores its boot loader. If it was in the MBR
>>it is overwritten now. But where should I have installed grub instead?
>>
>>And how can I restore WinXP's boot loader (ntldr)? The problem is, that
>>I can't boot from CD, so I'm not able to start the Recovery Console.
>>
>>Is there anyone who could tell what I should have done to get things
>>working? If someone had a solution to my problem I'd be even more happy,
>>of course.
>>
>>Stefan
>>

>
> It should work- if there are no other errors. I think grub-install failed
> for some reason.
>
> I prefer setting up from within the "grub shell," as opposed to
> grub-install. From the interactive shell, you can see if there are any
> problems with the setup.
>
> $grub
> grub>root (hd0,1)
> grub>setup (hd0)
> grub>quit
>
> Watch for error messages after each command.
>
> Notice the command root (hd0,1) specifies where menu.lst and the rest of
> grub is located, not the root filesystem.
>
> --Douglas Mayne


I did so, but everything seems to be ok - no error message. As I wrote
above, booting to linux works fine - I just can't boot to windows.

But can you tell me how this chainloader thing works? Where should be
the ntldr for windows if there's already grub installed in the MBR?

Stefan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 08:33 AM
Douglas Mayne
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

On Wed, 22 Oct 2003 00:02:09 +0200, Stefan Söffing wrote:

> Douglas Mayne wrote:
>> On Tue, 21 Oct 2003 23:13:06 +0200, Stefan Söffing wrote:
>>
>>
>>>Hi!
>>>
>>>I just installed Win XP on the first (primary) partition, which was
>>>working fine. Then I set up Linux (Debian) on the second partition using
>>>a boot floppy, which was still ok.
>>>
>>>Then I decided to use grub as boot loader. Since I haven't had any
>>>experience with it, I must have done something wrong here:
>>>
>>>I used 'grub-install /dev/hda' to write grub into the MBR and set up the
>>> operating systems in /boot/grub/menu.lst as follows:
>>>
>>>---
>>>title Linux
>>> root (hd0,1)
>>> kernel /vmlinuz root=/dev/hda2
>>>
>>>title WinXP
>>> rootnoverify (hd0,0)
>>> makeactive
>>> chainloader +1
>>>---
>>>
>>>Now I can boot to Linux, but I can't start Windows XP any more (it
>>>simply restarts when selecting the WinXP item).
>>>
>>>I wonder where windows XP stores its boot loader. If it was in the MBR
>>>it is overwritten now. But where should I have installed grub instead?
>>>
>>>And how can I restore WinXP's boot loader (ntldr)? The problem is, that
>>>I can't boot from CD, so I'm not able to start the Recovery Console.
>>>
>>>Is there anyone who could tell what I should have done to get things
>>>working? If someone had a solution to my problem I'd be even more happy,
>>>of course.
>>>
>>>Stefan
>>>

>>
>> It should work- if there are no other errors. I think grub-install failed
>> for some reason.
>>
>> I prefer setting up from within the "grub shell," as opposed to
>> grub-install. From the interactive shell, you can see if there are any
>> problems with the setup.
>>
>> $grub
>> grub>root (hd0,1)
>> grub>setup (hd0)
>> grub>quit
>>
>> Watch for error messages after each command.
>>
>> Notice the command root (hd0,1) specifies where menu.lst and the rest of
>> grub is located, not the root filesystem.
>>
>> --Douglas Mayne

>
> I did so, but everything seems to be ok - no error message. As I wrote
> above, booting to linux works fine - I just can't boot to windows.
>
> But can you tell me how this chainloader thing works? Where should be
> the ntldr for windows if there's already grub installed in the MBR?
>
> Stefan
>

AFAIK, three files are necessary to start NT and its derivatives:
ntldr
ntdetect.com
boot.ini

They should reside as files on the windows partition. ntldr and the MBR
code are separate and serve different purposes. In my experience, grub's
mbr code is the best choice for dual boot systems- which chainloads to
the BPB code on the Windows partition: rootnoverify (hd0,0).

I re-read your first post. Were you ever able to start your XP setup
before installing Debian on this disk?

--Douglas Mayne


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-17-2008, 08:33 AM
a user
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

On 2003-10-21, Stefan Söffing <soeffing@gmx.de> wrote:
> Douglas Mayne wrote:
>> On Tue, 21 Oct 2003 23:13:06 +0200, Stefan Söffing wrote:
>>
>>
>>>Hi!
>>>
>>>I just installed Win XP on the first (primary) partition, which was
>>>working fine. Then I set up Linux (Debian) on the second partition using
>>>a boot floppy, which was still ok.
>>>
>>>Then I decided to use grub as boot loader. Since I haven't had any
>>>experience with it, I must have done something wrong here:
>>>
>>>I used 'grub-install /dev/hda' to write grub into the MBR and set up the
>>> operating systems in /boot/grub/menu.lst as follows:
>>>
>>>---
>>>title Linux
>>> root (hd0,1)
>>> kernel /vmlinuz root=/dev/hda2
>>>
>>>title WinXP
>>> rootnoverify (hd0,0)
>>> makeactive
>>> chainloader +1
>>>---
>>>
>>>Now I can boot to Linux, but I can't start Windows XP any more (it
>>>simply restarts when selecting the WinXP item).
>>>
>>>I wonder where windows XP stores its boot loader. If it was in the MBR
>>>it is overwritten now. But where should I have installed grub instead?
>>>
>>>And how can I restore WinXP's boot loader (ntldr)? The problem is, that
>>>I can't boot from CD, so I'm not able to start the Recovery Console.
>>>
>>>Is there anyone who could tell what I should have done to get things
>>>working? If someone had a solution to my problem I'd be even more happy,
>>>of course.
>>>
>>>Stefan
>>>

>>
>> It should work- if there are no other errors. I think grub-install failed
>> for some reason.
>>
>> I prefer setting up from within the "grub shell," as opposed to
>> grub-install. From the interactive shell, you can see if there are any
>> problems with the setup.
>>
>> $grub
>> grub>root (hd0,1)
>> grub>setup (hd0)
>> grub>quit
>>
>> Watch for error messages after each command.
>>
>> Notice the command root (hd0,1) specifies where menu.lst and the rest of
>> grub is located, not the root filesystem.
>>
>> --Douglas Mayne

>
> I did so, but everything seems to be ok - no error message. As I wrote
> above, booting to linux works fine - I just can't boot to windows.
>
> But can you tell me how this chainloader thing works? Where should be
> the ntldr for windows if there's already grub installed in the MBR?
>
> Stefan
>

If you can boot into linux fine and the trouble is with xp, then get
into linux and do a fdisk to see if the xp partition is set as
active. I think most linux installs, well at least SuSE, changes
"active" partition to the linux boot partition.

If the above is true, just "deactive" the linux partition and set the
xp partition active with fdisk. The ntldr is still in the xp partition.

Myself, I prefer to install grub in the linux boot partition and use nt
to give me a selection to boot xp or linux.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-17-2008, 08:33 AM
Jules Dubois
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

On Tue, 21 Oct 2003 23:13:06 +0200, in article
<3f95a17f$0$12506$9b622d9e@news.freenet.de>, Stefan Söffing wrote:

> title WinXP
> rootnoverify (hd0,0)
> makeactive
> chainloader +1
>
> Now I can boot to Linux, but I can't start Windows XP any more (it
> simply restarts when selecting the WinXP item).


What restarts? GRUB? If it's GRUB, do you get an error message?

I can boot Windows 2000 like this (with the 'makeactive' and 'chainloader'
statements in the opposite order, but I seriously doubt this is relevant.)

According to _Linux Administrator Handbook_ (Evi Nemeth, et al.), they have
seen cases where GRUB wouldn't boot Windows and other situations where
Windows' boot loader would boot GRUB.

> I wonder where windows XP stores its boot loader. If it was in the MBR
> it is overwritten now.


XP wrote its primary bootstrap to the MBR. I think the file MS calls the
"boot loader" is c:\ntldr, but there also are other files in c:\ used for
booting.

> And how can I restore WinXP's boot loader (ntldr)?


In the old days, "fdisk /mbr" would do the trick. I read recently some
other command was required for 2000/XP, but I don't seem to have saved the
article.

> Is there anyone who could tell what I should have done to get things
> working? If someone had a solution to my problem I'd be even more happy,
> of course.


Based in the information you gave, that I snipped, it "should" have worked.
If XP is important, there are several other boot methods.

1) save the GRUB boot sector to a floppy (before you overwrite it with
XP's), give XP back its MBR, and use the XP boot loader to load GRUB.
It's a simple process, if a bit tedious

2) try other boot managers. I've had very good luck with System Commander,
but it isn't free. When I got GRUB to boot both Win2000 and Linux, I
stopped using SC immediately.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-17-2008, 08:33 AM
Jules Dubois
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

On Wed, 22 Oct 2003 00:02:09 +0200, in article
<3f95ace7$0$12898$9b622d9e@news.freenet.de>, Stefan Söffing wrote:

> Douglas Mayne wrote:
>> On Tue, 21 Oct 2003 23:13:06 +0200, Stefan Söffing wrote:
>>>title WinXP
>>> rootnoverify (hd0,0)
>>> makeactive
>>> chainloader +1
>>>[...]

>
> But can you tell me how this chainloader thing works?


The combination of "rootnoverify (hd0,0)" and "chainloader +1" tells GRUB
to read the first sector of (hd0,0) [a.k.a. /dev/hda1 and c:] into memory
and then 'execute' it, just like the BIOS would. In theory, there's no
reason why this shouldn't work, but as I mentioned in another article I
just posted, I've read sometimes it just doesn't work.

> Where should be
> the ntldr for windows if there's already grub installed in the MBR?


'ntldr' is just another file in c:\, perhaps with the 'system' and 'hidden'
bits set. It's special to the NT/2000/XP boot process but it's a file.
(If you can boot Linux and mount the NTFS partition, you can find it in the
XP root directory.)

GRUB didn't mess with this file; it doesn't know how to deal with it
either. That's part of what chainloading is all about.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-17-2008, 08:33 AM
Jules Dubois
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

On Wed, 22 Oct 2003 01:21:44 GMT, in article
<slrnbpbmta.10d.paul@crane.li-po.edu>, a user wrote:

> If you can boot into linux fine and the trouble is with xp, then get
> into linux and do a fdisk [...]


Also, check to make sure XP really is (hd0,0).

> [...] to see if the xp partition is set as
> active.


I don't think Windows 2000 or XP "honor" the active flag. On my system,
cfdisk says the "FS Type" of the (NTFS) Windows 2000 partition is "Hidden
HPFS/NTFS". For Windows 2000, I used to use "unhide" and "makeactive" in
GRUB but I took them out and Windows 2000 still booted.

> I think most linux installs, well at least SuSE, changes
> "active" partition to the linux boot partition.


On my system /dev/hda1 (Windows 2000) and /dev/hda3 (Linux /boot) both are
flagged "Boot". I don't think either Linux or Windows cares.

> If the above is true, just "deactive" the linux partition and set the
> xp partition active with fdisk. The ntldr is still in the xp partition.


It's worth a try.

> Myself, I prefer to install grub in the linux boot partition and use nt
> to give me a selection to boot xp or linux.


I like GRUB! When I used LILO, it was annoying to have to copy its updated
boot sector to the WinNT partition after running /sbin/lilo. Fortunately,
that's not a problem with GRUB.

--
"[O]bviously Linux owes its heritage to Unix, but not its code.
We would not, nor will not, make such a claim."
-- Darl McBride. CEO, The SCO Group. August 2002.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-17-2008, 08:33 AM
=?ISO-8859-1?Q?Stefan_S=F6ffing?=
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

Douglas Mayne wrote:
> AFAIK, three files are necessary to start NT and its derivatives:
> ntldr
> ntdetect.com
> boot.ini
>
> They should reside as files on the windows partition. ntldr and the MBR
> code are separate and serve different purposes. In my experience, grub's
> mbr code is the best choice for dual boot systems- which chainloads to
> the BPB code on the Windows partition: rootnoverify (hd0,0).
>
> I re-read your first post. Were you ever able to start your XP setup
> before installing Debian on this disk?


Yes, I was.

But I'm no longer sure, where the problem really is. As you wrote, all I
should need to boot XP are those three files. So I got a boot floppy,
containing these files and tried to boot. I finally got the Windows
"boot loader" (where I could choose the partition to boot from -
according to the settings in boot.ini), but all I got was a message
telling me somehting about a disk error.

Well, since I've got too much spare time, I'll try to reinstall WinXP
now :-/

Stefan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-17-2008, 08:34 AM
=?ISO-8859-1?Q?Stefan_S=F6ffing?=
 
Posts: n/a
Default Re: Dual boot Win XP / Linux, using grub

Jules Dubois wrote:

>>But can you tell me how this chainloader thing works?

>
>
> The combination of "rootnoverify (hd0,0)" and "chainloader +1" tells GRUB
> to read the first sector of (hd0,0) [a.k.a. /dev/hda1 and c:] into memory
> and then 'execute' it, just like the BIOS would. In theory, there's no
> reason why this shouldn't work, but as I mentioned in another article I
> just posted, I've read sometimes it just doesn't work.


What should it find in this first sector? Is is this ntldr file or some
piece of code that will the ntldr? How can I make sure that the first
sector contains this special file (ntldr) and not something else?


>>Where should be
>>the ntldr for windows if there's already grub installed in the MBR?

>
>
> 'ntldr' is just another file in c:\, perhaps with the 'system' and 'hidden'
> bits set. It's special to the NT/2000/XP boot process but it's a file.
> (If you can boot Linux and mount the NTFS partition, you can find it in the
> XP root directory.)
>
> GRUB didn't mess with this file; it doesn't know how to deal with it
> either. That's part of what chainloading is all about.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:18 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com