Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub won't boot system after SATA drive is added
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Sat Aug 26, 2006 9:21 pm    Post subject: Grub won't boot system after SATA drive is added Reply with quote

I have a couple of similar gentoo systems but I can't seem to work this problem out on one of them.

I am trying to add a 320GB SATA drive and Silicon Image 3114 SATA controller to a sempron system. The system boots fine with just the SATA controller installed but not if a SATA drive is plugged into the controller. I use the same model controller and drive config in my desktop amd64 and it works fine. These machines both have Promise ATA 100tx2 controllers in them with multiple drives attched. I have the controllers arranged so that the SATA controller is scanned last.

The 2006.0 i386 minimal CD boots fine with the SATA drive plugged in and I can see all devices as expected. I have re-installed grub on hd0 I am running a fairly recent version of gentoo (2.6.15-gentoo-r5 #1 SMP Mon Feb 13 20:23:47 UTC 2006 i686 AMD Sempro).

With the drive plugged in, the boot fails:

grub loading stage1.5.

GRUB loading, please wait...
(hangs)

--------

Initially I thought that /dev/sda was getting put in my grub device list ahead of /dev/hda and messing up the device numbering. But that doesn't seem to be the case.

I've been over a lot of grub docs and posts but can't seem to figure this one out.

Thanks for any help!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54809
Location: 56N 3W

PostPosted: Sat Aug 26, 2006 9:24 pm    Post subject: Reply with quote

freelunch,

Check your BIOS boot order. If it says to check SCSI first, your SATA will bump the drive numbering out.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Sat Aug 26, 2006 9:46 pm    Post subject: Reply with quote

Thanks for the suggestion. That didn't seem to be it.

I reviewed the order in the bios and it was hd0, cdrom and scsi. I removed the scsi entirely and also removed 'enable boot from alternate device'. After that made no difference I tried the 'press F9 to specify boot device after post' option and chose hd0..
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Mon Aug 28, 2006 3:02 pm    Post subject: Reply with quote

Any other suggestions on how I can further debug/diag this? I wish I could get some more diag info from the various stage loaders.

Very frustrating to have the gentoo CDs handle it just fine as well as knoppix.. Not to mention my desktop machine.

Thanks!
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Mon Aug 28, 2006 3:28 pm    Post subject: Reply with quote

Maybe the "solution" is to ditch grub and try lilo.
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Mon Aug 28, 2006 3:42 pm    Post subject: Reply with quote

You could try creating a GRUB boot floppy and booting from that. When you get a command line, enter
Code:
find /boot/kernel-2.6.17-gentoo-r6
Obviously you will have to replace "/boot/kernel-2.6.17-gentoo-r6" with the path and filename to the kernel you want to boot.

This should then give you something like
Code:
grub> find /boot/kernel-2.6.17-gentoo-r5
 (hd1,6)

grub>
You can then alter your grub.conf appropriately.

Making a GRUB floppy is in the GRUB info file. If you don't use Emacs :) here it is
Code:
To create a GRUB boot floppy, you need to take the files `stage1' and `stage2' from the image directory, and write them to the first and the second block of the floppy disk, respectively.

   *Caution:* This procedure will destroy any data currently stored on the floppy.

   On a UNIX-like operating system, that is done with the following commands:

     # cd /boot/grub
     # dd if=stage1 of=/dev/fd0 bs=512 count=1
     1+0 records in
     1+0 records out
     # dd if=stage2 of=/dev/fd0 bs=512 seek=1
     153+1 records in
     153+1 records out
     #
[Edit, corrected] On Gentoo stage1 and stage2 are in /boot/grub not /usr/lib/grub/i386-pc
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Mon Aug 28, 2006 6:36 pm    Post subject: Reply with quote

Thanks for the help, Wynn.

I will have to try and find a floppy drive to install in the machine. None of my systems have them.

When I did boot from the live cd and chroot to my gentoo root and do a 'find' from grub, it seemed that everything was still located on (hd0,0). Should I expect the situation from a floppy to be different than from an ata cdrom?

One followup question.. You say to modify the grub.conf. Since it hangs just after the stage1.5/grub loading, I had thought it was not getting to the grub.conf. If it can't locate grub.conf, how does modifying grub.conf solve anything?

On this machine I run the grub.conf and kernel exactly as installed by gentoo. Grub.conf is:

default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz
title=Gentoo Linux
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.15-gentoo-r5 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3
initrd /initramfs-genkernel-x86-2.6.15-gentoo-r5
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Mon Aug 28, 2006 7:18 pm    Post subject: Reply with quote

Okay.. I built a grub boot ISO CD instead of a floppy. I verified that the CD works by booting it in my desktop system and receiving the grub prompt. When I try and boot that CD in my problem system, it fails thusly:

Verifying DMI pool data......
Boot from CD: Loading Stage2 ....
<hangs>

And, again, I can boot the problem system using the gentoo 2006.0 IA32 CD just fine.. Of course that CD does Not appear to use grub (looks like ISOLINUX).

So this is sort of looking like a grub issue.. Some kind of failure in stage1.5 or stage2. I'm thinking it fails before it ever gets to my grub.conf.

I left lilo for grub many years ago.. Is there a more appropriate place for grub support? I don't think this is a gentoo issue, though I did hope this was a trivial problem with an easy fix.
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Mon Aug 28, 2006 7:37 pm    Post subject: Reply with quote

Quote:
I will have to try and find a floppy drive to install in the machine. None of my systems have them.
Yes, I would like to change that to a GRUB ISO image which can be burnt to a CDRW but unfortunately I am not sufficiently familiar with the construction of self booting CDs to give you instructions. I will look around for instructions but by that time you will probably have retired this machine in favour of a new one :D

Quote:
One followup question.. You say to modify the grub.conf. Since it hangs just after the stage1.5/grub loading, I had thought it was not getting to the grub.conf. If it can't locate grub.conf, how does modifying grub.conf solve anything?
You've got me there! The problem is that the kernel (from the LiveCD or elsewhere) decides how to allocate drive letters and the BIOS decides the order in which the various interfaces will be presented to GRUB. These are not necessarily the same. So, from the LiveCD you may run "root (hd0,0)" and "setup (hd0)" and I don't think GRUB, running under Linux, can see what the BIOS order is (I may be wrong but the BIOS runs in real mode and GRUB would have to switch to real mode, query the BIOS and then switch back again). So, on booting, the (hd0) where GRUB is installed may not be the same drive that the BIOS says is 0x80.

A way round this is, in your case, plug in the 320GB drive, boot up the LiveCD, create a partition on the 320GB drive (it need only be temporary), make a filesystem on it (something simple like ext2), mount it on, say /mnt/320gb, run
Code:
touch /mnt/320gb/iam320gb
and umount it again.

Now, running GRUB from that pie-in-the-sky GRUB CD, run "find" to see where "/iam320gb" is, this will give you the hd number for the 320GB drive. Run find again to look for your kernel (something like)
Code:
find /boot/kernel-2.6.17-gentoo-r6
and that will give you the hd number for your root drive.

To get it to boot, as it seems not to choose your root drive's MBR, try running GRUB from the LiveCD again and installing GRUB on the other drive. There may be a bit of trial-and-error involved.

A lot of talk — let's hope it helps you solve your problem.
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Mon Aug 28, 2006 7:53 pm    Post subject: Reply with quote

Just did a bit more testing of the grub CDROM..

With the SATA drive unplugged, the grub CDROM boots fine.

But if the SATA drive is plugged in, the grub CDROM hangs as described above.
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Mon Aug 28, 2006 9:01 pm    Post subject: Reply with quote

I just tried lilo and it behaved similar to grub. Without the SATA drive lilo would load, etc. With SATA it would hang after only printing "LIL".

Since KNOPPIX boots fine with all of the hardware connected, I am going to attempt to use that bootloader.. (failing any[/gwn] better ideas)
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Tue Aug 29, 2006 8:47 am    Post subject: Reply with quote

The log message two or three posts ago was a bit undigested :)

What I think might solve the problem is to create the partition on the SATA drive with the marker file, boot the LiveCD, run grub, do a "find" for the marker file and for /boot/grub/grub.conf (no need to remember what the kenel is called with this version).

Now you know which hdX grub thinks your kernel is on and which hdY your SATA drive is on.

Now, to save a lot of trouble, install grub on both — not an elegant solution but it will work. Assuming you get hd1 for your root drive and hd2 for your SATA drive, you can run
Code:
grub
grub> root(hd1,0)
grub> setup (hd1)
grub> quit
Code:
grub
grub> root(hd1,0)
grub> setup (hd2)
grub> quit
just to make my meaning clear :)
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Tue Aug 29, 2006 4:11 pm    Post subject: Reply with quote

Thanks for the suggestion.

I put some profanity on /dev/sda1 and it was found by grub as (hd6,0). My original root disk was still (hd0,0). So I setup the sda drive with grub but the final result upon trying to boot was the same..

I do think that my hda is hd0 at boot and that the sda is not pre-empting it in the list.

So I'm back to the last plan of trying an alternate boot loader.
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Tue Aug 29, 2006 6:07 pm    Post subject: Reply with quote

Quote:
So I'm back to the last plan of trying an alternate boot loader.
Yes, you seem to have results verging on the incredible. A friend couldn't get GRUB to boot on his AMD64 (I could using the same motherboard) but LILO worked and is still working but I've not heard of such a catalogue of failure before.

Your alternate boot loader is SYSLINUX from the same stable as ISOLINUX http://syslinux.zytor.com/. I sincerely wish you the best of luck.
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
freelunch
n00b
n00b


Joined: 17 Nov 2004
Posts: 25

PostPosted: Wed Aug 30, 2006 4:12 pm    Post subject: Reply with quote

Okay..in summary, I am DONE. Thanks again for your suggestions, Wynn. I am not happy that I was unable to truly resolve the root problem but at some point you need to just move on...

I decided the hassle of trying to squeeze a big kernel on a floppy wasn't worth it.. So I shifted my effort to booting the system from CD.

I funbled around with syslinux a bit and made some coasters... I finally discovered you can do a 'make isoimage' to generate a burnable iso.. Progress!

I decided to build a regular kernel and not use genlinux... Unfortunately my 2.6.17.1 kernel had some kind of udev problem that was not easily resolved. I think it broke coldplug and my /dev/sda device was never created (again using a kernel based on what my desktop runs just fine). But the system was booting fine with the sata drive attached.

I decided to switch back to genkernel.. Now everything is almost fine.

The one problem that remains is that my boot CD cannot find my root partition. It may be udev related. I get a 'the root block device is unspecified or not detected'. It then prompts for a root file system. If I type /dev/hda3 then everything works fine. I am passing root=/dev/hda3 as an argument to the kernel so I'm not sure why it is not working.

The machine is headless and a bit loud. I am glad to have it back in the basement where I can't hear it. It seldem gets rebooted so it is no big deal to type '/dev/hda3' blindly at the keyboard. And most important.. My music server is running again ;-)

Here is the script that I use to create my iso.


#!/bin/sh

# run from top level kernel directory

rm -rf arch/i386/boot/isoimage
mkdir arch/i386/boot/isoimage

# Copy genkernel and initrd
cp /boot/kernel-genkernel-x86-2.6.15-gentoo-r5 arch/i386/boot/isoimage/linux
cp /boot/initramfs-genkernel-x86-2.6.15-gentoo-r5 arch/i386/boot/isoimage/initrd.img
# Add boot arguments, etc to boot config
echo 'default linux initrd=initrd.img root=/dev/hda3' > arch/i386/boot/isoimage/isolinux.cfg
# Copy bootloader to iso directory
cp `echo /usr/lib*/syslinux/isolinux.bin | awk '{ print ; }'` arch/i386/boot/isoimage
# create the iso
mkisofs -J -r -o arch/i386/boot/image.iso -b isolinux.bin -c boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
arch/i386/boot/isoimage

ls -l arch/i386/boot/image.iso
#end script
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum