# Emulate Rpi with QEMU fails

**URL:** https://dietpi.com/forum/t/emulate-rpi-with-qemu-fails/4503
**Category:** General Discussion
**Created:** [3 October 2020 11:39 UTC](https://dietpi.com/forum/t/emulate-rpi-with-qemu-fails/4503 "2020-10-03T11:39:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![74cmonty](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/7/a88e57/32.png) [@74cmonty](https://dietpi.com/forum/u/74cmonty)
#### Post date: [3 October 2020 11:39 UTC](https://dietpi.com/forum/t/emulate-rpi-with-qemu-fails/4503/1 "2020-10-03T11:39:11Z")

</div>

Hi,  
I’m trying to emulate Rpi with QEMU.  
I found [this](https://www.raspberry-pi-geek.de/ausgaben/rpg/2014/04/raspberry-pi-emulieren/) arcticle in Raspberry Pi Geek documenting the steps including persistent storage on host.

However when starting the emulation with command

```nohighlight
qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -serial stdio -hda DietPi_RPi-ARMv6-Buster.img -net "user,hostfwd=tcp::5022-:22" -dtb versatile-pb-buster.dtb -kernel kernel-qemu-5.4.51-buster -append "root=/dev/sda2 rootfstype=ext4 rw panic=1" -no-reboot

```

I get this error:

```nohighlight
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)

```

I assume this is related to the content in fstab of RaspiOS:

```nohighlight
# Please use "dietpi-drive_manager" to setup mounts
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------

#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts
#----------------------------------------------------------------

#----------------------------------------------------------------
# SWAPFILE
#----------------------------------------------------------------

#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=907af7d0-02 / auto noatime,lazytime,rw 0 1
PARTUUID=907af7d0-01 /boot auto noatime,lazytime,rw 0 2

```

Can you please advise how to fix this error?

THX

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [3 October 2020 16:23 UTC](https://dietpi.com/forum/t/emulate-rpi-with-qemu-fails/4503/2 "2020-10-03T16:23:45Z")

</div>

Hi,

many thanks for your message. I guess you are using incorrect location for rootFS. It is specified to be located at an external HDD /dev/sda2

```nohighlight
"root=/dev/sda2 rootfstype=ext4 rw panic=1"

```

But this doesn’t seems to exist as you have following error message

```nohighlight
VFS: Cannot open root device "sda2"

```

You can check available devices running

```nohighlight
lsblk -o name,fstype,label,size,ro,type,mountpoint

```

---

<div class="post-metadata">

### Author: ![74cmonty](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/7/a88e57/32.png) [@74cmonty](https://dietpi.com/forum/u/74cmonty)
#### Post date: [3 October 2020 18:55 UTC](https://dietpi.com/forum/t/emulate-rpi-with-qemu-fails/4503/3 "2020-10-03T18:55:09Z")

</div>

In the meantime I overcome this issue.  
I found a Github [repo](https://github.com/dhruvvyas90/qemu-rpi-kernel) documenting a different command for starting QEMU:

```nohighlight
qemu-system-arm -serial stdio -M versatilepb -cpu arm1176 -m 256 -drive "file=DietPi_RPi-ARMv6-Buster.img,if=none,index=0,media=disk,format=raw,id=disk0" -device "virtio-blk-pci,drive=disk0,disable-modern=on,disable-legacy=off" -net "user,hostfwd=tcp::5022-:22" -dtb /home/thomas/Hardware/Raspi/versatile-pb-buster.dtb -kernel kernel-qemu-5.4.51-buster -append "root=/dev/vda2 panic=1 rw" -no-reboot

```

Unfortunately the emulated Rpi has no network connection, but this is a different issue.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [3 October 2020 21:56 UTC](https://dietpi.com/forum/t/emulate-rpi-with-qemu-fails/4503/4 "2020-10-03T21:56:37Z")

</div>

ah one thing that stepped into my mind as well, you might need to resize the DietPi image before using it on QEMU

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [5 October 2020 18:10 UTC](https://dietpi.com/forum/t/emulate-rpi-with-qemu-fails/4503/5 "2020-10-05T18:10:53Z")

</div>

74cmonty  
did you got it working in meantime and solved the problem with the missing network interface?
