LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0) (https://www.linuxquestions.org/questions/linux-kernel-70/kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on-unknown-block-2-0-a-688150/)

matsvw 12-03-2008 07:11 PM

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
 
There are some similar threads on this already, but I haven't found a resolution

I have a system installed from the Gentoo 2008.0 live CD. It works fine. However, I downloaded (emerge) the newest source and compiled a new kernel and I am unable to boot using it. I can still boot using old kernel.

If I try to boot via new kernel I get this error:
Code:

VFS: Cannot open root device "sda3" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
0200                4 fd0        (driver?)
0100              4096 ram0 (driver?)
****snip****
010f            4096 ram15 (driver?)
0300        39082680 hda driver: ide-disk
  0301        104391 hda1
  0302        987997 hda2
  0303  37985692
Kernel panic - not syncing: VFS:  Unable to mount root fs on unknown-block(2,0)


I have a single ATA drive in this system, but fstab generated by liveCD install looks like this:
Code:

/dev/sda1        /boot        ext2        defaults                1 2
/dev/sda2        none            swap            sw              0 0
/dev/sda3        /        ext3        noatime                0 1
none                /proc    proc    defaults          0 0
none                /dev/shm  tmpfs  defaults          0 0
/dev/cdrom        /cdrom        auto        ro,noauto,user,exec        0 0


Grub.conf looks like this:
Code:

default 0
timeout 30
#splashimage=(hd0,0)/grub/splash.xpm.gz

title=linux 2.6.25-gentoo-r9 compiled
root (hd0,0)
kernel /kernel-2.6.25-gentoo-r9 root=/dev/sda3

title=genkernel-x86-2.6.24-gentoo-r5
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3
initrd /initramfs-genkernel-x86-2.6.24-gentoo-r5

Since the error says that only hdax drives are available, as trouble shooting steps, I've tried editing the lines via grub at boot time to read: "kernel /kernel-2.6.25-gentoo-r9 root=/dev/hda3". and also "kernel /kernel-2.6.25-gentoo-r9 ro root=/dev/hda3" With either of those changes, the system starts to boot, but then I get a different error:

Code:

fsck.ext3: No such file of directory while trying to open /dev/sda3
/dev/sda3:
The superblock could not be read or does not describe a correct ext2 filesystem.  If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock:
        e2fsck -b 8193 <device>

It seems like a driver issue to me, but I haven't been able to figure it out. Please help. TIA.

-Mats

Hern_28 12-03-2008 07:59 PM

Will try and help.
 
The first thing i would recommend checking is that you have ext3 support enabled in the new kernel.

digvijay.gahlot 12-04-2008 03:39 AM

You have forgotten to include path of initial ramdisk (initrd )image for newly compiled kernel in grub.conf

matsvw 12-04-2008 01:40 PM

Thanks for the replies.

I just double checked my .config file and EXT2 and EXT3 are included (see code below).

Next I'll try adding an initrd image.



Code:

# File systems
#
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
# CONFIG_EXT2_FS_SECURITY is not set
# CONFIG_EXT2_FS_XIP is not set
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
# CONFIG_EXT3_FS_SECURITY is not set
# CONFIG_EXT4DEV_FS is not set
CONFIG_JBD=y
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
# CONFIG_REISERFS_CHECK is not set
# CONFIG_REISERFS_PROC_INFO is not set
CONFIG_REISERFS_FS_XATTR=y
CONFIG_REISERFS_FS_POSIX_ACL=y
# CONFIG_REISERFS_FS_SECURITY is not set
# CONFIG_JFS_FS is not set
CONFIG_FS_POSIX_ACL=y
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_OCFS2_FS is not set
CONFIG_DNOTIFY=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS_FS is not set
CONFIG_AUTOFS4_FS=y
# CONFIG_FUSE_FS is not set
CONFIG_GENERIC_ACL=y


matsvw 12-04-2008 02:59 PM

Creating initrd didn't help, but at least I get a new error. :-)

Code:

mount: error 6 mounting ext3
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2
umount /initrd/proc failed: 2
Freeing unused kernel memory: 236k freed
Kernel panic - not syncing: NO init found.  Try passing init- option to kernel

for full error see screen shot:badboot.JPG

I created initrd file and changed grub.conf to read:

Code:

default 0
timeout 30
#splashimage=(hd0,0)/grub/splash.xpm.gz

title=linux 2.6.25-gentoo-r9 compiled
root (hd0,0)
kernel /kernel-2.6.25-gentoo-r9 root=/dev/sda3
initrd /initrd-2.6.25-r9


title=genkernel-x86-2.6.24-gentoo-r5
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3
initrd /initramfs-genkernel-x86-2.6.24-gentoo-r5

I've been banging my head against this for days, it really can't be this hard....

thanks again for the help.

matsvw 12-04-2008 04:11 PM

Just an update on my (lack of progress). I added 'init=3' to the kernel line in grub.conf, but no dice. I also researched more about initrd and it seems like I shouldn't need it if I have the correct drivers compiled into the kernel. So I think I may be back to square one.

-Mats

matsvw 12-04-2008 04:11 PM

Just an update on my (lack of progress). I added 'init=3' to the kernel line in grub.conf, but no dice. I also researched more about initrd and it seems like I shouldn't need it if I have the correct drivers compiled into the kernel. So I think I may be back to square one.

-Mats

matsvw 12-09-2008 06:38 PM

Solved!
 
The new kernel wanted to mount /dev/hda3 as root rather than /dev/sda3. fstab as created by original install looked like this:
Code:

/dev/sda1        /boot        ext2        defaults                1 2
/dev/sda2        none            swap            sw              0 0
/dev/sda3        /        ext3        noatime                0 1

Altering grub.conf to point to /dev/hda3 didn't work because the entry in fstab still refered to sda3. In addition to altering grub.conf, I had to edit fstab to use hdax instead of sdax. My new fstab looks like this:
Code:

/dev/hda1        /boot        ext2        defaults                1 2
/dev/hda2        none            swap            sw              0 0
/dev/hda3        /        ext3        noatime                0 1
none        /proc    proc    defaults          0 0
none        /dev/shm  tmpfs  defaults          0 0
/dev/cdrom        /cdrom        auto        ro,noauto,user,exec        0 0

and grub.conf now looks like this:
Code:

default 0
timeout 30

title=linux 2.6.25-gentoo-r9 custom
root (hd0,0)
kernel /kernel-2.6.25-gentoo-r9 root=/dev/hda3

title=genkernel-x86-2.6.24-gentoo-r5
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3
initrd /initramfs-genkernel-x86-2.6.24-gentoo-r5


Also, thanks for the responses. While they didn't solve the issue directly, your responses led me down paths I hadn't thought of so I was eventually able to figure it out. Now that I understand the problem, it seems painfully obvious. Ironically, the original genkernel now fails to boot due to the change in fstab. :-)

galapogos 12-17-2008 12:31 AM

That's weird that your new kernel would want to mount to /dev/hda3 instead of /dev/sda3. hda is for IDE devices while sda is for SCSC/SATA devices. Have you done a file <kernel file> on both your old and new kernels and see what's the root_dev of them? I suspect they may be different. To the best of my knowledge, if your drive is a SATA drive, it should be sdX instead of hdX(unless you have AHCI disabled and IDE emulation enabled in your system BIOS).

matsvw 12-17-2008 12:00 PM

I thought it was odd too and that was part of the reason why it took me so long to edit the fstab file. The drive is an ATA drive, but the controller can handle SATA drives as well and that was initially enabled on the motherboard. I toggled the setting off and on during trouble shooting, but it made no difference with the new kernel or original kernel. I'm still pretty new at this so it's totally possible that I've missed something.

Harp00 01-13-2009 06:56 PM

title=linux 2.6.25-gentoo-r9 custom
root (hd0,0)
kernel /kernel-2.6.25-gentoo-r9 root=/dev/hda3


I think you should change root (hd0,0) into (hd0,2)

matsvw 01-14-2009 11:24 AM

Quote:

Originally Posted by Harp00 (Post 3407683)
title=linux 2.6.25-gentoo-r9 custom
root (hd0,0)
kernel /kernel-2.6.25-gentoo-r9 root=/dev/hda3


I think you should change root (hd0,0) into (hd0,2)

Thanks for the reply. I tried that when I was trouble shooting, it didn't help. There's probably a more elegant fix than the one I did, but it was definitely related to the way the drives were being detected (SATA vs. ATA).

-Mats

ron.w 02-28-2009 10:53 AM

Additional info re: Kernel panic - not syncing: VFS: Unable to mount root fs ...
 
I had roughly the same issue. Just installed Unbuntu 8.10 (my first Linux install) using WUBI on dual boot system with XP and 30GB SATA harddrive.

After initial install, I had a ton of updates (295, I think) to install. During install, I had some processes hang. On reboot, I got the kernel panic with unknown-block(0,0) for kernel 2.6.27-11-generic. After googling the issue, I finally used the previous kernel 2.6.27-7-generic to boot.

Older kernel booted fine, and I went into Synaptic to continue updates. Synaptic told me to run "dpkg --configure -a" to clear up issues it had. I did so, and dpkg found and cleaned up the 2.6.27-11-generic kernel issue. Sorry, it was a couple days ago, so I don't remember the exact messages.

Rebooted normally, and things have been fine since.

I'm a Linux newby, so please ask if I've not provided all the information you need. I'm not posting for help, but to provide additional information for debugging and to let folks know what worked for me.

Robin Thankachan 06-21-2011 06:55 AM

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
 
i got the same error while booting set top box... pls gve me a solution for this


Root-NFS: Server returned error -5 while mounting /home/...../target
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "nfs" 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)

matsvw 06-21-2011 11:56 AM

Quote:

Originally Posted by Robin Thankachan (Post 4391623)
i got the same error while booting set top box... pls gve me a solution for this


Root-NFS: Server returned error -5 while mounting /home/...../target
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "nfs" 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 solution to my issue is in post #8 Post your grub and fstab files, that may help. Also is this a new install?


All times are GMT -5. The time now is 10:50 AM.