# [SOLVED]Kernel panic - Unable mount root at boot block (0,0)

## YTW

Last time I used 

```
grub-mkconfig -o /boot/grub/grub.cfg
```

, then it shows 

```
/boot/grub/grub.cfg.new no such dir or file
```

So I emerge grub:2 and redo grub-install /dev/sda again. Then it works. 

But when I reboot, 'kernel panic - unable mount root at block (0,0)', What should I check after liveCD mount?Last edited by YTW on Mon Sep 19, 2016 7:46 am; edited 1 time in total

----------

## DONAHUE

You have done a new install?

Is your computer UEFI capable? If so are you attempting a UEFI system or legacy BIOS?

Boot the liveCD and run 

```
wgetpaste --tee -c 'parted -l'

wgetpaste --tee -c 'lspci -k'
```

 Mount the gentoo partitions and run 

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

wgetpaste /mnt/gentoo/etc/fstab

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

wgetpaste -tee -c mount

wgetpaste -tee -c blkid
```

 Post the url's returned by wgetpaste

----------

## YTW

I am using BIOS. I think my computer is not UEFI capable sorry.

----------

## YTW

Does anyone  know something happened  at boot?

1)Are these steps correct? Kernel boot -> initramfs -> init tool

So when is root mount? And when the loadable kernel modules are loaded?

2) I used genkernel all that auto generated initramfs when installation, but I modifying kernel configuration manually, then redo grub configuration without genkernal --install initramfs.

Is forgotting to update initramfs after modifying kernel configuration a wrong concept?

----------

## NeddySeagoon

YTW,

```
unable mount root at block (0,0)
```

is a message produced by the kernel.

That means that whatever grub did, it at least loaded a kernel and possibly the initrd too.

The (0,0) normally means that something needed for the kernel to reach your HDD is missing.  

In addition to what DONAHUE has requested, pastebin the output of lspci too. - it need not be from inside the chroot.

I suspect that when you modified the kernel manually, you took something out that you need.

----------

## DONAHUE

 *Quote:*   

> Are these steps correct? Kernel boot -> initramfs -> init tool 

  Not correct.  genkernel configures drivers needed for your drives as modules. The initramfs must run to load these modules in the kernel. 

My unskilled reading of /etc/grub.d/10_linux tells me that grub determines the version of the genkernel kernels it finds and searches for an initramfs of matching version to pair with them when writing grub.cfg. So you should, while running genkernel to make your kernels, run 

```
genkernel all

grub-mkconfig -o /boot/grub/grub.cfg
```

 to update the kernel, the initramfs, and the grub.cfg all together to matching values. Read the grub.cfg after creating a new one.

----------

## Buffoon

FWIW, manual Grub configuration is not condemned by Grub developers, in Gentoo you really do not need that horrible automated conf creation.

----------

## YTW

http://bpaste.net/show/a99fa0519c96 parted -l

http://bpaste.net/show/8ca01e87415e lspci -k

http://bpaste.net/show/3f9e4d6d3fb5 Linux/x86 4.4.6-gentoo Kernel Configuration

http://bpaste.net/show/25aedf2846a9  /etc/fstab

http://bpaste.net/show/bce8dd602149 grub.cfg

http://bpaste.net/show/897a90e1ba56 mount

http://bpaste.net/show/76e4089e8877 blkid

Names added by NeddySeagoon to make it easier to find things.

----------

## NeddySeagoon

YTW,

Lets look at your book sequence from the start.  All your grub.cfg entries look like.

```
   echo   'Loading Linux 4.4.6-gentoo ...'

   linux   /boot/vmlinuz-4.4.6-gentoo root=/dev/sda4 ro  
```

There in no initrd line there, so no initrd will be loaded.  That's OK providing your kernel does not need to load any modules to mount root.  

lspci -k shows

```
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 05)

   Subsystem: Acer Incorporated [ALI] 5 Series/3400 Series Chipset 4 port SATA AHCI Controller

   Kernel driver in use: ahci

   Kernel modules: ahci
```

so you need the HDD code down to ahci built into the kernel.

Lets look at the kernel

```
CONFIG_BLK_DEV_SD=m

CONFIG_BLK_DEV_SR=m

CONFIG_ATA=y

CONFIG_SATA_AHCI=m

CONFIG_EXT4_FS=m

```

All those items need to be built into the kernel (maybe more) to be able to boot with no initrd.

The problem is that those modules ale located on the root filesystem, which cannot be read to load the modules until the root filesystem is mounted. Its a circular dependency.  There are lots of those in the boot process.

Rebuild your kernel, using menuconfig to set those options to <*>

Menuconfig has a search function. Press / 

Actually, CONFIG_BLK_DEV_SR is for your optical drives and is not needed to boot.

----------

## YTW

It works!! 

Is that initrd and initramfs the same stuff?

(It seems that they both works for loading modules for kernel before root mount)

So if a guy choose genkernel when install, after modifying some drivers in menuconfig next time in need, he/she should use genkernel again and can not use manual way of 'make and make modules_install'; otherwise, initrd will be missing that cause some important stuff still <M> in .config before root mount without inird or initramfs to load them first?

How Neddy check number of block(0,0) to derive where problem probably is? Is there wiki or something teach this?

----------

## Roman_Gruber

In my case, for two different boxes. I only created once the initramfs with genkernel and use my own build kernel, which also includes my own build modules in /lib/modules/kernel-version directory

Just an example of a boot entry I created a few hours ago. As you can see, I use microcode "initramfs" from intel and the initramfs created with gentoo-sources 4.2.3 with gentoo-sources 4.7.3. That initramfs is ~1 Year old, as this notebook is now ~1 Year old. And the installation is still the same as I started with gentoo, just moved from notebook a => b => c ...

Boot entry from my grub from sysrescue-cd 4.6.0

```
menuentry ' 4.7.3-gentoo-14-09-2016  /boot/   SanDisk SSD  ' {

        load_video

        insmod gzio

        insmod part_gpt

        insmod fat

        insmod ext2

        set root='hd0,gpt2'

        echo    ' boot entry for SanDisk SSD'

    linux /4.7.3-gentoo-16-09-2016  ** snip - removed **

    initrd /microcode.cpio /initramfs-genkernel-x86_64-4.2.3-gentoo

}

```

There is no requirement for always rebuild the intiramfs when you know what you are doing.

--

You can use any kernel basically with genkernel initramfs as long as they work together. A good starting point is to start with the genkernel-kernel and slim down the .config later.

Gentoo is about choice. As long as you know what you are doing, you have the freedom to choose whichever bootloader, bootmanager, kernel, initramfs, init-system, shell, desctop environment to use as long as they work together.

---

The only requirement is to rebuild those modules when you create a kernel, which is done anyway with => make && make modules_install => just always change the local-version of the kernel when you build a new kernel (or use a different kernel version, so there is a difference in /lib/modules/kernel-version directory)

--

 *Quote:*   

> Is that initrd and initramfs the same stuff? 

 

[url]

http://stackoverflow.com/questions/10603104/the-difference-between-initrd-and-initramfs[/url]Last edited by Roman_Gruber on Sun Sep 18, 2016 2:29 pm; edited 2 times in total

----------

## NeddySeagoon

YTW,

A long time ago the initrd was a compressed ext2 filesystem in a file.  

Today, the initramfs is a compressed CPIO archive of CPIO archives.

They both do the same job. Only the internal structure is different.

When the initrd (ext2 in a file) was in widespread use, everyone had ext2 in their kernels anyway.

It was the root filesystem.

The terms initrd and initramfs tend to be used interchangeably today.  Its sloppy but it only matters if you need to know the internal data structures.

Most users don't. 

You can tell genkernel to use your own .config file if you wish. Then it will do the build and install steps.

The option all, tells genkernel to use its own default configuration.

I don't know how to use genkernel because I've never needed to find out.

You don't need to use genkernel to make an initrd/initramfs. There are several ways.  You can even do it yourself.

My system has root inside LVM on raid5. I need an initrd to assemble the raid (mdadm) so that lvm can find the logical volumes before root is even visible.  Both mdadm and lvm are user space programs so they must go in the initrd.

However, my hand made initrd does not contain any kernel modules, so it never needs to be updated.  Its like firmware. It was made when the system was new in 2009 and I don't expect to change it.

The numbers in block(0,0) are the kernel major,minor device numbers.  They are listed in /usr/src/linux/Documentation/devices.txt

The numbers may be assigned twice. Once to a block device and once to a character device. Its usually clear which is which.

```
0,0 is therefore    0             Unnamed devices (e.g. non-device mounts)

                  0 = reserved as null device number
```

Your HDD will be correctly listed under

```
  8 block       SCSI disk devices (0-15)

                  0 = /dev/sda          First SCSI disk whole disk

                 16 = /dev/sdb          Second SCSI disk whole disk

...

```

block(8,3) in the error message usually says that the kernel can find /dev/sda3 but not read the partition.  e.g. The root filesystem is missing from the kernel, or its not available for some reason.

----------

