Skip to contentSkip to conversation

requirements of root filesystem image when passed to qemu

Qemu-devel Peter Teoh 1 participant 2 messages Jun 12, 2008 – Jun 13, 2008

lore
Share & tools
lore

Peter Teoh

author
#0 lore raw

First, after installing debian (8.04) on a qemu image - debian.cow - I then used it to mount the latest kernel:

qemu -kernel /boot/vmlinuz-2.6.26-rc5 -hda debian.cow -append "root=/dev/hda console=ttyS0" -nographic

[    5.493332] 0300    1331200 hda driver: ide-disk
[    5.494978]   0301     248976 hda1
[    5.496151]   0302    1076355 hda2
[    5.497403] No filesystem could mount root, tried:  ext3 ext2 iso9660
[    5.499552] Kernel panic - not syncing: VFS: Unable to mount root

fs on unknown-block(3,0)

But when I downloaded the root filesystem image at:

http://bellard.org/qemu/download.html

for linux-0.2.img, and execute:

qemu -kernel /boot/vmlinuz-2.6.26-rc5 -hda linux-0.2.img -append "root=/dev/hda console=ttyS0" -nographic

everything went through to the root prompt level, even though the
linux-0.2.img image has its own kernel version (0.2). And I noticed
that (using "file"):

linux-0.2.img: x86 boot sector, LInux i386 boot LOader debian.cow: QEMU Copy-On-Write disk image version 1, size 0 + 1363148800

Next, using another rootfs image:

file FedoraCore5-x86-root_fs
FedoraCore5-x86-root_fs: x86 boot sector

I run qemu successfully.

Next I entered ubuntu installation image:

ubuntu-8.04-desktop-i386.iso: ISO 9660 CD-ROM filesystem data UDF filesystem data (unknown version, id 'NSR01') 'Ubuntu 8.04 i386
' (bootable)

qemu -kernel /boot/vmlinuz-2.6.26-rc5 -hda ubuntu-8.04-desktop-i386.iso -append "root=/dev/hda console=ttyS0" -nographic

And the result is:

[    6.136373] Unable to load NLS charset utf8
[    6.144019] VFS: Mounted root (iso9660 filesystem) readonly.
[    6.144826] debug: unmapping init memory c0795000..c07d4000
[    6.145575] Write protecting the kernel text: 2352k
[    6.146417] Write protecting the kernel read-only data: 1068k
[    6.147388] Warning: unable to open an initial console.
[    6.148323] Kernel panic - not syncing: No init found.  Try passing

init= option to kernel.

So what is the requirement for -hda then? 1. presence of
bootsector image 2. presence of /sbin/init???

Next I created the busybox rootfs image following this instruction:

http://dev.gentoo.org/~solar/busybox/bbemu

And run qemu as before, just substituting only the -hda option, it result in:

[    5.564894] debug: unmapping init memory c0795000..c07d4000
[    5.565539] Write protecting the kernel text: 2352k
[    5.565891] Write protecting the kernel read-only data: 1068k
[    5.656106] mount used greatest stack depth: 2240 bytes left

Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/etc/init.d/rcS': No such file or directory Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/bin/sh': No such file or directory

Endless repetition here..

Why?

Why the difference? (ie, why can't I mount the latest kernel on the
debian image) How to resolve the error as shown above?

Signature · 2 lines
Regards,
Peter Teoh
author
#1 lore raw
Quoted 77 lines · Peter Teoh

First, after installing debian (8.04) on a qemu image - debian.cow - I then used it to mount the latest kernel:

qemu -kernel /boot/vmlinuz-2.6.26-rc5 -hda debian.cow -append "root=/dev/hda console=ttyS0" -nographic

[    5.493332] 0300    1331200 hda driver: ide-disk
[    5.494978]   0301     248976 hda1
[    5.496151]   0302    1076355 hda2
[    5.497403] No filesystem could mount root, tried:  ext3 ext2 iso9660
[    5.499552] Kernel panic - not syncing: VFS: Unable to mount root

fs on unknown-block(3,0)

But when I downloaded the root filesystem image at:

http://bellard.org/qemu/download.html

for linux-0.2.img, and execute:

qemu -kernel /boot/vmlinuz-2.6.26-rc5 -hda linux-0.2.img -append "root=/dev/hda console=ttyS0" -nographic

everything went through to the root prompt level, even though the
linux-0.2.img image has its own kernel version (0.2). And I noticed
that (using "file"):

linux-0.2.img: x86 boot sector, LInux i386 boot LOader debian.cow: QEMU Copy-On-Write disk image version 1, size 0 + 1363148800

Next, using another rootfs image:

file FedoraCore5-x86-root_fs
FedoraCore5-x86-root_fs: x86 boot sector

I run qemu successfully.

Next I entered ubuntu installation image:

ubuntu-8.04-desktop-i386.iso: ISO 9660 CD-ROM filesystem data UDF filesystem data (unknown version, id 'NSR01') 'Ubuntu 8.04 i386
' (bootable)

qemu -kernel /boot/vmlinuz-2.6.26-rc5 -hda ubuntu-8.04-desktop-i386.iso -append "root=/dev/hda console=ttyS0" -nographic

And the result is:

[    6.136373] Unable to load NLS charset utf8
[    6.144019] VFS: Mounted root (iso9660 filesystem) readonly.
[    6.144826] debug: unmapping init memory c0795000..c07d4000
[    6.145575] Write protecting the kernel text: 2352k
[    6.146417] Write protecting the kernel read-only data: 1068k
[    6.147388] Warning: unable to open an initial console.
[    6.148323] Kernel panic - not syncing: No init found.  Try passing

init= option to kernel.

So what is the requirement for -hda then? 1. presence of
bootsector image 2. presence of /sbin/init???

Next I created the busybox rootfs image following this instruction:

http://dev.gentoo.org/~solar/busybox/bbemu

And run qemu as before, just substituting only the -hda option, it result in:

[    5.564894] debug: unmapping init memory c0795000..c07d4000
[    5.565539] Write protecting the kernel text: 2352k
[    5.565891] Write protecting the kernel read-only data: 1068k
[    5.656106] mount used greatest stack depth: 2240 bytes left

Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/etc/init.d/rcS': No such file or directory Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/bin/sh': No such file or directory Bummer, could not run '/bin/sh': No such file or directory

Quoted 8 lines

Endless repetition here..

Why?

Why the difference? (ie, why can't I mount the latest kernel on the
debian image) How to resolve the error as shown above?

--

That was the last stage of booting - /sbin/init was executed, and
endless repetition is due to the inittab's respawn mechanism. and
instead of /bin/sh, which not sure was not created by bbemu, i changed it to /bin/msh, and it goes into a prompt.

Thanks.

Signature · 2 lines
Regards,
Peter Teoh