LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux/XP GRUB Loader / MBR Problems (https://www.linuxquestions.org/questions/linux-newbie-8/linux-xp-grub-loader-mbr-problems-724248/)

4UT0P1L0T 05-06-2009 05:22 PM

Linux/XP GRUB Loader / MBR Problems
 
Just want to start out by saying hello to everyone, appreciate the help. But have been searching around for a solution but none seem to fit my exact situation..

Okay, so I have 3 hard drives installed on my HP a1600n:
1)SATA 190GB HDD (C:20GB Windows XP partition, D:~170GB Media partition).
2)SATA 500GB HDD (F: Media partition).
3)EIDE 80GB HDD (Linux, kinda)

Heres what the one time boot menu looks like. IMAGE: http://i67.photobucket.com/albums/h3...netimeboot.jpg

I have tried a few distros in the past on the 80GB and had no trouble until I installed the new ubuntu. After installation I came across the GRUB 1.5 Error 22. So I didn't think much of it, I usually retreat to xp and call it a day, but it wasn't even recognizing an XP partition now, just Error 15 or 22. (IMAGE: http://i67.photobucket.com/albums/h3...ie/error22.jpg )

Luckily I had a LinuxMint live CD laying around so I popped that in and booted live, and then installed without a problem. Remove the CD, restart and Error 22 again. So after awhile of messing around with the BIOS/hardware settings and before trying to remove the 80GB completely, I popped in the Live CD again and booted from the local drive option. This took me to the GRUB bootloader, with Linux and XP showing up! Both worked fine at this point. I could boot into Linux or XP without a problem --- as long as I boot with the LiveCD>Boot From Local Drive. Eventually booting with a disc got annoying so this led me down the trail of trying to remove/reinstall linux, and then booting to the XP cd and fixing the windows MBR (with fixboot fixmbr and cfgboot?). But I noticed a funny thing while entering Windows Recovery. It's stating that my C:\WINDOWS is really D:\WINDOWS (IMAGE: http://i67.photobucket.com/albums/h3...wsrecovery.jpg ) and everything is off. The D: is E:, CD-ROM is F:.

And windows installer disc doesn't even recognize C: correctly anymore(IMAGE: http://i67.photobucket.com/albums/h3...ie/install.jpg ). It is stating my 190GB is a 130GB, and the 500GB is not even showing up, it's also showing up as a 130GB ( image: section two should look like section one, but with C and D not D and E).

This is boggling my head and I don't fully understand what is going on here anymore. Basically, I just want to save what was once the D: media drive, and fix the MBR or GRUB loader so I can atleast boot something.. I enjoyed using LinuxMint. How do I go about removing the GRUB loader or atleast pointing the loader to the right location.. I can still boot into the LiveCD and have access to my C: D: F: files.

I hope that makes sense to someone out there, I've been messing with it for days. Also, let me know if the picture links do not work.. Its easier to understand all that jargon if you can see what the pc is doing. Thanks in advance.. phewwww..

yancek 05-06-2009 07:07 PM

Do you now have Linux Mint installed on the 80GB drive? If you want help to boot with Grub it should not be that difficult but we will need more information on your drive and partition setup.

Use the Mint Live CD, let it load and open a terminal and run command:

sudo fdisk -l (lower case letter L, hit enter, post output here)

Enter command: sudo grub (hit enter and get passwd prompt and then grub prompt: grub>)
Type: geometry (hd0) (hit enter)
geometry (hd1) (hit enter)
geometry (hd2) (hit enter)

post the output of these commands so that we know how Grub sees your partition setup.

I'm not sure what you did when you installed Mint in regard to Grub. Grub needs one of its files in the master boot record to boot. This file needs to point to the partition where the other bootloader files are. If it's not pointing to the right partition it won't boot. You could also use the Live CD and mount the Mint system partition and navigate to the /boot/grub/menu.lst file and post that here. If you're not sure how to do that, just post the output of the commands above to start.

GlennsPref 05-06-2009 07:41 PM

Hi, Welcome to LQ!

Thank you for your question, it's a good one! (And the links to pics work.)

This is why most ppl will not use linux.

It seems to me that one of your linux installs has written a new partition that has borked the boot order for all the other os's installed.

<edit> foss wire has a tute on this....
http://fosswire.com/post/2009/5/rest...rwritten-grub/
</edit>

Another quick way is to re-install the boot loader with the "rescue" boot-option from the linux install cd.
It should pickup any os's installed then give you the option of where you want to put it.
Mandriva (plug,Plug) has one such option.

I'm not an expert with grub, but I have had some experience.

If you are proficient with your hardware and bios, (I would do this)...

Unplug the other harddrives (not c drive winxp), not completely but just the, power wires should do.

Resetup winxp boot as you did before, so you have a bootable system.

Check with a livecd the partitions that are there to familiarise your-self

with what is where and if there is a new partition before the old c partition.

I have a suspicion that one of the linux installs has set itself up as if you did

not have any other os installed and created a /boot partition.

This is not a bad idea, but it might have been better if it was someplace else, like the first partition of the linux / (root) harddrive partition.

OK, this is getting drawn out, but if it is done wrong we risk wiping c drive partition.

Once you have the partiton list written down for reference, and windows-xp is working

(albeit without the media folders) then replug in the power for the other hdd's.

If you have no personal data on the linux installs you require to keep

reinstall linux, and when asked where to install the grub boot loader,

choose the c drive (that windows is on)

That should incorporate grub into the existing system, giving you the option to boot win or linux.

When you choose win, you should next see the win boot loader, with all the usual choices,

like F8 to bring up the windows boot menu.

I have seen a few stories like this lately,

where windows is shifted(I don't know how) to d: drive (partition).

(The /boot partiton only requires about 50meg), a bit like ubuntu is trying to eradicate m$windows.

There are probably better ways to do this, but I hope this helps you.

These links from aus9 tag may be of help too....

Code:

GRUB tutorial
http://www.linuxquestions.org/questi...hreadid=237511
Grub Trouble shooter
http://www.linuxquestions.org/questi...postid=1413211

cheers Glenn

4UT0P1L0T 05-06-2009 11:23 PM

I tried to reinstall LinuxMint. I removed it earlier while messing around as a last hope. But these pictures show the before and after of partitioning for the latest install. I usually do the manual install with those following settings, let me know if that looks all right.

Before partitioning

After Partitioning

Boot Loader Options

It's funny how the Linux Partitioner recognizes the partitions for what they're suppose to be, but windows can't display its own mess. Anyway. The last picture is of the boot loader options. I chose the default setting it was on, which is hd0 if I'm not mistaken. The previous install I may have tried a different drive though, I was getting fed up. But then again after install I received Error 17. And when I chose Boot from Local Disk on the Live boot options. I get NTLDR is missing. Earlier in the day I also tried copying NTLDR and NTDETECT.com back to the drive but I suppose it didn't work.

I hope this information helps out a little bit. Again, I'm not concerned all that much for the XP partition (sda1), everything I need is on sda2 and sdc1 Therefore I would delete or reinstall it, but I'm afraid of what the circumstances would be after doing anything with the windows installer. But like you said before though, I still have to configure some more hardware and remove all other drives. But this is the current state of my machine. Thanks again for the responses. Hope to resolve this soon. I can't take this 800x600 resolution..

4UT0P1L0T 05-07-2009 12:15 AM

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe13ce13c

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2649 21278061 7 HPFS/NTFS
/dev/sda2 2650 24321 174080340 7 HPFS/NTFS

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000243b5

Device Boot Start End Blocks Id System
/dev/sdb1 1 12 96358+ 83 Linux
/dev/sdb2 13 3910 31310685 5 Extended
/dev/sdb5 13 1836 14651248+ 83 Linux
/dev/sdb6 1837 2086 2008093+ 82 Linux swap / Solaris
/dev/sdb7 2087 3910 14651248+ 83 Linux

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa14e9086

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 60801 488384001 7 HPFS/NTFS

GlennsPref 05-07-2009 08:06 AM

Hi, after seeing this, I see I have made a few mistakes regarding your question.

Quote:

I chose the default setting it was on, which is hd0 if I'm not mistaken
Hd0 is not listed as a harddrive in any of the information, and it's possible that that is your cdrom. So, that does not make sense to me. hda1 or hda2 1st and second partition of the first ide drive. hdb1 and hdb2 for the 1st and 2nd partition of the second ide harddrive. or an ide cdrom.

Select sda as the mbr to boot from. The first harddrive. not hd0.

sdx is generally used to describe a scsi or sata drive, hdx for ide (pata)drives. (where x is the partition number.)

I think that may be the trouble. but...

You did mention that you had an old drive that was eide...

Quote:

Okay, so I have 3 hard drives installed on my HP a1600n:
1)SATA 190GB HDD (C:20GB Windows XP partition, D:~170GB Media partition).
2)SATA 500GB HDD (F: Media partition).
3)EIDE 80GB HDD (Linux, kinda)
But it is not listed here...
Quote:

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe13ce13c

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2649 21278061 7 HPFS/NTFS
/dev/sda2 2650 24321 174080340 7 HPFS/NTFS

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000243b5

Device Boot Start End Blocks Id System
/dev/sdb1 1 12 96358+ 83 Linux
/dev/sdb2 13 3910 31310685 5 Extended
/dev/sdb5 13 1836 14651248+ 83 Linux
/dev/sdb6 1837 2086 2008093+ 82 Linux swap / Solaris
/dev/sdb7 2087 3910 14651248+ 83 Linux

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa14e9086

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 60801 488384001 7 HPFS/NTFS
or in any of the pics you posted.

Windows is confused because it expects to be on the 1st partition of the 1st harddrive. (although, you can make it work.) But that's m$win and you can ask else-where about that.

But all is not lost.

If you'd like to have your bios and hdd subsystem more standard-like,

you may re-read my other post here about getting the windows drive in order, in bios first. But please read on...

Then attach the other drives "in order", this will leave less chance of win developing problems about which partition is active and where the mbr is located.

It will work if you leave it, but it will be difficult to debug if it comes to grief.

As it is I think you will have to change the order of the ide/sata cables as well to re-order the drives correctly in bios.

It won't hurt to have an ide cdrom early in the order, but you need to remember the eied hdd is not the first drive, if it is plugged in it will change the bios when set to auto.

You may need to, once the 1st sata (sda) drive is in and the eide is plugged in, check the bios to make sure it sees the sda drive as the active partition.

If possible make the eide drive a "non-active" boot partition. (when using the partition application.)

See how you go.

ps, as far as I know, GNU/Linux cares not about other active partitions because of the way it addresses(sda, sdb, hda, hdb etc) the drives.
Win does not do this, and was developed as an omni-os (the only operating system). (I have 2 on each of 2 systems, all with active boot partitions.)

You should be able to do this without risk to your data, but be careful.

You will have to reinstall both windows boot-loader and grub after.

This is why windows partition manager is showing false info.

It's not false, just not correct, because of the boot order in bios and/or cabling. (A+ cert teaches this)

I hope this helps. The pics helped me to see this.

cheers, Glenn ;-)

GlennsPref 05-07-2009 08:36 AM

Hi again, I did not mention master and slave relation ships.

If I had an ide CD-ROM and 2 or 3 sata drives, and an old eide drive,

I would make the CD-ROM master and the eide slave on the same cable.

That will make is easier for the system to find the first boot-able master-device, sda, that is writeable, of course.

cheers, and sorry for my conversational tone, I was really discovering as I wrote,

so please read it all.

Oh, and yancek is by no means wrong,

I just believe you have a hardware config problem that should be rectified first. Good luck.

Thank you Glenn

yancek 05-07-2009 09:33 AM

In your first post, you indicate you have three drives. You list your first drive as having 2 windows partitions, your second drive as having one ntfs (your media) partition and the third (80GB) drive as Linux. Is that the order you expected them to be on or did you just list them that way. Your fdisk output shows the first drive (sda) as having the 2 windows partitions, the second drive as having several Linux and swap partitions and the third drive as one ntfs.

If you want to boot from Grub, your Linux partition would be either sdb1, sdb5 or sdb7. Not sure what this setup is, if you installed Mint several times and have it on different partitions or if you have separate root, home or other partitions.

I would again suggest you load the Mint Live CD and run the geometry commands I suggested earlier. These commands will show the partitions the way Grub sees them and you should be able to tell which is which by the different type of partition as well as the number of partitions because each of your drives is different. Here's an example of what you will see:

grub> geometry (hd0)
drive 0x80: C/H/S = 38792/16/63, The number of sectors = 39102336, /dev/hda
Partition num: 0, Filesystem type is fat, partition type 0xb
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 3, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x7

The ouput above shows partition o, type 0xb, fat fs which is w98.
Partition 2 & 3 are Linux and partition 4 is W2k, ntfs.

4UT0P1L0T 05-07-2009 04:24 PM

I may have solved the issue for now. I changed up the hardware configuration a little bit.. And I have to apologize, the EIDE drive was actually the 500GB drive, and the 190GB and 80GB were the SATA drives, sorry for any confusion.

But I set the 80GB on SATA one, and first in the HDD boot sequence, and the 190GB ( C:,D: ) is on SATA two. The CD-ROM and 500GB are Master/Slave on the first IDE channel.

I ran the LiveCD and tried another install since all the hardware was moved around, and I came to the conclusion that I would just reformat the 20GB XP partition to FAT32 for now while I was in the Linux Partitioner, since windows installer did not view it correctly.

I now have a clean, working install of Linux Mint on the 80GB SATA with a similar layout as earlier posted, and it is booting fine. I have access to all the files the D: Media partition and the 500GB. I believe the boot loader was installed on the same drive as linux.

I'm not at all concerned about using windows again for awhile. Linux Mint meets my expectations and requirements, and is much more clean and better overall. Although I did receive an Error 17 after the first reboot. But I reset and ran Boot Last Known Good and its fine. I'm not sure if it will persist if I reboot though. Its up and running for now, and I have homework to do. But if I were to install windows again on that 20GB partition, what problems, if any would I most likely run into.

Here is the current output of the geometry for each drive.

grub> geometry (hd0)
drive 0x80: C/H/S = 9729/255/63, The number of sectors = 156301488, /dev/sda
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type is ext2fs, partition type 0x83
Partition num: 5, Filesystem type unknown, partition type 0x82
Partition num: 6, Filesystem type is ext2fs, partition type 0x83

grub> geometry (hd1)
drive 0x81: C/H/S = 24321/255/63, The number of sectors = 390721968, /dev/sdb
Partition num: 0, Filesystem type is fat, partition type 0xb <-- OLD XP
Partition num: 1, Filesystem type unknown, partition type 0x7

grub> geometry (hd2)
drive 0x82: C/H/S = 60801/255/63, The number of sectors = 976773168, /dev/sdc
Partition num: 0, Filesystem type unknown, partition type 0x7

fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000243b5

Device Boot Start End Blocks Id System
/dev/sda1 * 1 12 96358+ 83 Linux
/dev/sda2 13 3910 31310685 5 Extended
/dev/sda5 13 1836 14651248+ 83 Linux
/dev/sda6 1837 2086 2008093+ 82 Linux swap / Solaris
/dev/sda7 2087 3910 14651248+ 83 Linux

Disk /dev/sdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe13ce13c

Device Boot Start End Blocks Id System
/dev/sdb1 1 2649 21278061 b W95 FAT32
/dev/sdb2 2650 24321 174080340 7 HPFS/NTFS

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa14e9086

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 60801 488384001 7 HPFS/NTFS



Again thanks for the responses, they gave me a better understanding of the GRUB loader and linux in general.

yancek 05-07-2009 06:12 PM

Your fdisk output is the same as Grub which means sda from fdisk is the same as (hd0) in Grub. There can be problems with this if the fdisk shows a drive as sda and Grub sees it as (hd1) or (hd2), so that's not a problem. If you install xp again, you need to be aware of and install it to the correct partition so you don't overwrite your Mint install. One thing xp definitely will do is overwrite your master boot record. During the xp install, you will not be given an option or notified that this is happening. You will need to re-install Grub again which should not be difficult.


All times are GMT -5. The time now is 05:04 AM.