DEV Community

Chronic Engineering
Chronic Engineering

Posted on

Moving a VMware or VirtualBox VM into QEMU without hand-writing a command line

If you've got a folder of old VMware Workstation or VirtualBox machines and you want to try them under QEMU, the usual route is a bit of a chore: dig the CPU count and RAM out of a config file, work out which disks are attached to which controller, run qemu-img convert by hand, then write a long qemu-system-x86_64 line and hope the guest finds its boot disk.

AQEMU is my Qt front-end for QEMU on Windows (x64 and ARM64) and Linux. The 1.7.0.0 line in the repo adds an importer that does that legwork for you, so I wanted to write up how it works and, just as importantly, what it deliberately leaves alone.

Where to find it

There are two ways in:

  • File → Import VM now accepts .vmx (VMware), .vbox (VirtualBox), and .ova/.ovf appliances.
  • The VM Scanner can now discover VMware and VirtualBox configs on disk and offer to import them, so you don't have to remember where each one lives.

What gets read from the config

For a VMware .vmx, AQEMU reads the plain key/value pairs:

  • numvcpus for the CPU count and memsize for RAM (with sane minimums if they're missing)
  • firmware (and the Secure Boot flag) to decide between BIOS and UEFI
  • each ethernetN.virtualDev, plus the MAC address
  • every disk and CD/DVD that is marked present on the SCSI, SATA and NVMe controllers

For VirtualBox, it walks the .vbox XML: the firmware setting, the storage controllers (AHCI/SATA, SCSI/LSI, NVMe and so on), and the attached media, resolving each media UUID back to a real file path.

The importer shows a summary before it does anything: CPUs, RAM, firmware, each disk with its bus, plus any warnings. Missing disk files, unresolved VirtualBox media UUIDs, and configs with no disks at all are all flagged up front instead of failing silently later.

Boot first, tune later

The main design choice was to aim for "it boots" rather than "it's perfectly tuned". An imported guest was installed with VMware or VirtualBox drivers, not VirtIO ones, so switching it straight to VirtIO disks and networking would usually leave you with a guest that can't find its own boot disk.

So the importer maps things to devices the guest already understands:

  • SATA disks stay on AHCI, NVMe stays NVMe, IDE stays IDE, and SCSI disks are put on AHCI
  • network cards default to an e1000-compatible model (VMware's vmxnet and e1000 variants both map to e1000)

Once the guest is up you can install the VirtIO drivers and move it over at your own pace.

Things it skips on purpose, and says so in the notes: VMware Tools / VirtualBox Guest Additions, shared folders and 3D acceleration. Those are hypervisor-specific, and pretending to carry them over would be dishonest. Encrypted VMware VMs are detected and refused with a clear message: decrypt them in VMware first.

Disks: in place or converted

You choose one of two modes:

  1. Use disks in place. QEMU can open .vmdk, .vdi and .vhdx directly, so the new VM simply points at the existing files. Quick, and nothing is copied.
  2. Convert to qcow2. Each disk goes through qemu-img convert -O qcow2 into the destination folder. If a .qcow2 with the same name already exists, the import stops rather than overwriting it. I'd much rather show an error than eat someone's disk image.

Converting gives you qcow2 features like internal snapshots; using the disks in place is handy if you still want to boot the same VM in its original hypervisor now and then. (I wouldn't run the same disk in two hypervisors at the same time, though.)

The qemu-img Tools window

The old "Convert HDD" dialog has grown into a proper qemu-img Tools window in the same release line, which pairs nicely with imports:

  • Convert, including batches and preallocation options
  • Resize
  • Info / Check, with repair
  • Internal snapshot management for qcow2 images

They all share one console, so you can see exactly what qemu-img was asked to do and what it replied. The same "never overwrite existing outputs" rule applies here too.

On Windows, acceleration still applies

An imported x86_64 guest is just a normal AQEMU VM afterwards, so on an x64 Windows host it can use WHPX (Windows Hypervisor Platform), with TCG as the fallback; on Linux it can use KVM. 1.7.0.0 also improves how AQEMU detects WHPX on the host it's actually running on, and it warns at start-up if the acceleration you asked for isn't available rather than quietly crawling along. On ARM64 Windows hosts, WHPX is for ARM64 guests (that arrived in 1.6.0), so an x86 VM imported onto a Snapdragon machine will run under TCG emulation.

Try it

If an import goes wrong on one of your old VMs, Help → Copy setup for a GitHub issue puts the AQEMU version, host and QEMU path on your clipboard. An issue with that plus the warning text from the import summary is the quickest way for me to fix it.

Top comments (0)