I tried using file 8G virt.disk which has a primary partition (fat32) and a
secondary partition (ext4).

And I also tried setting root=/dev/ram when I supplied ramdisk file. 

But both failed with  Kernel panic - not syncing: Attempted to kill init!
exitcode=0x00000004.

Hope to hear some advice and I wish qemu documents include a kind example of
installing ubuntu from the .iso file.

Thanks!

Chan Kim

 

From: c...@etri.re.kr <c...@etri.re.kr> 
Sent: Monday, June 7, 2021 6:36 PM
To: 'qemu-discuss@nongnu.org' <qemu-discuss@nongnu.org>
Subject: ubuntu on qemu -- Cannot open root device OR No working init found
OR syncing: Attempted to kill init..

 

Hi, all,

 

I'm having a difficulty so I'm asking it here again.. Sorry for the long
email, but I can't figure out what is wrong.

Recently, I tried installing ubuntu on a qemu virtual machine but I couldn't
login to the ubuntu server because the password wasn't accepted: (
https://lists.nongnu.org/archive/html/qemu-discuss/2021-05/msg00053.html )

Today, I found this page for arm versatile-pb :
https://qemu-project.gitlab.io/qemu/system/arm/versatile.html and tried it
for an exercise..

BTW, the page above doesn't say anything about how I should make the
"debian-buster-armel-rootfs.ext4" file, so I just created a qcow2 disk image
and used it(this part I'm not sure if is ok or not).

 

#### try 1 : ######

 

This is the command I tried (after installing the needed toolchain):

BLD=build

SRC=../../../LinuxDevDrv/linux-5.4.21

 

make O=$BLD -C $SRC ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf-
versatile_defconfig

make O=$BLD -C $SRC ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf-
menuconfig

# added CONFIG_PCI, CONFIG_PCI_VERSATILE, CONFIG_SCSI,
CONFIG_SCSI_SYM5C8XX_2 above..

 

make O=$BLD -C $SRC ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf-

make O=$BLD -C $SRC ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- dtbs

# made versatile-pb.dtb file

 

ln -s $SRC/build/arch/arm/boot/zImage zImage

ln -s $SRC/build/arch/arm/boot/dts/versatile-pb.dtb versatile-pb.dtb

 

qemu-img create -f qcow2 debian-buster-armel-rootfs.qcow2 1T

 

../../qemu-5.1.0/build/arm-softmmu/qemu-system-arm -machine type=versatilepb
\

    -serial mon:stdio \

    -drive if=scsi,driver=file,filename=debian-buster-armel-rootfs.qcow2 \

    -kernel zImage \

    -dtb versatile-pb.dtb  \

    -append "console=ttyAMA0 ro root=/dev/sda"

 

When I ran the final booting with zImage, I get 

(. continued.)

rtc-ds1307 0-0068: setting system clock to 2021-06-07T06:37:00 UTC
(1623047820)

input: ImExPS/2 Generic Explorer Mouse as
/devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2

VFS: Cannot open root device "sda" or unknown-block(0,0): error -6

Please append a correct "root=" boot option; here are the available
partitions:

0100            4096 ram0 

 (driver?)

0101            4096 ram1 

 (driver?)

(. continued..)

010e            4096 ram14 

 (driver?)

010f            4096 ram15 

 (driver?)

1f00           65536 mtdblock0 

 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0)

CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.21 #2

Hardware name: ARM-Versatile (Device Tree Support)

[<c001c7d0>] (unwind_backtrace) from [<c001869c>] (show_stack+0x10/0x14)

[<c001869c>] (show_stack) from [<c0024cb4>] (panic+0xe8/0x2e4)

[<c0024cb4>] (panic) from [<c05ab2f0>] (mount_block_root+0x1f4/0x2b8)

[<c05ab2f0>] (mount_block_root) from [<c05ab7a0>]
(prepare_namespace+0x15c/0x1b0)

[<c05ab7a0>] (prepare_namespace) from [<c04678c8>] (kernel_init+0x8/0xe8)

[<c04678c8>] (kernel_init) from [<c00090e0>] (ret_from_fork+0x14/0x34)

Exception stack(0xc7821fb0 to 0xc7821ff8)

 

I thought there should be just some arguments missing in the command, for
example initrd argument. 

BTW, what is block device 0, 0? Could anyone please tell me what is missing?
Why does the page not give initrd argument?

 

#### Try 2 :  ######

Then, I tried adding initrd by adding option "-initrd
../../../busybox-1.32.1/initramfs.cpio.gz " 

This rd image was made for aarch64 before, and the initrd image contained
/dev/console (char dev major 5, minor 1), and /dev/ram (block dev major 1,
minor 0.

It also contained /init script with contents.

#!/bin/sh

echo "### INIT SCRIPT ###"

mkdir /proc /sys /tmp

mount -t proc none /proc

mount -t sysfs none /sys

mount -t tmpfs none /tmp

echo -e "\nThis boot took $(cut -d' ' -f1 /proc/uptime) seconds\n"

 

ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up

route add default gw 10.0.2.2

 

exec /bin/sh

The /bin directory has all the executables from busybox.

 

And this time the boot log ends like this (with initrd) :

   (. continue..)

Run /sbin/init as init process

request_module: kmod_concurrent_max (0) close to 0 (max_modprobes: 50), for
module binfmt-464c, throttling...

request_module: modprobe binfmt-464c cannot be processed, kmod busy with 50
threads for more than 5 seconds now

Starting init: /sbin/init exists but couldn't execute it (error -8)

Run /etc/init as init process 

Run /bin/init as init process

Run /bin/sh as init process

request_module: kmod_concurrent_max (0) close to 0 (max_modprobes: 50), for
module binfmt-464c, throttling...

request_module: modprobe binfmt-464c cannot be processed, kmod busy with 50
threads for more than 5 seconds now

Starting init: /bin/sh exists but couldn't execute it (error -8)

Kernel panic - not syncing: No working init found.  Try passing init= option
to kernel. See Linux Documentation/admin-guide/init.rst for guidance.

CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.21 #2 

Hardware name: ARM-Versatile (Device Tree Support)

[<c001c7d0>] (unwind_backtrace) from [<c001869c>] (show_stack+0x10/0x14)

[<c001869c>] (show_stack) from [<c0024cb4>] (panic+0xe8/0x2e4)

[<c0024cb4>] (panic) from [<c0467978>] (kernel_init+0xb8/0xe8)

[<c0467978>] (kernel_init) from [<c00090e0>] (ret_from_fork+0x14/0x34)

Exception stack(0xc7821fb0 to 0xc7821ff8)         

1fa0:                                     00000000 00000000 00000000
00000000

1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000

1fe0: 00000000 00000000 00000000 00000000 00000013 00000000

---[ end Kernel panic - not syncing: No working init found.  Try passing
init= option to kernel. See Linux Documentation/admin-guide/init.rst for
guidance. ]---

QEMU: Terminated

 

#### Try 3 ########

Because I see "/sbin/init exist but couldn;'texecute it (error -8)" message
above, I thought this is because I used an initrd I made for aarch64 using
busybox.

So I tried busybox for arm32 architecture using ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf-  during the busybox make and make
install. 

And I tried building the kernel with ARCH=AR CROSS_COMPILE=arm-non-eabi-
and it gave me this log.

(. continue..)

leds-syscon 10000000.core-module:led@08.6: registered LED versatile:6^M

leds-syscon 10000000.core-module:led@08.7: registered LED versatile:7^M

ledtrig-cpu: registered to indicate activity on CPUs^M

NET: Registered protocol family 17^M

input: AT Raw Set 2 keyboard as
/devices/platform/amba/amba:fpga/10006000.kmi/serio0/input/input0^M

rtc-ds1307 0-0068: setting system clock to 2021-06-07T09:13:50 UTC
(1623057230)^M

Freeing unused kernel memory: 180K^M

This architecture does not have kernel memory protection.^M

Run /init as init process^M

Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004^M

CPU: 0 PID: 1 Comm: init Not tainted 5.4.21 #3^M

Hardware name: ARM-Versatile (Device Tree Support)^M

[<c001cea4>] (unwind_backtrace) from [<c0018ea0>] (show_stack+0x10/0x14)^M

[<c0018ea0>] (show_stack) from [<c00250d4>] (panic+0xe8/0x2e4)^M

[<c00250d4>] (panic) from [<c0026aec>] (do_exit+0x970/0xa04)^M

[<c0026aec>] (do_exit) from [<c0027708>] (do_group_exit+0x3c/0xb4)^M

[<c0027708>] (do_group_exit) from [<c003205c>] (get_signal+0xf0/0x6e4)^M

[<c003205c>] (get_signal) from [<c0018808>] (do_work_pending+0x10c/0x530)^M

[<c0018808>] (do_work_pending) from [<c0009068>]
(slow_work_pending+0xc/0x20)^M

Exception stack(0xc7821fb0 to 0xc7821ff8)^M

1fa0:                                     00000000 00000000 00000000
00000000^M

1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000^M

1fe0: 00000000 beeedf00 00000000 00023720 00000030 ffffffff^M

---[ end Kernel panic - not syncing: Attempted to kill init!
exitcode=0x00000004 ]---^M

QEMU: Terminated

 

If I don't give initrd argument, I get

input: ImExPS/2 Generic Explorer Mouse as
/devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2

VFS: Cannot open root device "sda" or unknown-block(0,0): error -6

Please append a correct "root=" boot option; here are the available
partitions:

0100            4096 ram0

 

Please give me some advice, any help will be really appreciated. 

 

Thanks!

Chan Kim

 

Reply via email to