LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-08-2009, 02:21 PM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 616

Rep: Reputation: 32
Question Ubuntu Custom kernel - kp: cannot open root device "sda1"


I am trying to compile a custom kernel for Ubuntu and I am getting a kernel panic:

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

This same kernel boots on Gentoo so i know I have the right device drivers and filesystem drivers.

Any idea why this is going to a kernel panic?
 
Old 01-08-2009, 02:38 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,333

Rep: Reputation: 143Reputation: 143
Are you using and initrd and if so, how was it generated? Usually, you get that type of error message when you don't have the drivers for your root partition to be recognized or you have a misconfigured grub which also results in your root partition not being found. You may want to post the grub entry you are using for the custom kernel as it appears in both gentoo and ubuntu.
 
Old 01-08-2009, 03:45 PM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by kilgoretrout View Post
Are you using and initrd and if so, how was it generated? Usually, you get that type of error message when you don't have the drivers for your root partition to be recognized or you have a misconfigured grub which also results in your root partition not being found. You may want to post the grub entry you are using for the custom kernel as it appears in both gentoo and ubuntu.
I'm not using an initrd with this kernel.

I compiled another kernel on Gentoo and moved to Ubuntu and this time it errors here:


VFS: Cannot open root device "sda1" or unkown-block(2,0)

instead of:

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

I went in to grub and set it up manually on both systems and it's working fine on Gentoo.

Last edited by Thaidog; 01-08-2009 at 04:07 PM.
 
Old 01-08-2009, 04:45 PM   #4
rm_dash_rf_star
Member
 
Registered: Nov 2007
Location: Seattle, WA
Distribution: LFS
Posts: 36

Rep: Reputation: 16
I recently had this same issue.

When the kernel boots, it uses udev to assign device nodes to physical devices. What you need to do is create a udev rule that will make sure that the kernel assigns the root of your Ubuntu filesystem (your root device) to a consistent name that you choose (/dev/hda1 might be an example in the case of an IDE/ATA hard drive).

Then, when you bootstrap your kernel, pass in the root=/dev/hda1 option (or whatever other device node that you choose) to the kernel so that it knows where to find your root device. From there, the kernel will execute /sbin/init to load your boot scripts and continue booting.

It is likely that Ubuntu already has said rule, and all that you need to do is determine which name udev is giving your hard drive.

One other thought---

I think that you are missing a driver in your kernel (or at least it is compiled in as a module, in which case having an initrd would solve the problem this `other' issue).

What I did was issue a `make ARCH=i386 defaultconfig' to configure the kernel. Look at the `README' file in the .../linux directory in order to figure out what the exact name of defaultconfig is (such as defconfig).

I think that this will fix this problem, in which case the only thing left for you to do is to pass in root=<device node> as per udev's rules.
 
Old 01-08-2009, 05:29 PM   #5
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by rm_dash_rf_star View Post
I recently had this same issue.

When the kernel boots, it uses udev to assign device nodes to physical devices. What you need to do is create a udev rule that will make sure that the kernel assigns the root of your Ubuntu filesystem (your root device) to a consistent name that you choose (/dev/hda1 might be an example in the case of an IDE/ATA hard drive).

Then, when you bootstrap your kernel, pass in the root=/dev/hda1 option (or whatever other device node that you choose) to the kernel so that it knows where to find your root device. From there, the kernel will execute /sbin/init to load your boot scripts and continue booting.

It is likely that Ubuntu already has said rule, and all that you need to do is determine which name udev is giving your hard drive.

One other thought---

I think that you are missing a driver in your kernel (or at least it is compiled in as a module, in which case having an initrd would solve the problem this `other' issue).

What I did was issue a `make ARCH=i386 defaultconfig' to configure the kernel. Look at the `README' file in the .../linux directory in order to figure out what the exact name of defaultconfig is (such as defconfig).

I think that this will fix this problem, in which case the only thing left for you to do is to pass in root=<device node> as per udev's rules.
This makes since but I have tried using the UUID parameter already defined by Ubuntu as a UUID and I get the same thing.

It looks like this:

kernel=/boot/kernel-custom root=UUID=43h4l5lh235lh34h345j3534'53j45

or

kernel=/boot/kernel-custom root=/dev/sda1

either fails with the same message.

I know the driver is not missing bc I have booted the same system on Gentoo and it boots fine.
 
Old 01-08-2009, 05:34 PM   #6
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 32
It looks like the udev HD rules are in /etc/udev/rules.d/60-persistent-storage.rules

Not sure what to do with this file though...

root@linux-desktop:/etc/udev/rules.d# cat 60-persistent-storage.rules
# do not edit this file, it will be overwritten on update

# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path}
# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>

# forward scsi device event to corresponding block device
ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"

ACTION!="add|change", GOTO="persistent_storage_end"
SUBSYSTEM!="block", GOTO="persistent_storage_end"

# skip rules for inappropriate block devices
KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end"

# never access non-cdrom removable ide devices, the drivers are causing event loops on open()
KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"

# ignore partitions that span the entire disk
TEST=="whole_disk", GOTO="persistent_storage_end"

# /sys/class/block will export this
ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk"
ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition"

# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

# by-id (hardware serial number)
KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode"
KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"

KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi"
KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss"
KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"

# libata compat (links like hd*)
KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}"
KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n"

KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}"
KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n"

# by-path (shortest physical path)
ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p"
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"

# skip unpartitioned removable media devices from drivers which do not send "change" events
ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
# skip optical drives without media
ENV{DEVTYPE}=="disk", KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}!="?*", GOTO="persistent_storage_end"

# import filesystem metadata
IMPORT{program}="vol_id --export $tempnode"

# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"

LABEL="persistent_storage_end"

Last edited by Thaidog; 01-08-2009 at 05:36 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel panic cannot open root device "0" ??? M$ISBS Slackware 12 12-24-2008 07:40 PM
VFS: cannot open root device "sda1" or unknown-block(2,0) elninio Linux - General 2 10-29-2008 05:05 PM
2.6.19: VFS: Cannot Open root device "sda1" or unknown-block(0,0) havok1977 Linux - Kernel 18 05-03-2007 05:25 PM
New kernel - VFS: Cannot open root device "301" or unknown block(3,1) j0y Debian 2 04-30-2005 10:14 PM
Kernel Panic:VFS: Cannot open root device "hda3" or 00:10 shivendnrab Linux - General 1 07-01-2004 04:08 AM


All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration