Friday, May 1, 2009

Running Debian on QEMU PowerPC

All I wanted was to setup a virtual PowerPC machine with Debian installed, so that I can verify that a certain piece of code works on a big-endian machine. It shouldn't be too difficult, right?


It's supposed to be just a matter of installing QEMU:
aptitude install qemu # as root

and then create a disk image, boot a PowerPC emulation system from a Debian PowerPC netinst CD image, and follow the installer instructions...
qemu-img create -f qcow2 debian-ppc.qcow2 10G
qemu-system-ppc -boot d -cdrom debian-testing-powerpc-netinst.iso debian-ppc.qcow2

This will only reward you with the following message
qemu: warning: could not load VGA bios '/usr/share/qemu/video.x'

and nothing else.

So much for theory.

It turns out that the Debian package is missing a binary file, on purpose (no source code). It's mentioned in /usr/share/doc/qemu/README.Debian - the file video.x can be found at the Mac On Linux (MOL) project site:
  1. download the current MOL source package
  2. extract it to some temporary directory
  3. as root copy video.x to /usr/share/qemu:
    cp mol- /usr/share/qemu/video.x
This time I managed to boot the virtual machine and start the installer. It looked fine, until, several hours later (my box is dead slow) the installer simply hanged while installing quik - I just hit Debian bug #513182, which, to put it simply, prevents Debian from being installed as a guest OS on a QEMU PowerPC emulated system.

Well, that's unless you know your way around PowerPC, Debian installer, quik and QEMU, like Aurélien Jarno. He maintains pre-installed QEMU disk images of Debian for several architectures, PowerPC included.

I downloaded the PowerPC disk image for Debian/Lenny, and started the PowerPC emulated system like this:
qemu-system-ppc -hdc debian_lenny_powerpc_small.qcow
works like a charm.

Now back to testing my code.

I found out that if I use the QEMU -vnc command line option, in order to setup QEMU as a VNC server, then QEMU (version 0.10.2) crashes if I try to connect to it with a VNC client using low color levels (I used the RealVNC viewer command line option -LowColourLevel 2). It works fine, with some hiccups when changing display modes, if I don't specify any VNC viewer connection options.

[15 Dec. 2009] UPDATE: with QEMU version 0.11.0 the command line has changed (read: has been fixed) and should be:
qemu-system-ppc debian_lenny_powerpc_small.qcow
(no need for the -hdc command line option - the disk image comes up as disk hda).


  1. thank you, thank you, thank you

    I've spent that last 24 hours trying to get this work and your blog did the trick.

  2. Which qemu version is it that works
    with this image - testing this
    with Fedora 12, but it fails for me.

    Best regards

    Mikael Höghede

  3. I'm using qemu version 0.11.0.

    Note that I was using qemu version 0.10.3 (I think) when this post was written, and it had a bug where you had to specify -hdc in order for qemu to boot the disk image as disk hda - it's not needed anymore.

    Hope this helps.

  4. What are you using for bios? Qemu barfed on me saying it couldn't find openbios-ppc. I got a copy from and put it in /usr/share/qemu Now when I run qemu-system-ppc debian_lenny_powerpc_small.qcow2 qemu barfs on "returning from prom_init"

  5. Frankly, I wasn't even aware that I needed the openbios-ppc package... it's listed as a dependency of the qemu-system package, and was automatically installed on my box when I installed qemu.

    openbios-ppc version on my box is 1.0+svn505-1.

    I traced qemu running with just the debian installer cdrom image and found that it accesses the following qemu related files:


    Hope this helps.

  6. Thanks! The solution for me (on Ubuntu) ended up being to uninstall qemu (qemu-kvm), add the debian-squeeze-main repo, and then install qemu-system from the latter.

  7. It works with with Ubuntu 9.04 and Lenny image using command syntax, after installing qemu-system-ppc as stated above and adding video.x as above:

    qemu-system-ppc -hda debian_lenny_powerpc_small.qcow2

    Nice to see this working.

  8. I just kicked off an install like this...

    qemu-system-ppc.exe -m 512 -boot d -hda debian-ppc.qcow2 -L
    pc-bios -M mac99 -net nic,model=pcnet -net user -cdrom
    debian-6.0.1a-powerpc-netinst.iso -boot d

    And away it goes.. Oh it's Qemu 0.14.0

  9. Thanks for the tip.

    QEMU and Debian have both evolved in the past two years, so I guess I should give it another try soon.

  10. Zung!now have you tested with the last QEMU? Thanks

  11. No I haven't.

    And I probably won't (at least in the near future), because most of the public stuff I work on nowadays is usually platform agnostic (e.g. Python). After more than 20 years, I've grown rather tired of coding in C/C++ - I mostly do that for money as my day job.