LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   nable to mount root fs on unknown-block (2.0)?? (http://www.linuxquestions.org/questions/linux-newbie-8/nable-to-mount-root-fs-on-unknown-block-2-0-a-832113/)

astray0924 09-14-2010 11:50 AM

nable to mount root fs on unknown-block (2.0)??
 
Hi, I'm currently trying to compile kernel 2.6.26 (vanilla) by changing some minor options (for experiment). I'm using VirtualBox 3.2.8 r64453.

I've used default configs (make defconfig) as the base, and set CONFIG_SOUND=n, and CONFIG_LOCALVERSION="practice' and LOCALVERSION_AUTO=n. I don't think those settings are critical for the issue, though.

The problem is, when I finished compiling my kernel and try to boot with it, I see the messages like below, and booting procedure stops there.

----------------------------------------------------------------------
Starting up...

Decompressing Linux... Parsing ELF... done
Booting the kernel.
ide_generic: I/O resource 0x1F0-0x1F7 not free.
ide_generic: I/O resource 0x170-0x177 not free.
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
^[Kernel panic - not syncing: VFS: Unable to mount root fs on unkown-block(2.0)]

--------------------------------------------------------------------------------

I figured out my issue is similar with this thread

http://www.linuxquestions.org/questi...-2-0-a-688150/

but regretfully I can't understand what it says :(. I'm alien with Linux.

I suppose the problem arises from misconfigured .config file, but I'm not sure about it.

Please help me... I'm nearly giving up.

p.s. Does .config only matters before compiling? Or is it effective even after the kernel image has been loaded? I'd like to know whether I could make my kernel work only by modifying existing .config file, without recompiling.

necro351 09-15-2010 10:48 AM

You need to configure drivers for the hard-drive your '/' dir (root) is contained within. For instance, do make menuconfig, then select the SATA controller drivers you need. You may also not have created a correct initrd image. In that case you'll have to google for mkinitrd help and run that command. If you don't create a correct initrd image, the kernel won't be able to load necessary modules (e.g., to utilize your hard-drive) at boot time (e.g., when the kernel needs to mount '/').

Sorry, my original reply was more detailed and elaborate, but this website had some session error and trashed it, too bad.

shpenat 09-15-2010 11:26 AM

You encountered chicken and egg problem of modular kernel structure. I will explain.

Kernel needs to know, how to work with hardware. But the kernel developer does not know which hardware will the end user have. To make kernel as small as possible, the modular structure is used. "Driver" for each hardware piece (and many other thing) are provided in the form of separate code which can be added to kernel when needed. Thus you can have very small basic kernel and load only modules you really need.

The problem is with hard drives. For example "driver" for ext3 filesystem is usually in form of module. But at the boot time this module is stored on disk which uses ext3 filesystem. So kernel can not load the ext3 module because he does not know how o read ext3 filesystem. Chicken and egg problem.

This situation is solved by using INIT Ram Disk (initrd). The bootloader loads part of the disk into RAM before starting the kernel itself. this part contains usually basic disk modules etc so kernel can load them from RAM (which it always can).

The second option is when using custom kernel, you can hard-code the modules directly to kernel instead of having modular structure. this way you can omit initrd.

So check if your original kernel use initrd. if yes, your build process should also create one and you need to include it into your boot loader configuration file.

astray0924 09-16-2010 04:09 AM

Thanks guys!!! I figured out that the problem had something to do with device driver of hard disk (as you guys told me).

I found out how to include the driver in the kernel, and also using initrd for modular approach. Now my kernel works great.

Thanks for kind advice!


All times are GMT -5. The time now is 10:35 PM.