LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-25-2008, 04:38 PM   #31
ShadStar
Member
 
Registered: Feb 2007
Location: South West of the United Kingdom.
Distribution: Ubuntu 8.04 (Hardy Heron)
Posts: 36

Original Poster
Rep: Reputation: 15

Quote:
Originally Posted by alan_ri View Post
Please post the output of the fdisk -l when you boot with the floppy disk(I just want to check out something).
Hi Alan

Just a quick reply (long post) with the output you wanted, I will spend more time with this at the weekend, but I thought I would post this now for you so you could continue your checking.

One apology to make, I seemed to be having a drive cable connection problem last night, which is the reason my Linux drive was coming up as (HD3). It should actually have been (HD1). I have now replaced the ide cable on the primary drive. Sorry about that.

First the drives as Grub sees them when booting from the floppy disk:

I chose to edit the boot line starting with root (HDx), then pressed tab to let grub complete it. I discovered the following:

(HD0) - My 250Gb IDE 0 Primary Master boot drive (Windows XP)
(HD1) - My 120Gb IDE 1 Primary Master Linux Drive (grub installed to this boot sector)
(HD2) - My 200Gb Sata drive connected to sata channel 3
(HD3) - First Sata drive in my Raid 0 Array connected to sata channel 1
(HD4) - Second Sata drive in my Raid 0 array connected to sata channel 2

HD3 and HD4 are two seperate 80Gb drives which are connected to the on-board raid controller through the first two sata channels.

Note at this point that this is exactly the same order as the drives are listed in the BIOS of the computer.

Okay, now for the fdisk -l listing from within Linux:

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

Device Boot Start End Blocks Id System
/dev/sda1 * 2 24321 195350400 f W95 Ext'd (LBA)
/dev/sda5 2 23644 189912366 7 HPFS/NTFS
/dev/sda6 23645 24321 5437971 7 HPFS/NTFS
Warning: ignoring extra data in partition table 5
Warning: ignoring extra data in partition table 5
Warning: ignoring extra data in partition table 5
Warning: invalid flag 0xffff of partition table 5 will be corrected by w(rite)

***
*NOTE* This is only a data drive not a boot drive. I only use this drive in Windows so please ignore any errors that appear above.
***

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

Device Boot Start End Blocks Id System
/dev/sdb1 * 2 19458 156288352+ f W95 Ext'd (LBA)
/dev/sdb5 ? 267351 534700 2147483647+ ff BBT

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

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdd: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xdf89df89

Device Boot Start End Blocks Id System
/dev/sdd1 * 1 11276 90574438+ 7 HPFS/NTFS
/dev/sdd2 11277 30401 153621562+ f W95 Ext'd (LBA)
/dev/sdd5 11277 30401 153621531 7 HPFS/NTFS

Disk /dev/sde: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xeed1eed1

Device Boot Start End Blocks Id System
/dev/sde1 * 1 13995 112414806 83 Linux
/dev/sde2 13996 14593 4803435 f W95 Ext'd (LBA)
/dev/sde5 13996 14593 4803403+ 82 Linux swap / Solaris

As suspected, Linux is detecting the sata drives first and the ide drives second.

Now for the files in the /grub/boot directory on the floppy:
Device.map reports the following:
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc
(hd3) /dev/sdd
(hd4) /dev/sde

Drives appear in Linux detection order not bios order.

Grub menu.lst contains the following relevant lines:

default=0
timeout=10
splashimage=(HD4,0)/grub/splashxpm.gz
hiddenmenu
title Fedora (2.6.23.1-42.fc8)
root (HD4,0)
kernel /vmlinuz-2.6.23.1-42.fc8 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.23.1-42.fc8.img

title Other
rootnoverify (hd0,0)
chainloader +1

I noticed that it lists the Linux root on (HD4) the same as device map, but bios actually lists it as (HD1)

I hope this is of some help to you, if I have missed anything please let me know and I will post it up for you. Also if I have posted some wrong info please let me know, I am still relatively new to this but I am learning very fast... :-)

Hope this helps

Regards
Steve (ShadStar)
 
Old 06-28-2008, 05:23 PM   #32
ShadStar
Member
 
Registered: Feb 2007
Location: South West of the United Kingdom.
Distribution: Ubuntu 8.04 (Hardy Heron)
Posts: 36

Original Poster
Rep: Reputation: 15
Wrapping Up

Hi all

I thought I might just wrap thing up at this point, as I think I know where I am going with this little problem now.

Long post this one, sorry...

From the top, I am dual-booting Windows XP and a version of Linux (I have now tried Suse, Fedora and Ubuntu 8.04).

Windows is on the primary master IDE drive and Linux is on the secondary master ide drive. I also have one single sata drive just for data use and two other sata drives set up as raid 0 (stripe).

The problem:
Trying to get the Linux drive to boot due to grub drive-mapping problems.

Bios order:
Primary IDE Master: 250Gb mapped to bios IDE-0 Master (Windows drive)
Primary IDE Slave: Pioneer 110 dvd-rw mapped to bios IDE-0 Slave
Secondary IDE Master: 120Gb mapped to IDE-1 Master (Linux drive)
Secondary IDE Slave: Unbranded dvd-rw mapped to bios IDE 1 Slave

Sata channel 1: 200Gb mapped to bios IDE-2
Sata channel 2: No device attached
Sata channel 3: 80Gb mapped to raid controller drive 1
Sata channel 4: 80Gb mapped to raid controller drive 2

Steps taken:
Boot from a Linux Live cd/dvd and install Linux to the 120Gb drive on the secondary master ide channel.

The drive order detected by Grub during install:
hd(0) sda: 200Gb drive on sata channel 1
hd(1) sdb: 80Gb raid drive on sata chennel 3
hd(2) sdc: 80Gb raid drive on sata channel 4
hd(3) sdd: 250Gb Windows drive on IDE-0
hd(4) sde: 120Gb drive on IDE-1

Note at this point the sata drives appear before the ide drives, opposite to the bios mapping order. The result of this is the root drive in the menu.lst file is written as hd(4,0) (Linux having been installed to hd(4) sde1)

Writing Grubb to hd(0) [default] results in the bootloader going to the wrong drive. Writing Grub to hd(4) results in the bootloader going to the Linux drive. Writing Grub to hd(3) results in Grub over-writing the Windows bootloader.

On re-boot, Grub now decides to detect the drives in bios order:
hd(0) 250Gb Windows drive on IDE-0
hd(1) 120Gb drive on IDE-1
hd(2) 200Gb drive on sata channel 1
hd(3) 80Gb raid drive on sata chennel 3
hd(4) 80Gb raid drive on sata channel 4

Menu.lst points root to hd(4,0), which now appears as part of my raid array, resulting in a boot error (Grub cannot find the Linux Kernel because it is looking on the wrong drive.) If the bootloader is installed to the Windows drive you get a Grub error and an un-bootable system.

If any readers have got to this last point then you need to boot from your Windows XP cd, press "r" for recovery console when prompted and type in "fixmbr" to recover your Windows bootloader. This will make your system bootable again WITHOUT wiping out your data. (Grub over-writes the mbr bootsector leaving all further sectors intact, so you don't lose Windows, just the bootloader)

At this point I have tried a couple of successful solutions, all of which boot to Linux and do not touch the Windows bootloader on the primary drive.

1. Make a Grub boot disk and copy the device.map and menu.lst from the Linux drive to the floppy. Edit the menu.lst file on the floppy and change the Linux root to hd(1,0). This will allow Grub to boot from floppy and to continue booting from the correct Linux hard drive partition (by-passing the boot sector on the Linux drive). This WORKS!

2. Use GAG (as suggested by alan_ri earlier in the thread) as an alternative bootloader. This also works but...
For this to work I had to edit the menu.lst file on the Linux drive and change all root references from hd(4,0) to hd(1,0). Next boot straight from the Grub boot floppy, press "c" for a command prompt at the menu, then install the Grub bootloader to the first partition of the Linux drive:
grub> root (hd1,0)
grub> setup (hd1,0)
Note that this installs the bootloader to the first _partition_, not the mbr of the drive.
Now just set up GAG to point to the first partion of the Linux drive and presto - one Grub boot menu appears as if by magic. Another successful boot. (If Grub is not on the partition bootsector then GAG complains there is no bootable device)

However, I still cannot get a successful boot from the mbr on my primary drive. That still refuses to work properly. I just get a black screen with the word grub at the top left.

I have also tried (without success) to chainload Grub from the Windows ntloader by copying the first 512 bytes of the linux partition to a linux.bin file. From within Linux:

dd if=/dev/sde1 of=/media/floppy/linux.bin count=1 bs=512

Copy this .bin file from the floppy to the root directory of the Windows drive and edit boot.ini (add c:\linux.bin to the end of the boot.ini file). This will give a Windows boot menu between Windows XP and Linux.

Problem, I cannot get Grub to chainload, I just get the same black screen with the word grub in the top left. If I make an image of the Linux drive mbr (sde) instead of the Linux partition boot sector (sde1) I get as far as Stage 1.5 followed by a grub error (cannot find drive)

If I can sort this last problem out then I can safely install Grub to my primary boot sector and get it working 100%. I suspect that If I can solve the problem with the chainload from a .bin image, then I can probably use that solution to install grub directly to the mbr of the primary drive and boot from that.

I had this problem when I installed Suse on my last computer, and I remember using the map hd(x) hd(y) command to solve it. I haven't attempted to try this yet.

If anybody can throw light on this final problem then we can finally close this thread...

Apologies for the long post, just re-capping to clarify things.

Regards
Steve (ShadStar)

Last edited by ShadStar; 06-28-2008 at 05:27 PM. Reason: spelling error
 
Old 06-28-2008, 07:37 PM   #33
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Steve,strange thing is that grub order of devices was changed on reboot if you didn't change anything in bios or removed or replaced any drive.You are trying to install grub on the mbr of the primary drive and that is a windows drive,shouldn't there be a linux partition with Fedora on it so that you will be able to boot anything at all.I don't remember if you tried that option since I didn't have much time to look at this thread from the start but I have read few last posts and that seems like a good idea.One more idea,why don't you set bios order to match grub or gag order and not vice versa,also you've mentioned mapping and I remember that we tried that also in this thread but you know whenever something changes you have to do it again,so as you said yourself give it a try.Normaly correct mapping should solve the problem,but as I said strange is that grub sees things differently on reboot sometimes and that's what I would like to know why.
 
Old 06-29-2008, 08:30 AM   #34
ShadStar
Member
 
Registered: Feb 2007
Location: South West of the United Kingdom.
Distribution: Ubuntu 8.04 (Hardy Heron)
Posts: 36

Original Poster
Rep: Reputation: 15
Hi

I agree, it is very strange that grub is changing the order of the drive detection. For some reason, when running under linux, it is detecting sata before ide. In native boot mode it gets the correct info from the bios and detects ide before sata.

The only thing I can change in my bios is the boot order of the drives, I can't seem to do anything with the hardware mapping. I seem to be stuck with the ide channels first followed by the sata channels. It is interesting to note that the sata channels are mapped as ide devices when they are not being allocated to the raid controller, making them "virtual" ide devices. If they are mapped to the raid controller they don't appear at all in the normal bios drive list. There is no seperate section for sata devices. I wonder if this has anything to do with the problem.

Gag also seems to be detecting my drives in the correct bios order, when I point it to my Linux drive it appears in the correct place as Secondary ide Master. I just point to the first partition on the secondary ide drive and it boots Linux with no problems.

I can also confirm that I have not changed the order of the boot devices on re-boot. My system allows me to press f11 at boot time to select a boot drive. I have not done this because that would result in the drive order being different to the order listed in device.map, so I have left this alone and stayed with the default bios boot order.

I have not yet tried booting with the boot order changed, I will try that next.

I do not actually have a Fedora partition on the 250Gb Windows primary drive (that I know of...) I have confined Fedora to the secondary master ide drive (120Gb). I have left the Windows drive alone and not moved any partitions around. The Windows drive does have 2 partitions on it, as you can see from the hardware list posted earler, but this is not a Linux partition, it is an ntfs partition for storing Windows data.
There is also an unallocated 8mb space on the Windows drive, slack space in case I start to get physical drive errors.

Drive mapping seems to be an alternative but I can't understand why I get a black screen/grub message when I install grub to the primary mbr. This indicates that it can't find Stage2 (please correct me if I am wrong...). I thought that mapping only took place after Stage2 had completed and I had a menu.

Is there a command line I should be using with the grub "setup" command that tells the grub bootloader to look at hd(1,0) instead of hd(0,0) for Stage2?

I am going to try a few options as you suggested and I will let you know what happens.

Thanks again for your help

Regards
Steve (ShadStar)

p.s. I am not actually using a /boot partition for Linux at the moment. Could this be the reason why I can't chainload via ntldr or get a successful boot by putting grub into the primary drive mbr? Do I need to install a /boot partition for Linux? I don't think this is the case but I am actually trying to boot Linux off a second drive not the primary drive. Just a thought...

Last edited by ShadStar; 06-29-2008 at 08:53 AM. Reason: Adding a p.s.
 
Old 07-14-2008, 06:08 PM   #35
ShadStar
Member
 
Registered: Feb 2007
Location: South West of the United Kingdom.
Distribution: Ubuntu 8.04 (Hardy Heron)
Posts: 36

Original Poster
Rep: Reputation: 15
Hi all

I am finally putting this one to bed once and for all. It is almost certain that the problems I am having are due to some strange bios mapping of the ide / sata channels. Even with the raid controller shut down I still get drive swapping. It doesn't matter which order I change the drives to in the bios, and it makes no difference how I physically connect them, I STILL get drive swapping at boot-time.

As previously mentioned, as a current solution, I am booting from a GAG floppy disk and pointing this to my Linux drive primary partition (Secondary IDE Master drive, first partition).

I have installed the grub boot loader into the first partition boot sector (not the MBR of the drive) which successfully boots straight into whichever flavour of Linux I choose to install (currently Ubuntu 8.04)

I am going to stick with this setup until I upgrade my motherboard. It works for me and doesn't interfere with the rest of my drive configuration.

At this point I would like to thank alan_ri for his continued support and inspiration which has let me get this far, and has prompted me to learn a considerable amount about the Linux boot sequence and bios interaction... well to scratch the surface of it anyway :-)

Thanks again, I will post back if I finally do manage to solve this one but I honestly don't think it is possible with this motherboard.

Regards to all
Steve (ShadStar)
 
Old 07-15-2008, 09:04 AM   #36
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Tank you ShadStar for your kind words and thoughts.I wish you all the best and I hope that someone else will jump in here to help you if you would need more help with your problem because I want be on the net for a few months,it's because of the nature of my profession.
So,stay well
and
Cheers!
 
Old 07-15-2008, 01:14 PM   #37
ShadStar
Member
 
Registered: Feb 2007
Location: South West of the United Kingdom.
Distribution: Ubuntu 8.04 (Hardy Heron)
Posts: 36

Original Poster
Rep: Reputation: 15
Cheers Alan, all the best. Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't boot live cd, cdrom time out, ecs mobo/ celeron pc rocket777 Ubuntu 3 06-23-2007 10:17 PM
Fedora core 6 Gigabyte mobo Raid problems Typer0494 Linux - Newbie 4 05-01-2007 11:38 AM
Install problems with Edgy on ECS P4M890T mainboard siesa Ubuntu 0 01-27-2007 03:15 AM
ECS K7S5APRO mobo can't powerdown mortal *BSD 5 03-28-2005 11:22 PM
RTL-8139 on ECS L7SOM mobo Chernobyl Linux - Hardware 6 04-05-2003 02:31 AM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration