# Windows 11 LXD Virtual Machine (Updated November 2023)

**URL:** https://discussion.scottibyte.com/t/windows-11-lxd-virtual-machine-updated-november-2023/88
**Category:** Uncategorized
**Created:** [May 22, 2022, 3:05am UTC](https://discussion.scottibyte.com/t/windows-11-lxd-virtual-machine-updated-november-2023/88 "2022-05-22T03:05:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![scott](https://discussion.scottibyte.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://discussion.scottibyte.com/u/scott)
#### Post date: [May 22, 2022, 3:05am UTC](https://discussion.scottibyte.com/t/windows-11-lxd-virtual-machine-updated-november-2023/88/1 "2022-05-22T03:05:24Z")

</div>

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. You also need to download the latest Windows ISO from the Microsoft site and rename it to windows11.iso.

This requires a minimum of LXD V4.0:

```auto
lxc version

```

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

```auto
sudo snap refresh lxd --channel=latest/stable

```

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

```auto
sudo snap install distrobuilder --edge --classic

```

Next, install the basic dependencies:

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

```

Now use distro-builder to repackage your Windows11 ISO:

```auto
sudo distrobuilder repack-windows --windows-version=w11 --windows-arch=amd64 windows11.iso win11.lxd.iso

```

Now create an empty LXD VM:

```auto
lxc init win11 --vm --empty

```

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

```auto
lxc config device override win11 root size=50GiB

```

Set your number of CPUs and memory allocation:

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

```

Set the override for TPM

```auto
lxc config device add win11 vtpm tpm

```

Define the installation media:

```auto
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:

```auto
lxc start win11 --console=vga

```

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

```auto
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](https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md).

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:

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

```

---

<div class="post-metadata">

### Author: ![tarzmania](https://discussion.scottibyte.com/letter_avatar_proxy/v4/letter/t/41988e/32.png) [@tarzmania](https://discussion.scottibyte.com/u/tarzmania)
#### Post date: [February 28, 2024, 3:50am UTC](https://discussion.scottibyte.com/t/windows-11-lxd-virtual-machine-updated-november-2023/88/2 "2024-02-28T03:50:04Z")

</div>

Hi Scott,

Thanks for your videos, I’m learning lots about Linux. I am just playing with setting up a server to be a LXD server and really could use a Windows VM. I tried this method, with a Win 10 iso but got an error:  
Error: failed to read directory “”: open : no such file or directory.

I did run it as sudo and made the change to specify the different version of Windows and file names.

Google didn’t seem to offer any advice about using distrobuilder to repack windows so I’m asking if you have any suggestions to try.

---

<div class="post-metadata">

### Author: ![scott](https://discussion.scottibyte.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://discussion.scottibyte.com/u/scott)
#### Post date: [February 28, 2024, 4:51am UTC](https://discussion.scottibyte.com/t/windows-11-lxd-virtual-machine-updated-november-2023/88/3 "2024-02-28T04:51:18Z")

</div>

Please visit [https://chat.scottibyte.com/](https://chat.scottibyte.com/) and we can discuss this. Thx.
