Windows 11 LXD Virtual Machine

We all know about Virtual Machines (VM). We know that there are many hypervisors like VirtualBox, Windows Hyper-V and VMWare. Linux also has Kernel Virtual Machines (KVM) which are accessed with the Linux QEMU program.

If you watch my channel regularly, you know that I like to focus on the strengths and capabilities of Linux Containers (LXC/LXD). Linux Containers behave like fully featured Linux machines, but they use the kernel of the host machine and really only reproduce user space virtually in a container. That allows a LXD container to install any components required for an application.

LXD containers are pretty much instant on and have no installation process or boot cycle.

This presentation focuses on LXD Virtual Machines. LXD VMs use the “lxc” CLI to create and manage containers. However, LXD VMs make calls to QEMU components are are really virtual machines. This allows LXD VMs to be any operating system including Windows.

In this presentation, I expanded on the last presentation where I introduced LXD VMs. This time I showed how to create a LXD VM for Windows 11.

The prerequisites are that you have LXD installed and also QEMU on your Linux Host.

This requires a minimum of LXD V4.0:

lxc version

At the time of this writing, the latest version of LXD is 5.1. To update it:

snap update lxd --channel=5.1/stable

Next install distrobuilder which is used to repackage iso images in a form that LXD can work with.

sudo snap install distrobuilder --edge --classic

Next, install the basic dependencies:

sudo apt install -y libguestfs-tools wimtools remmina-plugin-spice virt-viewer

Now use distro-builder to repackage your Windows11 ISO:

sudo distrobuilder repack-windows --windows-version=w11 windows11.iso win11.lxd.iso

Now create an empty LXD VM:

lxc init win11 --vm --empty

Set the size of your Drive C for the Windows LXD VM:

lxc config device override win11 root size=50GiB

Set your number of CPUs and memory allocation:

lxc config set win11 limits.cpu=4 limits.memory=8GiB

Define the installation media:

lxc config device add win11 install disk source=/home/scott/win11.lxd.iso boot.priority=10

Start the installation and connect to the console in one command:

lxc start win11 --console=vga

Windows installation will reboot many times as is normal. To reconnect to the console you will issue this command:

lxc console win11 --type=vga

Near the end of the video, we discovered that the Windows 11 LXD VM was not reachable via a ping on our bridged network adapter to the main LAN. In order to resolve this, you will need to install the Redhat VirtIO Drivers for Linux.

These drivers include a network adapter driver that resolves the network issue and a display adapter driver that allows the display resolution to be selected and changed. The download is an ISO disk image with an install file on the image. In addition, you will want to go into the Windows device manager and update drivers while pointed to this disk image.

Once these drivers are installed, go back to the LXD VM host and run the following command to add sound support to your Windows LXD VM:

lxc config set win11 raw.qemu -- "-device intel-hda -device hda-duplex"