Link to home
Start Free TrialLog in
Avatar of haldrik
haldrikFlag for United States of America

asked on

Lilo doesn't recognize Win98 partition

Hello:
I just went from having two hard drives to having one. My second hard drive was where win98 system was, but I've copied all the files and transferred the system to the windows partition on the first drive and now lilo doesn't recognize (and I can get it to) the windows partition. (Or rather, it won't let me boot from it.)
Here is my lilo.conf file:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
vga=normal
default=linux
keytable=/boot/us.klt
lba32
prompt
nowarn
timeout=100
message=/boot/message
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz
     label=linux
     root=/dev/hda1
     initrd=/boot/initrd.img
     append="quiet devfs=mount hdd=ide-scsi"
     vga=788
     read-only
image=/boot/vmlinuz
     label=linux-nonfb
     root=/dev/hda1
     initrd=/boot/initrd.img
     append="devfs=mount hdd=ide-scsi"
     read-only
image=/boot/vmlinuz
     label=failsafe
     root=/dev/hda1
     initrd=/boot/initrd.img
     append="failsafe devfs=nomount hdd=ide-scsi"
     read-only
other=/dev/hda6
     label=windows
     table=/dev/hda
     map-drive=
        to=0x80
other=/dev/fd0
     label=floppy
     unsafe

My win partition is (obviously) /dev/hda6. When I type "lilo" I get the following:
Added linux *
Added linux-nonfb
Added failsafe
Invalid drive specificateion "to" at or or above line 36 in file /etc/lilo.conf

Can someone help?
Thanks!
Avatar of ahoffmann
ahoffmann
Flag of Germany image

> .. I've copied all the files and transferred the system to the windows partition ..

does this windoze boot itself, without lilo?
AFAIK this cannot work 'cause Windoze knows about the physical drive/partition where it is installed.
Avatar of haldrik

ASKER

So is my only option to reinstall windows? (assuming I can even do that...)
Avatar of haldrik

ASKER

OK, I fixed the obvious error in line 36. (changed to : map-drive=0x80  to=0x81; map-drive=0x81   to=0x80.
The error I get is: "Fatal: Partition entry not found"

The terrible thing is that booting to dos floppy results in NO HARD DRIVE at all being found. Linux can access the drive, but can't boot to it.

Someone please help!
(reinstalling win98 really isn't an option, since I have the upgrde cd, which requires win98 to be able to find windows inthe first place!)

Avatar of 0xDEADBEEF
0xDEADBEEF

Wait a second, as far as I know Windows 98 only installs to /dev/hda1 - how'd you get it on /dev/hda6?
In case you just copied the files, there's a boot sector missing, so windows naturally can't boot.

Usually, when installing linux and windows for multi-boot, you first install linux, but leave /dev/hda1 (and any other partition you want to use w/ windows) blank, then install windows. Windows will install to /dev/hda1 and overwrite the MBR, so you have to boot linux from CD and install lilo to the MBR.
After that, everything should work fine.

Hope this helps.
The upgrade CD makes things more complicated...Do you have an old DOS you can upgrade from?
The upgrade CD makes things more complicated...Do you have an old DOS you can upgrade from?
the map-drive keywords in lilo.conf tweak lilo to find the disk (which is connected somehow).
But it won't boot Windoze 'cause you copied it (see my very first comment)
You have "map-drive=0x80  to=0x81; map-drive=0x81   to=0x80"

That is cute, but won't work.  You have outsmarted yourself.  You have basically instructed LILO to reverse the first and second hard drive mappings.  But now you only have one drive!!!  The map-drive command will not solve the problem of mapping PARTITIONS among drives which is what you really are trying to do.

You have two problems:  LILO and Windows.

First, LILO.

Your lilo.conf file should be simple.  It should look like this for the windows boot section (forget the table and map entries, they do nothing for windows and LILO certainly doesn't need them):

[clip]
other=/dev/hda6
    label=windows
[clip]

Second, Windows.  You have two problems here -- the windows chainloader, and the windows system drive mappings.  

(a) the windows chainloader may not have been correctly moved over when you copied your partition from one drive to another (the chainloader resides on the beginning of the partition where windows was previously installed).  If you used dd, you are probably okay; if you used a windows drive copy program, probably not okay.  The only way to know if this was preserved is to try installing lilo using the simple lilo.conf, and see what happens.  If lilo boots, but you get something like "boot sector not found" when you select windows, that is your problem.  Go ahead and try this and see what happens and report back.  If you need to repair the chainloader, you are in for a bit of work so I won't go into how to do it here just yet until we know if you have that problem.

(b) if an when you get windows to boot, you will definitely get a new error -- something like invalid system disk.  You may just get the infamous blue screen of death.  This is because windows is looking for its system files on the second drive, in a different partition.  

You will need to force windows to regenerate its hardware tree.  This may not be possible with such a radical drive change (partition and physical drive).  The only way I know of is to somehow access the registry and delete the following keys and reboot to force windows to reenumerate your hardware:
HKEY_LOCAL_MACHINE\enum
HKEY_CURRENT_CONFIG\enum

IF you can boot to safe mode, you can do this (using regedit).  Again, the only way to know if you can even boot to safe mode is to try it.  If you cannot even boot to safe mode, you will have two options: (i) find a third party program that is bootable from a diskette that will allow you to modify the windows registry without booting windows (I do not know if such a thing exists, but it is worth looking for if you are at this point), or (ii) reinstalling windows OVER your existing windows install (without reformatting), which should at least preserve your applications.  

Finally, you will likely still have a drive letter problem, and I think you may also have a problem with Windows being in a logical partition -- I cannot remember for sure, but I was pretty certain that windows requires itself to be in a primary partition (hda1 - hda4). I know there are third party programs that fool windows into putting itself into another partition -- are you using such a program?  If so which one?  If not, you must move windows to a primary partition.  If you are "fooling" windows using a partition mapping program, you will need to make sure that you have that program setup properly so that windows gives itself teh SAME drive letter (presumably, C:) as it had when it was on your second disk.

Given all of the above, and I would agree with others in the thread that, unless you end up being lucky (able to boot windows and reenumerate the hardware, and able to easily move windows to a primary partition) you are probably better off reinstalling.

After trying (a) and if (a) works, then (b), let me know what happens and we can follow up.
Avatar of haldrik

ASKER

Thanks for the extremely well thought-out and time consuming response! (Let's hope this doesn't turn out to be a waste of your time!)

Well, I tried option "a" (simple lilo.conf entry) with no real success. When I type lilo, it seems to set up fine, but when I try to boot windows from the lilo screen, I get a black screen saying "Loading windows 98" (or similar) at the top, the harddrive spins for 5 or 6 seconds, then stops and nothing ever happens. Like I said, I am able to boot to a win98 floppy, but I can't access C, or any other letter for that matter): ("invalid drive specification").  If "dos" doesn't even recognize the C drive, I doubt trying to reinstall windows from the CD-Rom would work anyway. Also, even if I found a third party program that would let me do "regedit", wouldn't I need access to the windows partition to edit the file?
(One more thing: If I need to create a new primary partition for win98, will that screw up my linux setup? If that's the choice, I'll forego windows or just buy a new harddrive!)
this resp is abbreviated cause i am typing from my thumbpad on my sharp sl-5000d wireless  ... if you need more det on ony step below, let me know


okay, i am pretty sure that you need to move your windoze to a primary partition first, and then we can work from there

you will not mess up linux if you are careful to modify fstab and lilo.conf to ref your new root at hda6!


basically, you use dd, partitionmagic or a like prog to move your windows part to hda1, linux root part to hda6 and modify fstab and lilo.conf to ref the new linux root at hda6, rerun lilo and viola.  

note that depending on avail space you may need to hook up your second drive temporarily

there are many ways to do this --- safest is:

copy hda6 to a temp part maybe on second disk
copy hda1 to hda6
boot linux from hda1 as usual
mkdir /mnt/troot
mount /dev/hda6 /mnt/troot
modify /mnt/troot/etc/fstab by changing /dev/hda1 to /dev/hda6
modify /etc/lilo.conf and /mnt/troot/etc/fstab by adding a new section to boot /dev/hda6 as root -- this will just be a copy of the current hda1 boot statement with hda6 instead; delete the hda1 boot statement for now
/sbin/lilo
copy your windows part to hda1
boot into linux (now hda6)
now add the simple windows boot section to lilo.conf using hda1 in the other boot statement.
/sbin/lilo again and try it out



boot to your emergency linux boot disk, mount your root part to /mnt/xxx, modify xxx//etc/fstab
Avatar of haldrik

ASKER

One quick question before I proceed: (I don't have partition magic--I tried downloading a demo, but it's only for windows--So I have to use the dd function you were talking about, or maybe that "Parted -GNu" program?)
If I copy hda1 (ext2) to hda6 (fat32), won't I have to change to parition type? Or am I just copying files? I guess the same question goes for copying hda6 to hda1.
Also, the partitions are not the same size: hda1 is 15 gb (27% full), hda5 (/home) is 7.3 GB 14% full, hda6 (win) is 9.8 GB 37% full  and swap is 5 gb.  Do the partitions have to be the same size? (to copy an ext2 parition w/ Parted-GNU, aparently the two partitions have to be the same size, according to their website).
Also, I've looked up the dd command, and I'm not too confident in the syntax--there are so many options! Could you give an example for the copying back and forth?
Thanks for your help! I've raised the points (which im sure don't mean all that much to you) to 200 anyway.
ASKER CERTIFIED SOLUTION
Avatar of jsnorman
jsnorman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
huge explanation of my very first comment (also the first comment in this thread), thanks jsnorman for explaining in detail.
haldrik, did you answer (at least to yourself) jsnorman's questions about copying Windoze?
As long as you cannot boot w98 itself on your disk, any effort with lilo is wasting time.
Avatar of haldrik

ASKER

ahoffmann:
I copied the files from my original windows hd by dropping and dragging all the files using KDE. Then I booted into windows and did a "sys: d" or something like that to copy the system stuff. I never booted to the drive. I knew that might be a problem, but I assumed I would be able to re-install win98 (upgrade) on the partition and let it recognize all the stuff that's already on the disk. Won't that work after I switch the partitions that the 2 OS's are on?
(Incidentally, I still HAVE the other harddisk--it's just not in this computer).
Avatar of haldrik

ASKER

Well, I finally got it!
Here's how it finally worked out:
I resized the hda1 partition to about half, and created a new PRIMARY partition in the space left over, because you said it had to be a primary partition. Then using your techniques, I copied the windows partition from hda6 to hda3 (which was the new primary partition). The next time I loaded windows from the floppy, it went through some hard drive recognition for about 5-10 seconds, then suddenly windows loads! (Of course, now there's a C AND a D drive, both identical, but I'll delete D once I'm sure everything is working fine).
Fortunately, I didn't have to move my primary linux partition after all, because it was big enough that I could just shrink it down instead to make room for the new partition.
Thanks a million, you guys are the best!  
Very happy to hear that!  Was worried you might need to regenerate the enum tree in windoze, but looks like you got lucky.

JSN