Incus is a manager for virtual machines and system containers.
A virtual machine (VM) is an instance of an operating system that runs on a computer, along with the main operating system. A virtual machine uses hardware virtualization features for the separation from the main operating system. With virtual machines, the full operating system boots up in them. Therefore, it is possible to run Windows in a virtual machine, even if your host is Linux.
A system container is an instance of an operating system that also runs on a computer, along with the main operating system. A system container, instead, uses security primitives of the Linux kernel for the separation from the main operating system. You can think of system containers as software virtual machines. The system containers reuse the running Linux kernel of the host, therefore you can only have Linux system containers, any Linux distribution.
In this post we are going to see how to create an Incus virtual machine with Windows.
Table of Contents
- Updates
- Prerequisites
- Cheat sheet
- Downloading a Windows ISO file
- Preparing the Windows ISO file
- Creating the Windows VM on Incus
- Booting the Windows virtual machine
- Reconnecting to the Windows virtual machine
- Removing the virtual Windows DVD ISO
- Screenshots
- Summary
- Bonus material #1 – Incus profile for Windows
- Bonus material #2 – Windows ISO as a volume in Incus
- Bonus material #3 – CPU Pinning for QEMU
- Bonus material #4 – How to mount a directory from the host to the Windows VM
- Troubleshooting
- Error: This revision of snap “distrobuilder” was published using classic confinement…
- Error: You must be root to run this tool
- Error: Failed to check dependencies: Required tool “hivexregedit” is missing
- Error: Failed to check dependencies: Required tool “wimlib-imagex” is missing
- Error: Failed to check dependencies: Required tool “rsync” is missing
- Error: Failed add validation for device “install”: Missing source path for disk “install”
- Error: The instance is already running
- Error: Instance is not running
- Error: Failed to detect Windows version. Please provide the version using the –windows-version flag
- Error: Windows crashes during the first moments of booting up
- Error: When I enable audio in the Windows VM, I lose audio from the host
- How much space is available in Incus to use for my VM?
- Which version of Windows should I use in the Incus VM?
- How to get logs of the virtual machine if something goes wrong?
- I am using Fedora. What are the dependencies for distrobuilder?
Updates
Update #5 [2024-06-05]: Added parameter --windows-arch=amd64
to the distrobuilder
command (be explicit with the architecture). Thanks Brian!
Update #4: In Bonus Material #4. How to mount a directory from the host to the Windows VM.
Update #3: In Bonus Material #3. If the Windows VM crashes, there are two workarounds.
Update #2: In Bonus Material #2. Instead of keeping the Windows ISO file on your host, you can place it in the Incus storage pool.
Update #1: In Bonus Material #1. You can create an Incus profile that you can easily use when you want to create a Windows VM.
Prerequisites
- You should have a system that runs Incus.
- A Windows ISO file or enough bandwidth to download one.
- A system with support for hardware virtualization so that it can run virtual machines.
Cheat sheet
This is a summary of the commands. You are supposed to consult this section after you thoroughly read the post.
sudo snap install distrobuilder --classic
sudo distrobuilder repack-windows --windows-arch=amd64 Win11_23H2_English_x64v2.iso Win11_23H2_English_x64v2.incus.isoincus init win11vm --empty --vm
incus config device override win11vm root size=55GiB
incus config set win11vm limits.cpu=4
# MUST SEE BONUS MATERIAL #3.incus config set win11vm limits.memory=6GiB
# Should be OK with 4GiB as well.incus config device add win11vm vtpm tpm path=/dev/tpm0
incus config device add win11vm install disk source=/home/myusername/Downloads/Win11_23H2_English_x64v2.incus.iso boot.priority=10
incus start win11vm --console=vga
incus console win11vm --type=vga
incus config device remove win11vm install
Downloading a Windows ISO file
You can download Windows ISO files from Microsoft, for example, at https://www.microsoft.com/en-us/software-download/ In my case I am selecting Windows 11. This site offers ISO images for Windows 8.1, Windows 10 and Windows 11. However, currently, the distrobuilder
companion for Incus can only prepare ISO images for Windows 11, Windows 10, Windows Server 2019, Windows Server 2012, Windows server 2016, Windows Server 2019 and Windows Server 2022.