Click to See Complete Forum and Search --> : Trouble configuring GRUB for Dual booting NT


SanjayPethe
04-10-2004, 11:44 PM
Hello,
I have an old Dell Inspiron laptop with Windows NT on it. I want to make it a dual boot machine with the Windows NT and Fedora Linux distributions. Unfortunately, I do not have the NT installation disks, since I inherited this machine.

The NT installation is just over 8GB i.e. it just crosses the 1024 cylinder limit. I have an additional 10GB of free space after this partition. I do not want to reduce the size of the NT partition further. I cannot load Linux and make it a bootable partition after the NT partition because it is beyond cylinder 1024. The entire disk upto the end of the NT partition has the HPFS and NTFS file systems (no FAT). After reading on boot loaders and partitions, here is what I thought would work:
1) Move the NTFS partition (an NT installation) out by about 100MB using Partition Resizer v1.3.4 (www.zeleps.com), to create about 100MB of free space at the start of the disk.
2) Install linux with /boot in this 100MB at the start of the disk and the rest of it beyond the NT partition. As part of this, GRUB was installed as the boot loader in the MBR.
3) Modify the Windows boot.ini (using Capture). Modify the Windows NT boot entry to be multi(0)disk(0)rdisk(0)partition(2) instead of
multi(0)disk(0)rdisk(0)partition(1).
4) Configure the GRUB bootloader to load allow selection of Windows NT or Linux. To load Windows NT, I used the GRUB map command to perform a virtual swap:
grub> map (hd0) (hd1)
grub> map (hd1) (hd0)

At the end of this, I could boot Linux, but not NT (just resulted in a blank screen with cursor in top left corner). I am not sure where the problem is. I suspect it could be in the way the hard disks are numbered, because the NT partition was still showing as hda1 and the /boot as hda2 though the /boot was located before the NT one. This is maybe the way presizer leaves it after moving the partition, and I am not sure if this causes problems.

I have undone these changes by deleting /boot, running the Fedora install to put it after the NT installation and then using presizer to move the NT partition back to the start of the disk. I also fixed the boot.ini file to refer to the first partition, and replaced GRUB in the MBR with the MBR written by fdisk. The system will now boot to Windows NT, but has no Linux. So I am back to the original state. I would like to figure out how to do this using GRUB as the main boot loader, not go though NT loader and then boot Linux, but I am not sure of what to do next. Any suggestions?

Thanks in advance.
:confused:

XiaoKJ
04-11-2004, 12:01 AM
try undoing the boot.ini file back from partition(2) to partition(1) with the first configuration or this:

use a linux boot disk or grub-only boot disk to boot linux. then dd the top 512 bytes or bits i forgot to the windows partition. Make sure you have a 2.6 kernel with ntfs writing support.

The specific procedure I had forgotten is available in linux's official FAQs. Try finding them. With your research and depth-of-knowledge it will not be a problem, as I see you are not low on the learning curve at all... You are doing great!

SanjayPethe
04-11-2004, 06:56 AM
>try undoing the boot.ini file back from partition(2) to partition(1) with the first configuration or this:

I know this does not work, because that is the way it was when I first did the procedure. I was not smart enough to fix the boot.ini file before I moved the partition. That is why I had to install captive (www.jankratochvil.net/project/captive/), so that I could modify the boot.ini file on the NTFS drive from Linux.

What does dd'ing the top 512 bits to the Windows partition do? Are you replacing NT loader? with GRUB on that partition?

Sanjay

dysharmonic
04-14-2004, 09:39 AM
Hi

It should be something like

dd if=</your_linux_boot_sector/> bs=512 count=1 of=/mnt/floppy/linux.bin

(w/o the brackets)

dd is the utility to convert and copy files to some other format, I guess.

The eg above copies the boot sector of yur linux to a bin format so that NT loader could read and give the boot process to grub/lilo in order, well, to boot up linux.

Just copy the bin file to your windws root directory and include a line boot.ini to point to this file.

e.g.

c:\linux.bin="your_linux_distro"

SanjayPethe
05-06-2004, 07:40 AM
Hi,
I am becoming convinced that there is a bug in GRUB that prevents it from booting NT on my configuration. I have experimented with various options since my last post. To summarize:

1) I restored the system to where there was no linux on it, only Windows NT, in one contiguous area, with free space at the end. I was able to boot into Windows NT. At this point, the boot loader on my laptop is the boot loader installed by fdisk/mbr.

2) I prepared a GRUB boot disk and was able to boot into NT using the commands:
title Windows NT Test 1
root (hd0,0)
makeactive
chainloader +1
boot

3) I then moved my Windows NT partition out by about 100MB to make space for the Linux /boot filesystem using Partition Resizer v1.3.4 as before, and tried to boot into Windows NT using GRUB as before. This did not work although I tried numerous variations of the (hd0,0) parameter above. Note that the machine was not bootable at all when I did this, presumably since the Windows NT boot files (ntldr, boot.ini, etc) are not physically where they are expected to be.

4) I moved the Windows NT partition back, booted into it and prepared a Windows NT boot disk using format a: /u, and copied the ntldr, ntdetect.com and boot.ini files onto this disk.

5) I moved the Windows NT partition out by 100 MB again, and was able to boot into it using the newly prepared Windows NT boot disk. I had to specify the first partition on the first HD to be able to do this in the boot.ini file:
multi(0)disk(0)rdisk(0)partition(1)\WINNT="NT, First harddisk, first partition" /sos

6) I installed Linux (Fedora) with /boot in the 100MB free at the start of the disk, and the rest of it beyond the Windows NT. I replaced the laptop boot loader with GRUB. I was able to boot into Linux when I did this. However, I still cannot boot into Windows NT with GRUB. I see the GRUB commands and then just a black screen with the cursor in the top left.

7) It seems to me that GRUB is not able to chainload the ntldr if the Windows partition is not at the start of the disk, because I do not see any of the options in my boot.ini ever show up. I am not sure why this should be. It may have something to do with the way my partitions are numbered after Partition Resizer v1.3.4 moved them - they are not sequential by location - instead they are sequential by creation order. Running parted produces an error about not being able to align the partition properly and shows the following geometry. As you can see, partitions 1 and 2 are not numbered in the same order as their location on the disk. I do not know if this causes GRUB any heartache, but the NT loader seems to do fine with it.
Disk geometry for /dev/hda: 0.000-19077.187 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
2 0.031 101.975 primary ext3
1 102.006 8103.098 primary ntfs boot
3 8103.098 18567.312 primary ext3
4 18567.312 19077.187 extended lba
5 18567.343 19077.187 logical linux-swap

8) I can't think of what else to try with GRUB. I guess the next thing I will try is to see if I can boot into Linux from my NT boot disk. If that works, I guess I could copy the NT loader to the MBR and use it to boot both systems. But this defeats the intention - I WANT to be able to use GRUB to boot both systems, because that is GRUB's stated purpose (Grand UNIFIED Boot Loader!). If it cannot do so, it is a bug and needs to be fixed.

9) I NEED HELP! Any suggestions welcome, including any suggestions of where else would be a good place to post this problem.

Thanks.
:mad:

XiaoKJ
05-06-2004, 08:00 AM
As I see, you have completely neglected PARTITIONS!

when you moved your NT partition out by 100mb, it becomes the second partition instead of the first(thus you can only boot from the boot disk when boot.ini reads ...partition(1)... instead of 0)

Similarly, you must specify (hd0,1) to grub instead of (hd0,0) for it will boot your unbootable /boot partition

Remember, computers count from 0 not 1!

Also, I do not know why your original boot.ini file read 2 instead of 0 nor 1, but I suppose something special happened.

As you do not have two hard discs, the map command will not work.

BTW, why did you replace NT bootloader with GRUB? our suggestions to dd the boot sector eliminates the need, reducing the risk of jeopardising your NT partition.

Finally, I do not think GRUB has this kind of bugs. Cheers!:D

SanjayPethe
05-06-2004, 10:00 AM
Hi XiaoKJ,
Thanks for your comments.

I replaced the NT loader with GRUB because I specifically want to use GRUB to boot NT instead of vice versa. There is no real reason for this, its more of an experiment and an expectation that GRUB should be able to do this. I could go back to using the NT loader, but I am uncomfortable with having to rely on a proprietary tool to allow me to use linux and another system on the same machine, more from the principle than anything else. In fact, I don't really need NT on this machine at all. Hope that answers one of your questions.

>As you do not have two hard discs, the map command will not work.

Yes, I see that now. I do not know why I tried it the first time. Attribute it to ignorance and learning!

>As I see, you have completely neglected PARTITIONS!
>when you moved your NT partition out by 100mb, it becomes the second partition instead of the first(thus you can only boot from the boot disk when boot.ini reads ...partition(1)... instead of 0)
>Similarly, you must specify (hd0,1) to grub instead of (hd0,0) for it will boot your unbootable /boot partition

Not true. I have tried all these combinations. In fact, as parted shows, the NT partition is still being treated as partition 1 (i.e. first partition using the NT boot.ini convention), and even the NT loader will boot up NT if I specify partition 1 (first), but not partition 2 (second). However, I have tried several of these combinations. Here is my current grub.conf. None of these options work (except the Fedora one). As you can see, I am not sure of the exact difference between root and rootnoverify, but I tried them both just in case. This is why I am beginning to think the problem is with GRUB itself.

However, I realize I am just learning, and have a long way to go, so it may just be me doing something stupid. But I can't think of what! So all help is welcome.

========Start of grub.conf=============
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda2
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(fd0)/boot/grub/splash.xpm.gz
title Fedora Core (2.4.22-1.2188.nptl)
root (hd0,0)
kernel /vmlinuz-2.4.22-1.2188.nptl ro root=LABEL=/ hdd=ide-scsi rhgb
initrd /initrd-2.4.22-1.2188.nptl.img
title Windows NT Test 1
root (hd0,0)
makeactive
chainloader +1
boot
title Windows NT Test 2
root (hd0,1)
makeactive
chainloader +1
boot
title Windows NT Test 3
rootnoverify (hd0,0)
makeactive
chainloader +1
boot
title Windows NT Test 4
rootnoverify (hd0,1)
makeactive
chainloader +1
boot
========End of grub.conf============

Thanks.

XiaoKJ
05-06-2004, 10:26 AM
From what you have done I am sure you have RTFM:D
Keep it up!

BTW, you do not include the boot option in grub.conf

why? in grub.conf, grub knows that it should automatically boot after an option is chosen. Thus it is omitted -- the boot command is given only in command mode as it tells grub to work.

With this new grub.conf, I think you should try fiddling with your boot.ini instead to get a working windows partition.

Its this curiosity about trying new things that gets linux leaping ahead of microsoft!:D Thats for trying GRUB instead of NTloader

SanjayPethe
05-06-2004, 11:05 AM
I thought about that, but that seems pointless because, at this point, I can't get anything to read that boot.ini when GRUB hands off. If I could see the contents of the boot.ini, then I would agree. The problem seems to be correctly loading ntldr when it is on partition 1 and partition 1 is in the middle of the disk.

Am I missing something?

psi42
05-09-2004, 11:19 PM
Well (and I know this is going to make you bang your head against the wall for a couple hours), the issue you are trying to work around (the 1024-cylinder limit) is no longer an issue. That was only a problem with old versions of LILO. Modern versions of LILO and GRUB can boot linux from anywhere on your harddrive, so you don't need a /boot partition at the beginning at all.

XiaoKJ:
From what you have done I am sure you have RTFM
Keep it up!


:D
If only everyone would do that... :)



Anyway, I see value in figuring this one out to the end regardless.
When grub attempts to chainload ntldr, where exactly does the process fail?

Can you post the output of each step as typed in manually at the grub> prompt from your GRUB disk?


:)

~psi42

SanjayPethe
05-10-2004, 11:32 AM
psi42
the issue you are trying to work around (the 1024-cylinder limit) is no longer an issue. That was only a problem with old versions of LILO.

I thought this was a limit posed by the BIOS on older machines, not the bootloader. Anyway, the very first thing I had tried was to install Fedora after the NT and it did not work (could not boot it up). I only got into the business of moving partitions around because that did not work.

I will post the step by step output of trying to boot up from the GRUB disk here later today. I too would like to solve this issue rather than take the easier (apparantly) alternative of booting Linux through ntldr.

SanjayPethe
05-10-2004, 03:04 PM
Here are the step by step results of trying to boot from the grub prompt:

=======Trial 1=============
grub> root (hd0,0)
Filesystem type unknown, partition type 0x7
grub> makeactive
grub> chainloader +1
grub> boot
--------------------------------------------
At this point the cursor goes to the next line and sits there blinking forever.
=======End of Trial 1========

=======Trial 2=============
grub> root (hd0,1)
Filesystem type ext2fs, partition type 0x83
grub> makeactive
grub> chainloader +1
Error 13: Invalid or unsupported executable format.
grub> boot
Error 8: Kernel must be loaded before booting.
grub>
--------------------------------------------
At this point we are back at the prompt waiting for the next command.
=======End of Trial 1========

From this, it appears to me that grub also thinks that partition 0 is Windows NT (can't recognize the NTFS file system on this partition) and partition 1 is the Linux boot partition, but it cannot load the NT boot loader.

Hope this throws some light on what's happening.

DMR
05-10-2004, 03:08 PM
Originally posted by SanjayPethe
I thought this was a limit posed by the BIOS on older machines, not the bootloader.At one point, it was both. Earlier BIOSes did not support LBA/extended INT13 calls, and early versions of lilo had no LBA support either. Grub never did, AFAIK, have this limitation.