Quick Notes on using Incus to run a .OVA File

How to use a .OVA in Incus

Published: November 30, 2024

Reading Time: 4 minutes

Incus

Recently I’ve been exploring Incus as a quick and lightweight VM/container hosting solution. One of the requirements I had for Incus was to quickly run a .ova file within it. It’s not too difficult to pull off, but the resources out there were sparse so I’ve put together a quick guide on how to do it.

Quick Primer: VMDK vs RAW vs OVA vs OVF vs ISO vs qcow2

VMs are sometimes a pain to use, especially since VMware workstation has regressed in usability since being acquired by Broadcom, this is not helped by the fact that there is a lot of jargon that means different things to different people. Here is a quick recap of some of the differences in VM image types.

OVF: Open Virtualization Format (OVF) is a standard for packaging virtual machine configuration files. This standard describes contains a few files:

  • .vmdk file: The VM disk image where the disk data lives. This is what you need to transfer to Incus.
  • .ovf file: XML file containing metadata about the virtual machine.
  • .mf file: The manifest file that contains sha256 verification information of the contents.

OVA Files: Essentially a tar of various files described in the Open Virtualization Format (OVF) needed for virtual machines to work. If we look at the .ova file I will be converting we can verify that after running tar xvf NetWars_Continuous_2.0.3_2019-11-25.ova, we can see the files were extracted:

VMware-SANS-nostromo-2019-11-25_1835.ovf
VMware-SANS-nostromo-2019-11-25_1835-disk1.vmdk
VMware-SANS-nostromo-2019-11-25_1835.mf

We can take a look at contents of the files that are plain-text files by using the following commands: file * | grep ASCII | cut -d" " -f 1 | sed s/://g | xargs batcat --pager=never

VMDK Files: Previously owned by VMware, VMDK files are typically used with VMware products and allow for features such as snapshots. VMDK files are essentially the contents of a hard drive mapped to a single file.

RAW files: Files with the .raw extension are “unformated” disk files. These files have no underlying metadata associated with them. They’re big, simple, and have less extra features that can cause issues if you’re doing odd things with them. Due to not having any smart features built in, they’re not very efficient when it comes to storage and they don’t naively support snapshots without using third party tooling such as Incus.

Qcow2 Files: Qcow2 (QEMU Copy On Write Version 2) has many additional features such as storage efficiency, native snapshotting features, etc. These features make them much more complex to work with.

ISO Files: A format for CD images widely used by Linux operating systems. It contains everything that would be written to a CD, great for installing operating systems.

How to upload an OVA to Incus

These steps were performed on an Ubuntu 24.04 machine running Incus. While the steps should work for other distributions, they have not been tested.

  1. Install the required qemu package that will allow for conversion of .vmdk to .raw:
sudo apt install qemu-utils
  1. Download The incus-migrate tool from github releases page. Look for bin.linux.incus.x86x64 (Or whatever architecture you’re running on).
chmod +x ~/Downloads/bin.linux.incus-migrate*

# Make sure it's working by printing the version number 
sudo ./bin.linux.incus-migrate.* --version
  1. Download your .ova file to a directory and move into it.
mkdir -p ~/scratchpad; cd scratchpad;

OVA=$(ls | grep .ova$)
  1. Untar the .ova using tar:
tar xvf $OVA 
  • If the .vmdk file is compressed (denoted by ending in .gz), decompress it:
    ls | grep ".gz$" | xargs gunzip 
    
  1. Set $VMDK to the .vmdk file and convert the .vmdk file to .raw (Optional But Recommended, this will be done anyway once uploading)
VMDK=$(ls | grep .vmdk$)
qemu-img convert -f vmdk $VMDK $OVA.raw
  1. Migrate .vmdk to Incus. this will actually upload the VM disk image into incus.
sudo ~/Downloads/bin.linux.incus-migrate.*
Is the local server the target?: Yes
Create VM: 1
Insert path to raw: ~/scratchpad/imagename.raw

That’s it. Your .OVA file will now be usable inside of Incus.

Optional

  1. Depending on the size of the OVA, you may want to retroactively add more storage to the VM. Within the Incus WebUI, additional disk storage space can be allocated if needed.

A connection to the VM console can be made by running sudo incus console <image_name> -t vga. You may need to install some dependencies first:

apt install -y remmina-plugin-spice virt-viewer 

OVA Running In Incus