keyongtech


  keyongtech > linux.setup > 10/2003

 #1  
10-21-03, 10:13 PM
Stefan Söffing
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:
 #2  
10-21-03, 10:34 PM
Douglas Mayne
On Tue, 21 Oct 2003 23:13:06 +0200, Stefan Söffing wrote:

[..]
>
> 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
 #3  
10-21-03, 11:02 PM
Stefan Söffing
Douglas Mayne wrote:
[..]
> 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
 #4  
10-22-03, 12:16 AM
Douglas Mayne
On Wed, 22 Oct 2003 00:02:09 +0200, Stefan Söffing wrote:

> Douglas Mayne wrote:
>
> 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
 #5  
10-22-03, 02:21 AM
a user
On 2003-10-21, Stefan Söffing <soeffing> wrote:
> Douglas Mayne wrote:
>
> 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.
 #6  
10-22-03, 04:01 AM
Jules Dubois
On Tue, 21 Oct 2003 23:13:06 +0200, in article
<3f95a17f$0$12506$9b622d9e>, 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.
 #7  
10-22-03, 04:01 AM
Jules Dubois
On Wed, 22 Oct 2003 00:02:09 +0200, in article
<3f95ace7$0$12898$9b622d9e>, 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.
 #8  
10-22-03, 04:17 AM
Jules Dubois
On Wed, 22 Oct 2003 01:21:44 GMT, in article
<slrnbpbmta.10d.paul>, 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.
 #9  
10-22-03, 10:20 AM
Stefan Söffing
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
 #10  
10-22-03, 02:43 PM
Stefan Söffing
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?
[..]
 #11  
10-22-03, 04:39 PM
Douglas Mayne
On Wed, 22 Oct 2003 07:43:36 -0600, Stefan Söffing wrote:

> Jules Dubois wrote:
>> 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?
>
> <snip>
>

The windows boot sector code is not "ntldr," but it is the code which
looks for and loads ntldr. The grub loader transfers control (chainloads)
to the boot sector code. Aside: if you try to chainload directly to
ntldr, then grub will report "unknown executable."

The windows boot sector code will be written to the partition when it is
formatted by Windows "disk administrator" or by Windows setup. If you were
to format the partition with some other tool, then there is no guarantee
the boot code will be written to the sector. However, there is a tool
called mkbt.exe which can be used to repair this sector- see documentation
for mkbt.exe (google) for details.

--Douglas Mayne
 #12  
10-22-03, 07:25 PM
Jules Dubois
On Wed, 22 Oct 2003 15:43:36 +0200, in article
<3f96898c$0$19447$9b622d9e>, Stefan Söffing wrote:

I notice Mr. Mayne has already posted an informative follow-up
<bn69a8$6uq$1>. I'll just add a few more words.

> Jules Dubois wrote:
>
>> 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?


It finds it in the first sector (sector 0; the "boot" sector) of the
Windows XP partition. It's just some magical data and code that live
outside the filesystem.

> Is is this ntldr file [...]


No, ntldr is a file in c:\. As I said before, you can boot Linux, mount
the XP partition, and see the three files Mr. Mayne mentioned: ntldr,
NTDETECT.COM, and BOOT.INI.

> [...] or some
> piece of code that will the ntldr?


Yes, the boot sector loads part -- or all; I don't know and it's not an
issue here -- of ntldr; then its job is done and XP must complete its
bootstrap process and continue. It's the same with GRUB and Linux.
 #13  
10-22-03, 08:55 PM
a user
On 2003-10-22, Jules Dubois <bogus> wrote:
> On Wed, 22 Oct 2003 01:21:44 GMT, in article
><slrnbpbmta.10d.paul>, a user wrote:
>> Also, check to make sure XP really is (hd0,0).
>> 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.
>> 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.


Just checked fdisk and the xp partition is flagged as "boot", which,
to me, is the same as "active" as in older terminology. Even the
fdisk uses the term "make active" which seems like it is now
"boot/active" depending what one uses to view as I think windows
stuff would call it "active".


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


For me, using windows to select and start an OS, is "safer"; perhaps it
is now more a matter of not trusting m$ as m$ have messed up the
boot sector with their "service packs".
Similar Threads
How to backup MBR/ GRUB ? (Dual-boot Linux & Win XP)

I am dual-booting openSUSE 11.1 with Windows XP Professional, using 2 HD's - one for each OS, as below. HD 1 - Windows XP (IDE HD) HD 2 - openSUSE 11.1 (SATA HD) GRUB is...

Getting back a Vista boot after removing Linux (dual-boot GRUB menu)

I have a new Fujitsu-Siemens Esprimo laptop with OEM Vista Home Basic. I have not previously used Vista, but I have used most versions of Windows from 3.1 on. I installed...

dual boot linux with grub

Is there a howto or documentation somewhere that describes dual booting two versions of linux with grub

grub setup for dual-boot with linux on hda and XP on sda

Hi! I know that how-do-I-set-up-GRUB is a very common question, but I have not been able to find information on my special configuration: | (hd0, ): | 0 hda1 ext2 /boot | 1...

dual-boot freebsd 5.2 and SUSE linux, but failed to boot freebsdwith grub

Hi, I installed freebsd 5.2.1 in the first partition of the the disk and SUSE linux on the second partition. I configured grub in SUSE with the following content in the file...


All times are GMT. The time now is 07:26 AM. | Privacy Policy