dhruvvyas90 / qemu-rpi-kernel

Qemu kernel for emulating Rpi on QEMU
2.05k stars 362 forks source link

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

Open ghost opened 4 years ago

ghost commented 4 years ago

Hello,

please help me to make it work...

this is what I'm running, on host macOS Catalina:

qemu-system-arm \
  -kernel kernel-qemu-5.4.51-buster \
  -cpu arm1176 \
  -m 256 \
  -machine versatilepb \
  -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
  -drive "file=./2020-02-13-raspbian-buster.img,index=0,media=disk,format=raw" \
  -dtb versatile-pb-buster-5.4.51.dtb \
  -no-reboot \
  -serial stdio \
  -curses \
  -device e1000,netdev=user.0 \
  -netdev user,id=user.0,hostfwd=tcp::2222-:22

I tried before: without -dtb and -kernel jessie like here: https://gist.github.com/rossja/caf9b639aec1ebce6f227096e3bead38 it didn't show any error, no graphic, but ssh didn't connect.

Does anyone see what I'm doing wrong? I want to have a enough storage to compile for my raspberry pi 1 b+ 32 bit , without wasting time compiling there, using fast internet (virtio).

bukyapavankumar commented 4 years ago

@asgmeonerandom im having same issue .did you resolve it?

SimonVleugels commented 4 years ago

Same issue here...

kernel-qemu-4.19.50-buster and versatile-pb.dtb works. Switching to kernel-qemu-5.4.51-buster and versatile-pb-buster.dtb gives the same kernel panic.

extra logs:

ipt_CLUSTERIP: ClusterIP Version 0.8 loaded successfully                                                                                                                                                             
bpfilter: Loaded bpfilter_umh pid 34                                                                                                                                                                                 
NET: Registered protocol family 17                                                                                                                                                                                   
Bridge firewalling registered
8021q: 802.1Q VLAN Support v1.8
9pnet: Installing 9P2000 support
rtc-ds1307 0-0068: setting system clock to 2020-10-25T20:27:56 UTC (1603657676)
uart-pl011 101f1000.uart: no DMA platform data
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2
VFS: Cannot open root device "sda2" 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?)
0102            4096 ram2
 (driver?)
0103            4096 ram3
 (driver?)
0104            4096 ram4
 (driver?)
0105            4096 ram5
 (driver?)
0106            4096 ram6
 (driver?)
0107            4096 ram7
 (driver?)
0108            4096 ram8
 (driver?)
0109            4096 ram9
 (driver?)
010a            4096 ram10
 (driver?)
010b            4096 ram11
 (driver?)
010c            4096 ram12
 (driver?)
010d            4096 ram13
 (driver?)
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 Tainted: G        W         5.4.51 #1
Hardware name: ARM-Versatile (Device Tree Support)
[<c001c84c>] (unwind_backtrace) from [<c0018738>] (show_stack+0x10/0x14)
[<c0018738>] (show_stack) from [<c00252ec>] (panic+0xe4/0x2d8)
[<c00252ec>] (panic) from [<c0a7633c>] (mount_block_root+0x1f0/0x2b4)
[<c0a7633c>] (mount_block_root) from [<c0a767e0>] (prepare_namespace+0x15c/0x1bc)
[<c0a767e0>] (prepare_namespace) from [<c0609b0c>] (kernel_init+0x8/0xe8)
[<c0609b0c>] (kernel_init) from [<c00090e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xcf825fb0 to 0xcf825ff8)
5fa0:                                     00000000 00000000 00000000 00000000
5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
Rebooting in 1 seconds..
bukyapavankumar commented 4 years ago

@SimonVleugels for me the issue is there with buster too

SimonVleugels commented 4 years ago

If you try to emulate a RPI2/3 you should take a look at the native-emuation directory. This and switching to qemu v5.1.0 worked for me.

bukyapavankumar commented 4 years ago

@SimonVleugels I'm on qemu 5.1.0 and I'm trying with pi1 which doesn't have native emulation

andreatosato commented 4 years ago

@SimonVleugels I want to run raspberry 4 with buster.

My config:

"c:\Program Files\qemu\qemu-system-arm.exe" ^
-kernel kernel-qemu-5.4.51-buster ^
-dtb versatile-pb-buster-5.4.51.dtb ^
-cpu arm1176 ^
-m 256 ^
-M versatilepb ^
-serial stdio ^
-append "root=/dev/sda2 rootfstype=ext4 rw" ^
-hda 2020-02-13-raspbian-buster.img ^
-net nic ^
-net user,hostfwd=tcp::5022-:22 ^
-no-reboot

I'm on windows and I have same issue

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Tainted: G        W         5.4.51 #1
Hardware name: ARM-Versatile (Device Tree Support)
[<c001c84c>] (unwind_backtrace) from [<c0018738>] (show_stack+0x10/0x14)
[<c0018738>] (show_stack) from [<c00252ec>] (panic+0xe4/0x2d8)
[<c00252ec>] (panic) from [<c0a7633c>] (mount_block_root+0x1f0/0x2b4)
[<c0a7633c>] (mount_block_root) from [<c0a767e0>] (prepare_namespace+0x15c/0x1bc)
[<c0a767e0>] (prepare_namespace) from [<c0609b0c>] (kernel_init+0x8/0xe8)
[<c0609b0c>] (kernel_init) from [<c00090e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xcf825fb0 to 0xcf825ff8)
5fa0:                                     00000000 00000000 00000000 00000000
5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5fe0: 00000000 00000000 00000000 00000000 00000013 00000000

I must downgrade raspbian version to 5.1.0? Cannot it work on 5.4.x?

SimonVleugels commented 4 years ago

This is the config which I'm running. It's working with the latest raspios. I'm using the device tree and kernel image from the native-emuation directory and qemu-system-aarch64 v5.1.0 (build from source) . Afaik the rpi4 isn't in the machine list and thus not yet supported in qemu-system-aarch64.

qemu-system-aarch64 -kernel kernel8.img \
    -M raspi3 \
    -append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4" \
    -dtb bcm2710-rpi-3-b-plus.dtb \
    -sd 2020-08-20-raspios-buster-armhf-lite.img \
    -m 1G \
    -smp 4 \
    -no-reboot \
    -usb \
    -device usb-net,netdev=net0 \
    -netdev user,id=net0,hostfwd=tcp::5022-:22,hostfwd=tcp::50000-:50000 \
    -nographic
andreatosato commented 4 years ago

@SimonVleugels

WARNING: Image format was not specified for '2020-08-20-raspios-buster-armhf-lite.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
Invalid SD card size: 1.72 GiB
SD card size has to be a power of 2, e.g. 2 GiB.
You can resize disk images with 'qemu-img resize <imagefile> <new-size>'
(note that this will lose data if you make the image smaller than it currently is).

I have set size with this command: "c:\Program Files\qemu\qemu-img.exe" resize 2020-08-20-raspios-buster-armhf-lite.img 2

Finally work!

andreatosato commented 4 years ago

First resize img, work also with desktop raspbian:

"c:\Program Files\qemu\qemu-img.exe" qemu-img resize 2020-02-13-raspbian-buster.img 4G

Launch command:

"c:\Program Files\qemu\qemu-system-aarch64.exe" -kernel kernel8.img ^
    -M raspi3 ^
    -append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4" ^
    -dtb bcm2710-rpi-3-b-plus.dtb ^
    -sd 2020-02-13-raspbian-buster.img ^
    -m 1G ^
    -smp 4 ^
    -no-reboot ^
    -usb ^
    -device usb-net,netdev=net0 ^
    -netdev user,id=net0,hostfwd=tcp::5022-:22,hostfwd=tcp::50000-:50000 ^
    -nographic

I want to use Graphic options and more RAM than 1GB. I remove "-nographic" but when interact with QEMU window mouse and keyboard can't control it.

@SimonVleugels can you help me?

SimonVleugels commented 4 years ago

@andreatosato

If you didn't already found, RAM is configured with the -m option

To enable mouse and keyboard remove the nographic and add:

-device usb-mouse
-device usb-kbd
andreatosato commented 4 years ago

Raspberry 3 have max RAM equal ti 1gb 😔

Keyboard and mouse not work for me.

dhruvvyas90 commented 3 years ago

@andreabolognani : You might need to upgrade your qemu to 5.1.5 or above to have usb-keyboard / mouse working. If already done that, ignore this comment.

ucallmerk commented 3 years ago

For all VFS panic messages, Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) CPU: 0 PID: 1 Comm: swapper Tainted: G W 5.4.51 #1

the reason could be one of these

  1. Kernel build might have missed to enable EXT4 FS support when building -> kernel-qemu-5.4.51-buster
  2. The Raspbian image downloaded is eithe rcorrupted or doesn't have a block device named /dev/sda2