How to load a mender qemu image in virtualbox?

Mirza’s tutorial QEMU, the FAST! processor emulator (Ubuntu) explains how to boot the generated image with qemu well and it works flawlessly. Now i’m trying to port this to Virtualbox. I hesitated posting about it on this forum as this is not directly Mender related, but since the vmdk file works on Virtualbox without Mender (I also tested), I think it can interest many people.

The qemu command I use, based on mender-qemu script:

qemu-system-x86_64 \
    -m 512M \
    -drive file=ovmf.qcow2,if=pflash,format=qcow2,unit=0,readonly=on \
    -drive file=ovmf.vars.qcow2,if=pflash,format=qcow2,unit=1 \
    -nographic \
    -drive file=file.uefiimg,if=ide,format=raw

QEMU image is great for development but the motive is to ship the VM to customers in a one file format on a software that is well known by customers in general, hence Virtualbox.
Yocto can also provide a “wic.vmdk” image but in this case it is not “mender compatible” as only the uefiimg generated by Mender works (along with the bios one).

I read that it seems possible to convert a qemu image to a raw image, then to a vdi ( but the bootloader image and data are in separate files.

I converted the uefiimg to a vdi and added as hard drive under a “Controller: AHCI”, the image boots as you can see here: but then, constant black screen.
Command I used to convert:
VBoxManage convertfromraw file.uefiimg --format vdi file.vdi


1 Like

Hi @dbensoussan one possibility is to use the HDDIMG file. It is setup with a grub entry for “install” that will write the uefiimg to a second storage device. It’s not a single step but may work for you.

Note that I have not tried this with the QEMU machine types or with Virtualbox so there may be issues but it should be doable.

Thanks @drewmoseley. Ironic, but I actually just had to wait, the image boots after around 15 seconds of black screen. (Great things happpen when fetching a tea :wink: )

1 Like