# Kernel can not mount root filesystem

## dman777

I have a SSD drive with indilinx controller, if that matters. 

I am using ext4. I have this enabled in the kernel. 

fisk -l in the gentoo live dvd i use as a rescue shows my drive as sda.

Using grub, I have sda2 for /boot and sda3 for root /. my device.map file shows hd0 for sda. so i have root(h0,1). I have also confirmed with find /boot/kernel1.

When I try to boot into my newly installed system, my kernel seems to load ok from grub. But my kernel(using the latest defaulted from gentoo-sources) can not seem to mount my root file system. Here is the message that I get:

```
VFS: Cannot open root device "sda3" or unkown-block(0,0)

Please append a correct "root=" boot optioin; here are available partitions:

kernel panic - not syncing: VFS: Unable to mount root fs on uknown-block (0,0)
```

Is it the kernel that is complaining or grub?  :Sad:  I don't know since it specifies root= in the error message, but then I also get kernel panic message. Any suggestions?

----------

## mikegpitt

That's a kernel error not grub.  My guess is that your SSD needs a kernel driver to function and your .config compiles it as a module.  I don't have much experience with SSD's (except USB sticks), but once you figure out what the missing driver is you can either compile it into the kernel or load it with an initramfs.

One thing you might want to try is to build your kernel with genkernel and see if it's initramfs automatically loads it at boot.

----------

## dman777

ya,  i will try that as i am running out of choices. one thing to note though, is that with the gentoo live dvd i am able to manually mount that partition. so i copied over that kernel and try to load it with my newly installed system and still got the same error. now i am not sure if it's the kernel or not, because i could manually mount the filesystem with the live dvd kernel. 

Also, when setting my blocks to 512 manually i could not get my partitions to align. but i tried to make sure they started at the begining of a cylinder(in groups of 1028 sectors). Would the kernel have a problem with this? or grub? this fisk was done with an older kernel that recognized the drive as hdc. but i tried hdc3 from grub and still had no success.

```
Disk /dev/hdc: 128.0 GB, 128035676160 bytes

255 heads, 63 sectors/track, 15566 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x1ccf1ccf

Device Boot Start End Blocks Id System

/dev/hdc1 * 1 10444 83886080 7 HPFS/NTFS

Partition 1 does not end on cylinder boundary.

/dev/hdc2 10705 10766 488960 83 Linux

Partition 2 does not end on cylinder boundary.

/dev/hdc3 10835 15567 38003200 83 Linux

Partition 3 does not end on cylinder boundary.
```

----------

## cach0rr0

FWIW, i read elsewhere on the forums that alignment is no longer particularly relevant 

Could you post your lspci -n, and upload your kernel .config to pastebin so we can have a look and see if anything is missing? 

(if you can't figure out how to upload it otherwise, `emerge wgetpaste` and check the man page)

----------

## roarinelk

 *dman777 wrote:*   

> 
> 
> ```
> VFS: Cannot open root device "sda3" or unkown-block(0,0)
> 
> ...

 

You don't have any "sdX" nodes, I think you've configured to use the

"old" IDE subsystem which creates the well-known "hdX" nodes.

Watch the kernel message when it boots, it should print the partition

list (with the hdX or sdX convention) after the disk has been detected.

----------

## dman777

No, it doesnt print a partition list. I wish it did. It does say please choose another partition from list...but doesn't list anything. It's not looking for hdx. I don't think it is correctly looking for anything because it doesn't list sdx or hdx. That fdisk output i pasted earlier was from an old kernel that was used, so please disregard the hd# convention.

Ok, good news and bad news. 

Using the genkernel, I had the same problem. It said "could not mount root on filesystem .". And it did not list the device, just gave a period. However, it did give me the option to manually type in the dev that the root file system is on(although it did not give me a list of devices to choose from). So I typed in "/dev/sda3" and it found it and my system loaded successfully. So, what is the root cause and how do I fix this? I double checked my fstab and it looks good to me "/dev/sda3    /   ext4   noatime   01"

Update: After doing some research, I tried using the class and character number of sda3 and padded it with 0's for root=0803. It did not fix the problem, but it did change the location to where it is looking:

```
VFS: Cannot open root device "0803" or unkown-block(8,3) 
```

Does this have anything to do with the ext4 filesystem? do i need to enable a feature on it? i read something about dir_index but have no idea about it.

----------

## mikegpitt

Can you post the contents of: /etc/fstab, /boot/grub/grub.conf, and /boot/grub/device.map?

----------

## dman777

Just to be clear, both kernels(genkernel and custom kernel) can not find the root fs on their own. The only difference between the 2 kernels is the genkernel stops and gives me a prompt to manually enter in the root dev filesystem in which after I enter it the system finishes loading successfully. I looked for errors in dmesg but did not find any. 

Grub.conf

```
# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook

# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2

# If you are not using Genkernel and you need help creating this file, you

# should consult the handbook. Alternatively, consult the grub.conf.sample that

# is included with the Grub documentation.

default 0

timeout 30

#splashimage=(hd0,0)/boot/grub/splash.xpm.gz

#title Gentoo Linux 2.6.24-r5

#root (hd0,0)

#kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 real_root=/dev/sda3

#initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5

# vim:ft=conf:

title Windows XP

rootnoverify (hd0,0)

makeactive

chainloader +1

title Gentoo

root (hd0,1)

kernel /boot/kernel1 root=/dev/sda3 video=uvesafb:mtrr:3,ywrap,1024x768-32

title Gentoo Genkernel

root (hd0,1)

kernel /boot/kernel-genkernel-x86_64-2.6.31-gentoo-r6 root=/dev/ram0 init=/linuxrc ramdisk=8192 realroot=/dev/sda3

initrd /boot/initramfs-genkernel-x86_64-2.6.31-gentoo-r6
```

device.map

```

(fd0)   /dev/fd0

(hd0)   /dev/sda

(hd1)   /dev/sdb

(hd2)   /dev/sdc
```

mtab

```

/dev/sda3 / ext4 rw,noatime 0 0

proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

udev /dev tmpfs rw,nosuid,relatime,size=10240k,mode=755 0 0

devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0

/dev/sda2 /boot ext4 rw,noatime 0 0

shm /dev/shm tmpfs rw,noexec,nosuid,nodev 0 0

usbfs /proc/bus/usb usbfs rw,noexec,nosuid,devmode=0664,devgid=85 0 0
```

uname -a

```
Linux localhost 2.6.31-gentoo-r6 #1 SMP Sun Jan 17 20:22:21 CST 2010 x86_64 AMD Phenom(tm) II X3 705e Processor AuthenticAMD GNU/Linux
```

fstab

```
# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't 

# needed; notail increases performance of ReiserFS (at the expense of storage 

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda2      /boot      ext4   defaults,noatime   1 2

/dev/sda3      /      ext4      noatime      0 1

#/dev/SWAP      none      swap      sw      0 0

/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0

#/dev/fd0      /mnt/floppy   auto      noauto      0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

shm         /dev/shm   tmpfs      nodev,nosuid,noexec   0 0
```

lspci

```
00:00.0 Host bridge [0600]: ATI Technologies Inc RX780/RX790 Chipset Host Bridge [1002:5957]

00:02.0 PCI bridge [0604]: ATI Technologies Inc RD790 PCI to PCI bridge (external gfx0 port A) [1002:5978]

00:0a.0 PCI bridge [0604]: ATI Technologies Inc RD790 PCI to PCI bridge (PCI express gpp port F) [1002:597f]

00:11.0 SATA controller [0106]: ATI Technologies Inc SB700/SB800 SATA Controller [IDE mode] [1002:4390]

00:12.0 USB Controller [0c03]: ATI Technologies Inc SB700/SB800 USB OHCI0 Controller [1002:4397]

00:12.1 USB Controller [0c03]: ATI Technologies Inc SB700 USB OHCI1 Controller [1002:4398]

00:12.2 USB Controller [0c03]: ATI Technologies Inc SB700/SB800 USB EHCI Controller [1002:4396]

00:13.0 USB Controller [0c03]: ATI Technologies Inc SB700/SB800 USB OHCI0 Controller [1002:4397]

00:13.1 USB Controller [0c03]: ATI Technologies Inc SB700 USB OHCI1 Controller [1002:4398]

00:13.2 USB Controller [0c03]: ATI Technologies Inc SB700/SB800 USB EHCI Controller [1002:4396]

00:14.0 SMBus [0c05]: ATI Technologies Inc SBx00 SMBus Controller [1002:4385] (rev 3c)

00:14.1 IDE interface [0101]: ATI Technologies Inc SB700/SB800 IDE Controller [1002:439c]

00:14.2 Audio device [0403]: ATI Technologies Inc SBx00 Azalia (Intel HDA) [1002:4383]

00:14.3 ISA bridge [0601]: ATI Technologies Inc SB700/SB800 LPC host controller [1002:439d]

00:14.4 PCI bridge [0604]: ATI Technologies Inc SBx00 PCI to PCI Bridge [1002:4384]

00:14.5 USB Controller [0c03]: ATI Technologies Inc SB700/SB800 USB OHCI2 Controller [1002:4399]

00:18.0 Host bridge [0600]: Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] HyperTransport Configuration [1022:1200]

00:18.1 Host bridge [0600]: Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] Address Map [1022:1201]

00:18.2 Host bridge [0600]: Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] DRAM Controller [1022:1202]

00:18.3 Host bridge [0600]: Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] Miscellaneous Control [1022:1203]

00:18.4 Host bridge [0600]: Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] Link Control [1022:1204]

01:00.0 VGA compatible controller [0300]: nVidia Corporation G73 [GeForce 7600 GT] [10de:0391] (rev a1)

02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168] (rev 02)

```

----------

## drescherjm

```
kernel /boot/kernel-genkernel-x86_64-2.6.31-gentoo-r6 root=/dev/ram0 init=/linuxrc ramdisk=8192 realroot=/dev/sda3 
```

You have realroot instead of real_root in your grub.conf

----------

## dman777

yes, that was it. thanks. now genkernel boots up with no problems. i need to compare the 2 kernels and see what could be the problem. one question though, how can i be certain it is an option in the kernel that is allowing it to load not the initramfs? i read in earlier batches of grub that the initramfs was what made it possible to load up ext4.

----------

## mikegpitt

 *dman777 wrote:*   

> yes, that was it. thanks. now genkernel boots up with no problems. i need to compare the 2 kernels and see what could be the problem. one question though, how can i be certain it is an option in the kernel that is allowing it to load not the initramfs? i read in earlier batches of grub that the initramfs was what made it possible to load up ext4.

 Grub wasn't able to load off an ext4 partition.  This isn't related to the initramfs, but related to grubs boot process.  Basically grub works by loading it's stage1 in your MBR, stage1.5 and stage2 are stored on your disk... if grub doesn't understand your filesystem it won't be able to boot.  This is why it's recommended to use ext2 or ext3 for  /boot.  Once grub loads your initramfs (or kernel if you aren't using an initramfs) it's out of the picture.

The reason the initramfs worked for you is because it pre-loads a bunch of drivers prior to loading your kernel.  Think of the initramfs as a mini linux that handles loading the real linux install on your system.  My suggestion is to see the drivers it is loading with lsmod, and see which of those related to your SSD.  After that, you can build that module directly into your kernel (use Y instead of M in your .config/menuconfig), and you should be able to boot without an initramfs.

----------

## dman777

ughh...i was expirementing  and disabled some options in genkernel, compiled, etc. it didn't work. but then when i tried to get the default genkernel back and recompile, etc. i still can't get my root filesystem to mount again. i tried uninstalling and reinstalling genkernel, make clean, make mrproper, and just deleting all the .config files but still i can't get genkernel to mount the root filesystem like it did before.  :Sad: 

----------

## drescherjm

Did you change grub.conf?

----------

## dman777

no, i didn't touch grub. in desperation, i double checked the grub.conf. I also double checked the file modification update times for the genkernel to make sure it was the updated kernel.  I was able to go in the shell of the tmpfs when it complained of not being able to mount root and i only saw a /dev/sda and /dev/sda1. 

earlier with the live dvd and chroot into my sys i did a emerge -C gentoo-sources and emerge -C genkernel. but i reinstalled them later. could something else of got deleted in udev?

how can i be sure i am getting all the default setttings that are supposed to be in genkernel?

----------

## drescherjm

Maybe you should either use one of Pappy's kernel seeds

https://forums.gentoo.org/viewtopic-t-801641-highlight-pappy.html

or seed the kernel from the live dvd.

something like 

```
zcat /proc/config.gz > /mnt/gentoo/usr/src/linux/.conifg
```

----------

## mikegpitt

 *drescherjm wrote:*   

> 
> 
> or seed the kernel from the live dvd.
> 
> something like 
> ...

 ++ on this suggestion...  the livecd/dvd will likely have all the drivers you need enabled.

----------

## Jaglover

lspci -k from LiveCD should tell what driver is in use.

----------

## dman777

ya, that was it. didn't have the right driver for the bus. thanks

----------

