Gentoo Kernel Panic - Unable to mount root fs

Written by Peter Davies on .

I wrote this a while back with an aim to place it on a blog... I'm hoping that it helps someone else in this situation.

As suggested by one of the links at the base, this error seems to entirely related to the options selected when you are compiling the kernel. In my particular situation (and it does change in *every* persons circumstance - unless the hardware is 100% the same) the drivers for the SCSI raid controller were missing. I solved this by running lspci which listed the devices attached to the system.

On running this I spotted that most hardware was Intel based and that the RAID controller was specifically an Adaptec model. The lspci reported no model number so I took a closer look at the physical device as it was on my desk! It stated it was a 50xx00 (or similar) model although from examingin the menuconfig options I could not see anything taht directly related to this. I then simply selected every Adaptec model (I know bloatware) and made sure that the standard SCSI options were selected:

"Device Drivers" --> "SCSI Drvice Support"

Check the following with [*]:

  • SCSI Disk Support
  • SCSI CDROM Support
  • SCSI Generic Support
  • Verbose SCSI Error Handling (kernel size+- 12k)

[this was from the 2nd link: http://ubuntuforums.org/showthread.php?t=624511]

I then also made sure that I had discovered the correct "root=" value which was from the Kernel Trap site (http://kerneltrap.org/node/1955) which identified that you need to reference the correct HEX based address of the SCSI block device:

# ls -l /dev/sda3

resulting in:
brw-rw---- 1 root disk 8, 5 Jan 15 14:40 /dev/sda3

Therefore the (major, minor) number are (8,3). Translate this number to hexadecimal and pad to a two digit number, e.g.: 8,3 becomes 0803 and you have the hexadecimal form of the block device.

Now you can use this in place of "root=/dev/sda3" in /boot/grub/grub.conf

Then exit the chroot'ed environment and reboot:

# exit
# umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
# reboot

[remove live CD]

The GRUB loader should start listing the default entry with a countdown. On completion it should complete the boot process loading the correct SCSI drivers which are highlighted during boot by identification of the connected devices to the SCSI adapter (possibly thanks to the "Verbose SCSI Error Handling"?). You will also spot that the point at which the system usually had a Kernel Panic has now been passed (just above the SCSI drive identification). Now login, update portage and emerge world etc...

This process took approx 1.5 weeks on and off with various trips to the datacenter! So, when this issue appears on your screen I would suggest enabling each of the menuconfig options as "built-in" not "modules" making sure that anything that appeared when you ran lspci appears selected within the config.

As I said, I'm hoping this helps someone as and when it gets indexed by Google! Also, here are the links to the solution that I found from trawling the Net: