Skip to contentSkip to conversation

Kernel panic when using initramfs instead of initrd

DISCUSSION Ivan Nikolaev 2 participants 2 messages May 5, 2013 – May 6, 2013

lore
Share & tools
lore
#0 lore raw

Hello everyone!
Briefly, I'm creating a dummy distribution which boots from CD (using VirtualBox for testing purposes) and lives in RAM. It's a very minimalistic kernel which has almost nothing enabled except from core facilities, virtual terminal, framebuffer and serial port. I'm trying to use the "ultimate boot feature" - the initial RAM filesystem. Basically what I have is a plain simple directory with the following contents:

./proc
./sys
./dev
./etc
./etc/inittab
./etc/profile
./etc/passwd
./bin
./bin/init
./bin/sh
./bin/busybox

Obviously, at boot /bin/init is executed which is instructed by /etc/inittab to simply run a shell and stay happy. EVERYTHING WORKS if I enable in the kernel some filesystem (like ext2 or squashfs) and create the initrd image of that type and put inside the contents of the directory. Isolinux then boots the kernel this way:

LABEL linux
SAY Booting linux...
KERNEL /vmlinuz
APPEND root=/dev/ram0 initrd=/initrd.gz console=ttyS0,38400 vga=0x305

To make this work, I obviously enabled the "Initial RAM filesystem and RAM disk (initramfs/initrd) support" in "General setup" and the "RAM block device support" in "Device drivers - block devices" options.

Well, ensuring everything works, I tried to switch to initramfs. Disabled the "RAM block device support", the ext2 and squashfs filesystems and created the init cpio image with a command like this:

find | cpio -H newc -o | gzip -9 > initrd.gz

The boot arguments are the same. When I boot, what I have is a kernel panic with the following details:

List of all partitions:
No filesystem could mount root, tried:

Kernel panic - not syncing: VFS: Unable to mount root fs on 

unknown-block(0,0)

Here's my config file: http://pastebin.com/XVd8ZukU
Using linux v3.9.0

Signature · 5 lines
Ivan Nikolaev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130505/c6803c68/attachment.html 
#1 lore raw

Hi Ivan,

On Sun, May 5, 2013 at 1:44 PM, Ivan Nikolaev <[email protected]> wrote:
...

Quoted 22 lines

EVERYTHING WORKS if I enable in the kernel some filesystem (like ext2 or squashfs) and create the initrd image of that type and put inside the contents of the directory. Isolinux then boots the kernel this way:

LABEL linux
SAY Booting linux...
KERNEL /vmlinuz
APPEND root=/dev/ram0 initrd=/initrd.gz console=ttyS0,38400 vga=0x305

To make this work, I obviously enabled the "Initial RAM filesystem and RAM disk (initramfs/initrd) support" in "General setup" and the "RAM block device support" in "Device drivers - block devices" options.

Well, ensuring everything works, I tried to switch to initramfs. Disabled the "RAM block device support", the ext2 and squashfs filesystems and created the init cpio image with a command like this:

find | cpio -H newc -o | gzip -9 > initrd.gz

The boot arguments are the same. When I boot, what I have is a kernel panic with the following details:

Quoted 6 lines

List of all partitions:
No filesystem could mount root, tried:

Kernel panic - not syncing: VFS: Unable to mount root fs on

unknown-block(0,0)

Here's my config file: http://pastebin.com/XVd8ZukU

Empty CONFIG_INITRAMFS_SOURCE parameter in your config should actually look like

CONFIG_INITRAMFS_SOURCE="/path/to/your/initrd.gz"

given the command you use for initramfs creation, because initramfs image is linked into the vmlinuz at the build time.

Signature · 2 lines
Thanks.
-- Max