Using Incus for automatic building of windows application

I’m currently exploring virtualization software options for my development needs and came across Incus. Before diving in, I wanted to gather some opinions.

I need to compile a windows application but I would like to utilize my linux server using virtual machine (headless), I will need msbuild, git (which I think once I have windows will be fine) but most important I digitally sign my application using a usb token, will I be able to mount the usb via Incus in order to use the signtool under windows?

If anybody has experience in this regards let me know if this will be a feasible way for me.
Thanks

Hi!

You would launch the VM with Windows and then keep it running.

To connect via CLI, use SSH. Either any third-party or the one from Windows.

To connect the USB token to the VM, do something like this. You get the Vendor ID and Product ID when you run lsusb on the host. As soon as you run the command, the device appears in the VM.

incus config device add win10vm myaudio usb vendorid=0c88 productid=163a

You might find the following post useful as well, How to run a Windows virtual machine on Incus on Linux – Mi blog lah!

Hi thanks for the answer,

yes exactly it would be a continuous running vm. I would need also a screen output (since the software to install the token does not run on cli), but for that I saw I could use “virt-viewer”; For the usb token I will give it a try like you said.

Ok then you think it would be possibile in the way I though?

Preferably, you would use incus commands that launch virt-viewer with the necessary parameters.
The following command launches virt-viewer for you with the necessary parameters to get a view of your VM. It’s the --type-vga that opens up the window.

incus console win11vm --type=vga

The rest of the work is automation of the build process from your side.

That’s great. Thank you so much for all the guidance. I will give a try and update you!

1 Like

Hi am finding this guide very well done. I have just one question while allocating disk space would be possible to use a different hard drive in the system instead of using defualt one?

In Incus you have one or more storage pools. This is disk space that has been allocated and can be used by Incus instances.

Let’s see what’s available. There’s a storage pool called default, using ZFS

$ incus storage list
+---------+--------+---------+-------------+---------+---------+
|  NAME   | DRIVER | SOURCE  | DESCRIPTION | USED BY |  STATE  |
+---------+--------+---------+-------------+---------+---------+
| default | zfs    | default |             | 87      | CREATED |
+---------+--------+---------+-------------+---------+---------+

There is a storage pool called default but we do not know yet the location of the actual storage.
We run a new command to show the details of the default storage pool.
In this example, we are using a whole partition, /dev/sdc1, formatted in ZFS, to store everything.

$ incus storage show default
config:
  source: default
  volatile.initial_source: /dev/sdc1
  zfs.pool_name: default
description: ""
name: default
driver: zfs
used_by:
...

If your current storage pool is not big enough, you can add a second one. Then, you can select which one to use when you launch Incus instances.

Note that if you want to create a Windows 11 VM, it requires about 55GB of disk space, even if the initial installation will use 18GB only. If you do not need Windows 11 but are OK with Windows 10, then the initial installation is only 12GB and you can allocate less space (I tried with 30GB and it worked).

If you create a new storage pool called extra, then when you create instances, you can use the --storage extra parameter to direct Incus to allocate space is the other storage pool.

See the documentation link I gave earlier and create an extra storage pool.