# [SOLVED] Kernel panic when switched from sata3 to sata6

## Serchio

Hello,

From some time I tried to discover what is happening when I am trying to start my gentoo linux from my ssd drive Samsung 840 Evo. 

System is working normally when my ssd is connected to sata3 connector but when I switch it to sata6 I receive kernel panic. 

Unfortunately, I can't read the kernel panic message because my framebuffer for grub is too small - I have a nvidia card and I can't get bigger resolution than 1280x800.

I was trying to use netconsole to discover kernel panic message but without luck. I have tried to test netconsole with modprobe with all necessary parameters but netconsole is not sending any packages to other local host.

I was trying to use kdump to login in rescue mode when kernel panic occure but also without luck.

I don't know what I can do more to discover what is wrong with my kernel or maybe with my gentoo.

My motherboard is Asus P8Z77-V LX2.

Here is my kernel config: http://pastebin.com/KEhyw5TQ

Here is my lspci: http://pastebin.com/ZsNK6ViH

I have tried to use netconsole in such way:

```
modprobe netconsole netconsole=4444@192.168.1.110/enp3s0,5555@192.168.1.146/68:a8:6d:4f:af:64
```

I have created such config for kdump:

```
#!/bin/bash

kexec -p /boot/vmlinuz-3.15.3-gentoo --append="root=/dev/sdc2 single irqpoll maxcpus=1 reset_devices"
```

In messages I can saw such message:

```
Aug 10 15:40:07 laporath systemd[1]: Starting Service for local.d/kdump.*...
```

Any suggestions what I can try to discover and fix kernel panic?Last edited by Serchio on Sun Aug 10, 2014 10:00 pm; edited 1 time in total

----------

## NeddySeagoon

Serchio,

When does the panic occur?

During booting, before root is mounted or some time later?

----------

## Serchio

NeddySeagoon,

It is really hard to determinate because boot is super fast and kernel panic is occurring immediately. 

In normal boot when ssd is connected to sata3 my gentoo is booting 5 seconds only...

If you have any idea how to slow it down it would be really helpful.

----------

## Ant P.

boot_delay=1000 should do it.

----------

## Serchio

 *Ant P. wrote:*   

> boot_delay=1000 should do it.

 

I have appended it to grub in kernel section but boot speed was normal. Should it be appended somewhere else?

It is my gentoo boot section:

```
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-31cf4eb8-f097-4b14-9f76-09aa6ce46faf' {

        load_video

        insmod gzio

        insmod part_msdos

        insmod ext2

        set root='hd2,msdos2'

        if [ x$feature_platform_search_hint = xy ]; then

          search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos2 --hint-efi=hd2,msdos2 --hint-baremetal=ahci2,msdos2  31cf4eb8-f097-4b14-9f76-09aa6ce46faf

        else

          search --no-floppy --fs-uuid --set=root 31cf4eb8-f097-4b14-9f76-09aa6ce46faf

        fi

        echo    'Loading Linux 3.15.3-gentoo ...'

        linux   /boot/vmlinuz-3.15.3-gentoo root=/dev/sdc2 ro  boot_delay=1000 init=/usr/lib/systemd/systemd crashkernel=256M

}

```

----------

## NeddySeagoon

Serchio,

netconsole must be built in. I suspect that root is not mounting for some reason.

Further

```
 netconsole netconsole=4444@192.168.1.110/enp3s0,5555@192.168.1.146/68:a8:6d:4f:af:64
```

	cannot work until udev is running, after root is mounted. 

enp3s0 is a udev assigned name. It will be eth0 before the panic.

How many hard drives do you have and what SATA ports does dmesg tell they are connected to when it works?

----------

## Serchio

NeddySeagoon,

I have 3 drives. There is the dmesg output:

```
[    0.567087] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[    0.567281] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[    0.567473] ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[    0.568068] ata4.00: ATA-8: WDC WD6401AALS-00J7B0, 05.00K05, max UDMA/133

[    0.568246] ata4.00: 1250263728 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[    0.569410] ata4.00: configured for UDMA/133

[    0.569636] ata6.00: supports DRM functions and may not be fully accessible

[    0.569880] ata6.00: failed to get NCQ Send/Recv Log Emask 0x1

[    0.569883] ata6.00: ATA-9: Samsung SSD 840 EVO 250GB, EXT0BB6Q, max UDMA/133

[    0.571773] ata6.00: 488397168 sectors, multi 1: LBA48 NCQ (depth 31/32), AA

[    0.572093] ata6.00: supports DRM functions and may not be fully accessible

[    0.572312] ata3.00: ATA-8: WDC WD20EARS-00MVWB0, 51.0AB51, max UDMA/133

[    0.572498] ata3.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[    0.572769] ata6.00: failed to get NCQ Send/Recv Log Emask 0x1

[    0.572772] ata6.00: configured for UDMA/133

[    0.577857] ata3.00: configured for UDMA/133

[    0.578118] usb 1-1: new high-speed USB device number 2 using ehci-pci

[    0.578265] scsi 2:0:0:0: Direct-Access     ATA      WDC WD20EARS-00M 51.0 PQ: 0 ANSI: 5

[    0.578655] sd 2:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

[    0.578659] sd 2:0:0:0: Attached scsi generic sg0 type 0

[    0.578911] scsi 3:0:0:0: Direct-Access     ATA      WDC WD6401AALS-0 05.0 PQ: 0 ANSI: 5

[    0.579250] sd 3:0:0:0: Attached scsi generic sg1 type 0

[    0.579281] sd 3:0:0:0: [sdb] 1250263728 512-byte logical blocks: (640 GB/596 GiB)

[    0.579488] sd 3:0:0:0: [sdb] Write Protect is off

[    0.579490] sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00

[    0.579493] scsi 5:0:0:0: Direct-Access     ATA      Samsung SSD 840  EXT0 PQ: 0 ANSI: 5

[    0.579569] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    0.579729] sd 5:0:0:0: Attached scsi generic sg2 type 0

[    0.579763] sd 5:0:0:0: [sdc] 488397168 512-byte logical blocks: (250 GB/232 GiB)

[    0.579912] sd 5:0:0:0: [sdc] Write Protect is off

[    0.579914] sd 5:0:0:0: [sdc] Mode Sense: 00 3a 00 00

[    0.579953] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    0.580512]  sdc: sdc1 sdc2

[    0.580930] sd 5:0:0:0: [sdc] Attached SCSI disk

[    0.582001] sd 2:0:0:0: [sda] Write Protect is off

[    0.582181] sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00

[    0.582195] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    0.588586]  sdb: sdb2

[    0.589165] sd 3:0:0:0: [sdb] Attached SCSI disk

[    0.604512]  sda: sda1

[    0.604916] sd 2:0:0:0: [sda] Attached SCSI disk

```

I was trying to run netconsole from command line like showed in many examples, but any packet is not reaching my second machine. Do you think, that should I put it to my kernel anyway?

----------

## NeddySeagoon

Serchio,

When you move the drives around on tho SATA connectors, they will change names.

Your root will no longer be 

```
root=/dev/sdc2
```

 it will be on root=/dev/sda2 or root=/dev/sdb2 instead.

You will need to change both grub.cnf and /etc/fstab to work with your new drive ordering.

You will still have /devsd[abc] but the letters will reference different drives.

```
[    0.578655] sd 2:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB) == ata3 WDC WD20EARS-00MVWB0

[    0.579281] sd 3:0:0:0: [sdb] 1250263728 512-byte logical blocks: (640 GB/596 GiB) == ata4 WDC WD6401AALS-00J7B0

[    0.579763] sd 5:0:0:0: [sdc] 488397168 512-byte logical blocks: (250 GB/232 GiB) == ata6 Samsung SSD 840 EVO 250GB
```

This looks like your non working configuration

----------

## Serchio

Thank you NeddySeagoon, you were right and you have solved my problem  :Smile: 

My root is now /dev/sda2 but I will need to replace it with drive uid to be better prepared for changes.

----------

## NeddySeagoon

Serchio,

Mounting root by filesystem UUID requires an initrd as the kernel does not understand filesystem UUIDs.

However partitions also have a UUID and the kernel does understand PARTUUID.

blkid will tell you both the filesystem UUID and partition UUID.

----------

