Knowledge Base:Unable to mount root fs

Synopsis
When booting a freshly configured kernel, the boot fails with the following message:

VFS: Cannot open root device "hda3" or unknown-block(2,0) Please append a correct "root=" boot option; here are the available partitions: ... Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

The numbers in the  section can be different.

Environment
Any Gentoo Linux system on which a new kernel is being booted (or an update was made on the bootloader configuration).

Analysis
The panic informs that the Linux kernel is unable to:


 * 1) Detect the controller for the hard disk (a likely candidate if the message says  );
 * 2) Detect the partition because it does not have support for the partition type (less likely, but still possible);
 * 3) Mount the partition because it does not know how to access the file system (a likely candidate if the message gives a non-zero figure in the first number set, such as  );
 * 4) Detect the partition because the wrong device was passed in the boot loader configuration.

Resolution
Boot with the old kernel (if available), or with a LiveCD, and open the kernel configuration:


 * Ensure that the controller chipset has been configured in the Linux kernel (and in-kernel, not as a module);
 * Ensure that the used file systems (such as ext2, ext3, ext4, ReiserFS, Btrfs, etc.) are configured in the Linux kernel (and built into the kernel, not as a module);
 * Ensure that, if you use, you have built an initramfs when configuring the bootloader, see "Configuring the linux kernel" of your installation handbook
 * If running Gentoo as a Qemu guest, ensure that the virtio block drivers and PCI driver for virtio devices are enabled in the kernel (that is,  and   in the kernel configuration file).
 * If you are not using an initramfs and the root filesystem you specify on the kernel command line of your GRUB configuration is on an MTD device (such as an NVME drive), you will have to make the kernel wait for asynchronous initialization of the device by adding either `rootdelay=` (to timeout if the device is never detected) or `rootwait` (to wait without timeout) immediately before you define `root=...`.

Also verify that the boot loader configuration ( for GRUB legacy and for GRUB2) refers to the correct partition:

If you are using an initramfs and upgrade to another kernel version, make sure the initramfs is recreated correctly in /boot for the new kernel version and that the boot loader configuration refers to the correct initramfs.