# VFS: Unable to mount root fs on unkown-block(2,0)

## taris_kah

I have been attempting to re-install gentoo on my home server and have been running into some issues. It has been a while since I've compiled a kernel, so I could very well be missing something stupid. When I boot I get the following.

```

0b00      1048575 sr0 driver: sr

097f      1060160 md127 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unkown-block(2,0)

Pid 1, comm: swapper Not tainted 2.6.36-gentoo-r5 #1

Call Trace:

```

etc...

I have my boot, root and home partitions set up as RAID1 via mdadm. One oddity is that when I boot into the livecd it is setting all of my md's as md125, md126, and md127 (it scrambles these each time, so root could be md125 one time and md127 the next.) I have been copying my mdadm.conf file over, stopping all of my arrays, then assembling them with the desired md's.

I believe I have included all of the pertinent information below. Any advice would be much appreciated.

fdisk:

```

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xfbc53be3

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1         132     1060258+  fd  Linux raid autodetect

/dev/sda2             133         394     2104515   82  Linux swap / Solaris

/dev/sda3             395        6922    52436160   fd  Linux raid autodetect

/dev/sda4            6923      121601   921159067+  fd  Linux raid autodetect

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1         132     1060258+  fd  Linux raid autodetect

/dev/sdb2             133         394     2104515   82  Linux swap / Solaris

/dev/sdb3             395        6922    52436160   fd  Linux raid autodetect

/dev/sdb4            6923      121601   921159067+  fd  Linux raid autodetect

```

lspci -k:

```

00:00.0 Host bridge: Silicon Integrated Systems [SiS] 760/M760 Host (rev 02)

        Subsystem: Hewlett-Packard Company Device 2a04

00:01.0 PCI bridge: Silicon Integrated Systems [SiS] SG86C202

00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS964 [MuTIOL Media IO] (rev 36)

00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev 01)

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: SIS_IDE

        Kernel modules: pata_sis

00:02.7 Multimedia audio controller: Silicon Integrated Systems [SiS] AC'97 Sound Controller (rev a0)

        Subsystem: Hewlett-Packard Company Device 2a05

        Kernel driver in use: Intel ICH

        Kernel modules: snd-intel8x0

00:03.0 USB Controller: Silicon Integrated Systems [SiS] USB 1.1 Controller (rev 0f)

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: ohci_hcd

        Kernel modules: ohci-hcd

00:03.1 USB Controller: Silicon Integrated Systems [SiS] USB 1.1 Controller (rev 0f)

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: ohci_hcd

        Kernel modules: ohci-hcd

00:03.2 USB Controller: Silicon Integrated Systems [SiS] USB 1.1 Controller (rev 0f)

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: ohci_hcd

        Kernel modules: ohci-hcd

00:03.3 USB Controller: Silicon Integrated Systems [SiS] USB 2.0 Controller

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: ehci_hcd

        Kernel modules: ehci-hcd

00:04.0 Ethernet controller: Silicon Integrated Systems [SiS] SiS900 PCI Fast Ethernet (rev 90)

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: sis900

        Kernel modules: sis900

00:05.0 IDE interface: Silicon Integrated Systems [SiS] RAID bus controller 180 SATA/PATA  [SiS] (rev 01)

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: sata_sis

        Kernel modules: sata_sis

00:0a.0 Ethernet controller: Linksys Gigabit Network Adapter (rev 10)

        Subsystem: Linksys EG1032 v3 Instant Gigabit Network Adapter

        Kernel driver in use: r8169

        Kernel modules: r8169

00:0b.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6306/7/8 [Fire II(M)] IEEE 1394 OHCI Controller (rev 80)

        Subsystem: Hewlett-Packard Company Device 2a04

        Kernel driver in use: ohci1394

        Kernel modules: ohci1394

00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] 661/741/760 PCI/AGP or 662/761Gx PCIE VGA Display Adapter

        Subsystem: Hewlett-Packard Company Device 2a06

```

Kernel Config:

http://pastebin.com/85ezvPpB

fstab:

```

/dev/md1               /boot           ext2            noauto,noatime  1 2

/dev/md3                /               ext3            noatime         0 1

/dev/md4                /home           ext3            noatime         0 1

/dev/sda2               none            swap            sw,pri=1        0 0

/dev/sdb2               none            swap            sw,pri=1        0 0

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

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

```

grub.conf:

```

default 0

timeout 30

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

title Gentoo Linux 2.6.36-r5

root (hd0,0)

kernel /boot/kernel root=/dev/md3

```

----------

## taris_kah

bump

----------

## runem

This often means one of two things:

Either the filesystem type for the root partition is not compiles into the kernel or the driver for the harddisk-chipset is not compiled in. The configuration of harddisk drivers were shuffled around some kernel versions ago.

----------

## taris_kah

Thanks for the reply.

I believe I have both compiled into my kernel. I should be using ext3 for my root partition, and have "CONFIG_EXT3_FS=y" in my config. I also have "CONFIG_SATA_SIS=y" and "CONFIG_PATA_SIS=y" which should be required by my chipset. I should also have all of the RAID options compiled in. Unless I'm missing something.

----------

## Jaglover

VFS: Unable to mount root fs on unkown-block(2,0)

This means your kernel is trying floppy as last resort, usually you see this when the driver for hard drive controller is not present. Having this error with mdraid is beyond my experience.

----------

## taris_kah

The only drives I can think that I would have an issue with would be the RAID stuff, unless something is conflicting possibly?  Here is what I think I've extracted all of my config options pertaining to raid, anybody know if the issue would be in the following?

```

#

# SCSI device support

#

CONFIG_SCSI_MOD=y

CONFIG_RAID_ATTRS=y

CONFIG_SCSI=y

CONFIG_SCSI_DMA=y

# CONFIG_SCSI_TGT is not set

# CONFIG_SCSI_NETLINK is not set

CONFIG_SCSI_PROC_FS=y

#

# Generic fallback / legacy drivers

#

# CONFIG_PATA_ACPI is not set

CONFIG_ATA_GENERIC=y

# CONFIG_PATA_LEGACY is not set

CONFIG_MD=y

CONFIG_BLK_DEV_MD=y

CONFIG_MD_AUTODETECT=y

# CONFIG_MD_LINEAR is not set

# CONFIG_MD_RAID0 is not set

CONFIG_MD_RAID1=y

# CONFIG_MD_RAID10 is not set

CONFIG_MD_RAID456=y

# CONFIG_MULTICORE_RAID456 is not set

# CONFIG_MD_MULTIPATH is not set

# CONFIG_MD_FAULTY is not set

CONFIG_BLK_DEV_DM=y

# CONFIG_DM_DEBUG is not set

# CONFIG_DM_CRYPT is not set

# CONFIG_DM_SNAPSHOT is not set

CONFIG_DM_MIRROR=y

# CONFIG_DM_LOG_USERSPACE is not set

CONFIG_DM_ZERO=y

# CONFIG_DM_MULTIPATH is not set

# CONFIG_DM_DELAY is not set

# CONFIG_DM_UEVENT is not set

# CONFIG_FUSION is not set

```

----------

## gerard27

You have /dev/sda1 twice in fstab,once as /boot and once as swap?

Gerard.

----------

## NeddySeagoon

taris_kah,

You have the SIS chipset for IDE and SCSI. Migrate to libata and be sure to choose

```
<*>       Silicon Image SATA support

<*>       SiS PATA support
```

 in the <*> Serial ATA and Parallel ATA drivers  ---> menu.

----------

## taris_kah

 *gerard82 wrote:*   

> You have /dev/sda1 twice in fstab,once as /boot and once as swap?
> 
> Gerard.

 

Thanks, for pointing out the fstab errors, I have edited the original with the corrections, unfortunately I've still got the same problem after changing it.

 *NeddySeagoon wrote:*   

> taris_kah,
> 
> You have the SIS chipset for IDE and SCSI. Migrate to libata and be sure to choose
> 
> ```
> ...

 

I have gone through the link you sent me and made a few adjustments to what I already had, but still no luck. According to my .config file, I do have the following to options set

```

CONFIG_SATA_SIS=y

CONFIG_PATA_SIS=y

```

I am now also getting md1 in the error instead of md127.

Any more thoughts?

Thanks.

----------

## NeddySeagoon

taris_kah,

Do yoy still get the kernel panic ending in unknown-block (x,y) ?

If thats gone, you have fixed the kernel not able to see the hard drive controllers.

If not, nothing else matters yet - without communications with the HDD, kernel raid is bound to fail.

Please post you current error message.

----------

## taris_kah

 *NeddySeagoon wrote:*   

> taris_kah,
> 
> Do yoy still get the kernel panic ending in unknown-block (x,y) ?
> 
> If thats gone, you have fixed the kernel not able to see the hard drive controllers.
> ...

 

Here is a screenshot of the exact error.

http://dl.dropbox.com/u/1179267/2011-03-19%2014.31.52.jpg

(sorry it's a little blurry, just took it with my phone.)

I find following line odd.

```

[   1.531461] 0901         1060160 md1 (driver?)

```

Especially if the raid pieces aren't loaded yet.

Thanks!

----------

## NeddySeagoon

taris_kah,

Before the line 1.531540] Kernel Panic ... the system lists all of the drives and partitions it sees.

That tells us that the system can see /dev/sda and /dev/sdb  with four partitions each. Ftom that we can infer that your kernel hardware drivers are ok, so the unknown-block(2,0) is misleading now.

Looking at your grub 

```
title Gentoo Linux 2.6.36-r5

root (hd0,0)

kernel /boot/kernel root=/dev/md3 
```

you are depending on the kernel to auto assemble the raid set that makes up /dev/md3 and it hasn't done that yet.

Run 

```
mdadm -E /dev/sd...
```

 where /dev/sd... is one of the partitions donated to /dev/md3 and post the output. If you have something other than Version : 0.90.00, kernel auto assembly won't work.. 

Your raid partitions are set to type fd - thats essential for kernel auto assembly.

Is [*]     Autodetect RAID arrays during kernel boot   set in your kernel?

I suspect not as there is no sign of attempted autodetection ... you should see something like

```
[    2.669355] md: Waiting for all devices to be available before autodetect

[    2.671057] md: If you don't use raid, use raid=noautodetect

[    2.673194] md: Autodetecting RAID arrays.

[    2.800740] md: Scanned 12 and added 12 devices.

[    2.802397] md: autorun ...

[    2.804048] md: considering sda6 ...
```

from the raid driver.

----------

## taris_kah

NeddySeagoon,

I believe I've got "Autodetect RAID arrays during kernel boot set in your kernel?" built into my kernel, here is the line from .config, is that the one?

```

CONFIG_MD_AUTODETECT=y

```

I believe my root partition "/dev/md3" was not set to version 0.90. The RAID guide only said to set boot to 0.90, and not root. Is that wrong then?

Here is the result of mdadm -E /dev/sda3, one of the drives belonging to my BOOT partition.

```

/dev/sda3:

          Magic : a92b4efc

        Version : 1.2

    Feature Map : 0x0

     Array UUID : 60a55d92:d764b4fb:577c5908:aa9dfef4

           Name : livecd:3  (local to host livecd)

  Creation Time : Thu Feb  3 07:26:48 2011

     Raid Level : raid1

   Raid Devices : 2

 Avail Dev Size : 104870272 (50.01 GiB 53.69 GB)

     Array Size : 104870128 (50.01 GiB 53.69 GB)

  Used Dev Size : 104870128 (50.01 GiB 53.69 GB)

    Data Offset : 2048 sectors

   Super Offset : 8 sectors

          State : clean

    Device UUID : a32cc923:66abf4b8:ef708b90:19412caa

    Update Time : Sat Mar 19 22:47:08 2011

       Checksum : 8b4dc18c - correct

         Events : 17

   Device Role : Active device 0

   Array State : AA ('A' == active, '.' == missing)

```

I find the last two lines strange, as I'm used to having it output the drives here (as it does for my boot partition, shown at the bottom of this post.)  If I do...

mdadm -D /dev/md3

Then I do get both drives showing as active.

```

/dev/md3:

        Version : 1.2

  Creation Time : Thu Feb  3 07:26:48 2011

     Raid Level : raid1

     Array Size : 52435064 (50.01 GiB 53.69 GB)

  Used Dev Size : 52435064 (50.01 GiB 53.69 GB)

   Raid Devices : 2

  Total Devices : 2

    Persistence : Superblock is persistent

    Update Time : Sat Mar 19 22:42:31 2011

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

           Name : livecd:3  (local to host livecd)

           UUID : 60a55d92:d764b4fb:577c5908:aa9dfef4

         Events : 17

    Number   Major   Minor   RaidDevice State

       0       8        3        0      active sync   /dev/sda3

       1       8       19        1      active sync   /dev/sdb3

```

Here is the result of mdadm -E /dev/sda1, one of the drives belonging to my BOOT partition.

```

/dev/sda1:

          Magic : a92b4efc

        Version : 0.90.00

           UUID : 3a97dd80:77e9b379:cb201669:f728008a (local to host livecd)

  Creation Time : Sat Mar 12 08:07:31 2011

     Raid Level : raid1

  Used Dev Size : 1060160 (1035.49 MiB 1085.60 MB)

     Array Size : 1060160 (1035.49 MiB 1085.60 MB)

   Raid Devices : 2

  Total Devices : 2

Preferred Minor : 1

    Update Time : Sat Mar 19 22:43:47 2011

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

       Checksum : b9058059 - correct

         Events : 18

      Number   Major   Minor   RaidDevice State

this     0       8        1        0      active sync   /dev/sda1

   0     0       8        1        0      active sync   /dev/sda1

   1     1       8       17        1      active sync   /dev/sdb1

```

Anywho, I'll try setting my root partition to also use version 0.90. Thanks again.

----------

## NeddySeagoon

taris_kah,

/boot has to be raid superblock 0.9 or grub cannot boot from it. Raid superblock version 1.x moves the superblock around and grub just ignores raid.

Raid auto assemble is depreciated. The kernel only supports auto assemble for raid superblock version 0.9.  For version 1.x superblocks you need mdadm in an initrd, so mdadm can assemble your root filesystem before the kernel tries to mount it.

You have two choices - go with mdadm in an initrd, which is the way of the future, or remake your root raid filesystem with version 0.9 superblocks. The latter destroys all the data on it. 

The raid guide is not wrong - but it is incomplete if it doesn't tell about the initrd and how to set it up.   Do you have a link for the guide you followed ?

----------

## taris_kah

Great to know, thanks.

I just followed the official installation guide from gentoo.org.

http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml

I will be honest though, I don't know that I paid super close attention to it, as I had done it a few times in the past, so I may have missed a small detail somewhere.

I tried messing with the experimental version of genkernel which I read built mdadm into the initrd. I couldn't seem to get it working though. I think I would prefer to go the initrd route, but don't really any any experience setting it up, any tips, guides to set up an initrd, including mdadm?

Thanks!

----------

## NeddySeagoon

taris_kah,

 *Software Raid and LVM2 Quick Install Guide wrote:*   

> Please bear in mind that the /boot and / mount points should use an older metadata format which can be specified by the --metadata=0.90 flag

 

and it goes on to give the commands 

```
livecd ~ # mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1

mdadm: array /dev/md1 started.

livecd ~ # mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3

mdadm: array /dev/md3 started.

livecd ~ # mdadm --create /dev/md4 --level=0 --raid-devices=2 /dev/sda4 /dev/sdb4

mdadm: array /dev/md4 started.
```

so the warning is there, it just not followed though in the command.

Its worth filing a bug at bugs.gentoo.org because the document is not consistent.  It warns to make root with the 

```
 --metadata=0.90
```

then doesn not do it.  It omits to explain how to generate the initrd needed to assemble the root raid set that it does make.

----------

## cach0rr0

 *taris_kah wrote:*   

> 
> 
> I tried messing with the experimental version of genkernel which I read built mdadm into the initrd. I couldn't seem to get it working though. I think I would prefer to go the initrd route, but don't really any any experience setting it up, any tips, guides to set up an initrd, including mdadm?
> 
> 

 

I have zero experience with mdadm, but i have fought through the whole crafting an initramfs nonsense (recently) and finally kinda sorta have my brain around it 

The wiki has heaps of information on doing so, though for the moment I can't access it - http://en.gentoo-wiki.com/wiki/Initramfs

I've also thrown together somewhat of a crude "plain english" bit of doc here - http://whitehathouston.com/documentation/gentoo/initramfs_howto.htm (it may be slow for the next few minutes, am updating glibc/binutils on that box)

It pertains to setting up an initramfs for an encrypted root file system, but hopefully with minimal modification it should be able to get you what you want (the main variation - you'd need to copy any binaries needed for doing the mdadm commands, into the initramfs structure e.g. /usr/src/initramfs/bin/mdadm - statically built, unless you want to copy over a ton of libraries to /lib that the dynamically linked binary depends on; you would then have to add a line to init to do the 'mdadm' command itself)

hope that's..kinda sorta almost helpful?

----------

## NeddySeagoon

taris_kah, 

gentoo-wiki.com has been down for several days now.  Unfortunately, its not operated by Gentoo and we have no idea when it might be back.

Meanwhile, most of it will be in the Google cache. This page shows how to make an initrd for Root_filesystem_over_LVM2,_DM-Crypt_and_RAID.

The interesting bit for you is the manual creation of the initrd. Its quite straight forward and its easy to leace out the bits you don't need too.

The link points to a gentoo-wiki page in googles cache. So its seriously slow to load.  I have 57% loaded while I was writing this post.

----------

## taris_kah

NeddySeagoon and cach0rr0,

Thanks for the links, I've just built my initrd and it's working like a charm, awesome.

I've also filed a bug for the documentation.

https://bugs.gentoo.org/show_bug.cgi?id=359593

Thanks again for all the help.

----------

## razvandumitrescu

For those that want to have RAID using metadata version 1.2 and mount at boot as / partition there is one simple way using genkernel:

1) have a valid mdadm configuration file in /etc/mdadm.conf 

mdadm --detail --scan >> /etc/mdadm.conf

would generate something like 

ARRAY /dev/md0 metadata=0.90 UUID=a51255a6:64640201:cb201669:f728008a

ARRAY /dev/md1 metadata=1.2 name=livecd:1 UUID=d103e4bc:7c5c8692:058acd89:5f82cbb4

ARRAY /dev/md2 metadata=1.2 name=livecd:2 UUID=19f9d11d:d217f287:384088df:fe1ffd7f 

at the end /etc/mdadm.conf should look something like this:

DEVICE /dev/sd[ab]1

DEVICE /dev/sd[ab]2

DEVICE /dev/sd[ab]3

ARRAY /dev/md0 metadata=0.90 UUID=a51255a6:64640201:cb201669:f728008a

ARRAY /dev/md1 metadata=1.2 name=livecd:1 UUID=d103e4bc:7c5c8692:058acd89:5f82cbb4

ARRAY /dev/md2 metadata=1.2 name=livecd:2 UUID=19f9d11d:d217f287:384088df:fe1ffd7f

HOMEHOST <system>

AUTO +1.x homehost -all

the ARRAY lines are generated for you by "mdadm -- detail --scan"

DEVICE lines contain the partitions that form the arrays,

in my case partitions /dev/sda1 and /dev/sdb1 form /dev/md0

so the line for devices that form this array is "DEVICE /dev/sd[ab]1", same for the rest...

from manual => "The homehost line gives a default value for the --homehost= option to mdadm.

 If <system> is given, then the gethostname(2) systemcall is used to get the host name."

the last line "AUTO +1.x homehost -all"  tells that arrays containing 1.x superblocks and arrays created on this machine should be auto assembled at boot time and the rest (-all) not

2) emerge genkernel masked version 3.4.15 (support for mdadm 3.1.4 has been added in genkernel version 3.4.11, from version 3.1.2 mdadm default superblock is 1.2)

3) edit /etc/genkernel.conf and set

MDADM="yes"

MDADM_CONFIG="/etc/mdadm.conf"

4) genkernel all (build your kernel)

5) edit /boot/grub/grub.conf and add "domdadm" at end of kernel line

would look something like 

kernel /boot/kernel-genkernel-x86_64-2.6.37-gentoo-r4 root=/dev/ram0 real_root=/dev/md2 domdadm vga=791

reboot

PS: the /boot partition has raid metadata 0.9

----------

