# kernel panic when booting with sata connector in

## new_fish

Hi everybody, I'm a new Gentoo user and i have to say that I'm really happy with the huge amount of new things I'm learning everyday...

I've used other linux distros before, although I'm still a novice, but this is really another planet.... anyway back on topic....

Right now my system is fully working, is stable, is fast and I'm still configuring all the things i need, but the problem is that i'm having some issues with a kernel panic.

My system is installed in an hard disk connected via a IDE cable and i have another HD with another OS installed in it, but this is connected via a SATA cable. 

Now, if i boot up the system with SATA HD disconnected all works fine, but if i boot up with both cable connected i get a kernel panic.

I was using the same configuration with another distro before and all was working good... i just want to pick the right HD at startup (by pressing F8 ) and the bootloader of the selected HD will do the rest.

I think i configured my kernel properly, all the drivers are compiled but maybe i missed something... after all i'm still a noob   :Rolling Eyes: 

I don't know how to proceed right now, since i don't know how to get the error (dmesg isn't showing it) i took a picture of the panic...

http://www.4shared.com/photo/hAWP_nCwce/20140718_155326.html

Yes, i know this is a pretty noobish way of doing things... 

Is there anyone that can point me on the right direction?

Oh, and if you need some other info, and i think so, i'll post them...

Thanks a lot

----------

## DONAHUE

Did you use genkernel to create your kernel?

Which bootloader are you using? grub? grub2? lilo? syslinux? ??

picture of the panic is an excellent idea. 

boot the livecd/usb, mount the gentoo partitions, 

```
lspci -k | wgetpaste

wgetpaste /mnt/gentoo/usr/src/linux/.config

wgetpaste /mnt/gentoo/boot/grub/grub.conf

wgetpaste /mnt/gentoo/boot/grub/grub.cfg

wgetpaste /mnt/gentoo/etc/lilo.conf
```

 post the url's returned depending on bootloader used two or more  will not return a url and can be skipped

This may be as simple as the kernel calling the gentoo hard drive /dev/sdb when both drives are connected instead of /dev/sda as it inevitably does when the gentoo drive is the only drive.

----------

## new_fish

Oh my god, what a lack of details... sorry   :Embarassed: 

Well, thank you DONAHUE, after reading your post i finally managed to get it working... actually it was a naming issue, although i can't understand why it behave like this.

Here are the details:

lspci -k is here

Kernel compiled manually, i prefer this way so i can better understand my system.

Kernel config is here

Grub2 is my bootloader

Grub2 config is here

So the problem, as you said, is that when only one drive is connected it takes /dev/sda* name, however when i connect the SATA drive (which seems to come first at detection time) it takes /dev/sdb*.

I don't know if i was overthinking or I'm just not smart enough, lol.

I mean, for me was simply wrong to use sdb because when i boot from the livecd with both HD connected, sda is used to identify IDE HD and sdb is used to identify SATA HD... so, why the livecd environment is different from the one i just built?

Anyway, thank you very much for your help.

----------

## DONAHUE

 *Quote:*   

> so, why the livecd environment is different from the one i just built?

  A good question that I have never been able to answer. I've been through it before including having kernel updates flip the names on a mix of ide and sata drives.

----------

## krinn

It has always been first seen first served.

Livecd boot from cd, and then load all possible controller module it could in order to recognize drives.

if livecd get your ata controller first, ata disk will be sda, and sata will then be sdb...

Once you boot your own kernel, things change, as people must buildin controller in order to make it boot, so when buildin, the first controller loaded might be sata and so sata drive get sda, pushing ata drive to sdb.

Your solve is really easy : make sure your boot drive (ata) controller driver is buildin your kernel and build your sata drivers as module.

This way, sata present or not, the kernel will have no choice than seeing the ata controller first and gives sda to the ata drive.

The sata will be seen later when its module will be load, and so its drive will get sdb

----------

## new_fish

Awesome, this is something I'll surely try as soon as possible, thanks for the advice.

By the way, is there a method to refer to HD drives by ID or by mac address or something similar, something fixed?

This way we don't need to know what is the first drive because HD1 will always have the same ID.

----------

## krinn

There's boot by UUID, but you have to ask someone else about implementing that.

And you have mount by UUID, label... anything udev could handle, the list is there : /dev/disk

----------

## NeddySeagoon

new_fish,

Partitions have a UUID, Filesystems have a UUID and may have a label.

Do not confuse the Partition UUID with the filesystem UUID

The kernel supports booting using Partition UUIDs, even with MSDOS partition tables.

Google will tell you the syntax. Nothing extra is required.

To boot by Filesystem UUID on filesystem Label, you need some user space tools to mount your root filesystem.

Thats what an initramfs is for.

----------

