Running raspbian in QEMU on Fedora 19

As I mentioned earlier (Zabbix templates for Raspberry PI), I want to develop Zabbix template for Raspebrry PI, but unfortunatelly my Raspberry PI could no be used to do such things now, so I decided to run raspbian on QEMU.

Here are the steps to run raspbian in QEMU on Fedora 19.

First of all You need install some packages and its dependencies:

yum install qemu-system-arm

Now we are ready to download things that we will need to run raspbian in QEMU.

# Linux Kernel for QEMU
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu
# Raspbian Wheezy
wget http://raspberry.mythic-beasts.com/raspberry/images/raspbian/2013-07-26-wheezy-raspbian/2013-07-26-wheezy-raspbian.zip

Now we are redy to set up everything. It will take few simple steps:

# unzip Raspbian Wheezy image
unzip 2013-07-26-wheezy-raspbian.zip
# put everything in one place:
mkdir rpi-qemu
cp kernel-qemu rpi-qemu/
cp 2013-07-26-wheezy-raspbian.img rpi-qemu/
cd rpi-qemu
# before mountin image You need to figure some thins:
file 2013-07-26-wheezy-raspbian.img
# now get "startsector" value for parition 2 and multiply by 512
mount ~/qemu_vms/2013-02-09-wheezy-raspbian.img -o offset=<multiplied_value> /mnt
# modify some files
cd /mnt/etc/
# edit this file: ld.so.preload
nano ld.so.preload
# comment out the line that is there by putting "#" before it
# save this file
# umount image:
umount /mnt

After above steps we are ready to fire Raspbian up.

qemu-system-arm -kernel rpi-qemu/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot --append "root=/dev/sda2 panic=1" -hda rpi-qemu/2013-07-26-wheezy-raspbian.img -redir tcp:2222::22 -daemonize

After issuing above command You should see smth like that:
QEMU running raspbian
After some time booting QEMU will give You root shell to fsck corrupted filesystem, just enter those command:

# check filesystem
fsck -y /dev/sda2
# reboot system
shutdown -r now

After those steps You are ready to power it up again and start using it almost like normal Raspberry PI.

Default username is pi and password is raspberry.

Of course there are some points that must be mentioned:

    • ping will not work, but networking will
    • You cannot use commands from /opt/vc – it is just not working (why?? – because all of them are hardware related commands)
    • You can login to Your Raspbian via ssh from localhost:
ssh pi@127.0.0.1 -p 2222
Posted in Uncategorized Tagged with: , ,
2 comments on “Running raspbian in QEMU on Fedora 19
  1. Very interesting and well explained. :)

    Looking forward to see the Zabbix Temaplates, have you got any luck with it?

    • sq4ind says:

      Hello, I did not have much time to do this, because I was moving my home to another country. But I will try to do some in nearest future. Thanks for comment.

Leave a Reply

Your email address will not be published. Required fields are marked *

*