Categories: BSD, Open Source

QEMU runs OpenBSD, DragonFlyBSD (Hooray!)

After my disappointment with trying to run OpenBSD in VirtualBox (due to continuous segfaults), I am pleased to report that I can successfully run both OpenBSD and DragonFlyBSD in QEMU. And it’s easy!

I must say that I’m very chuffed with QEMU, seeing as this is my first real encounter with it.

I’ve managed to run the OpenBSD installation successfully on both Windows XP and Ubuntu Linux hosts. While the performance of QEMU is supposedly not comparable to that of other virtualizers, it runs just fine on my Quad Core machine at home without the use of an accelerator, and it does the job perfectly.

So here’s a rundown of what I did to install OpenBSD (please also read the footnote relating to this*):

In Ubuntu, I installed QEMU with:

sudo apt-get install qemu

There is a port of QEMU to Windows available as well: http://www1.interq.or.jp/t-takeda/qemu/qemu-0.9.1-windows.zip. (If you are using the Windows version, you need to change to the directory where you extract the installation to complete the exercise below).

Next, I created a disk image:

qemu-img create -f qcow2 openbsd.img 2G

This creates a 2GB growing disk image in qcow2 format called openbsd.img.

Next, I booted the system using the cdrom image as the boot media, and allocating it 128MB memory:

qemu -hda openbsd.img -cdrom ~/iso/install43.iso -boot d -m 128

Then I proceeded with the installation, which ran smoothly and quickly. For successive boots after the installation, I just issue:

qemu openbsd.img

To enable port forwarding to the sshd service, I use:

qemu openbsd.img -redir tcp:10022::22

This forwards requests on port 10022 on my host machine to port 22 on the OpenBSD guest. You can also use the -nographic option to supress graphic output. Documentation, if you want to read up more, is available here: http://bellard.org/qemu/qemu-doc.html.

* With regards to the OpenBSD installation, I had the experience that when creating the swap partition first in the label editor, the installer would try to install to there instead of the other partition (when I had only created those two) which I signified as “/”. Not sure if this was just due to some oversight, but it had me perplexed at first.

Article info




Leave a Reply

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