Table of Contents

Install Windows 11 Virtual

This entire article is a summation of https://manuelcortez.net/2023/12/creating-vm-windows11-libvirt/ which you should read for instructions on installing a Windows 11 virtual under libvirt. This summary is simply a set of instructions, a summary of that article.

Initial

Install tpm software module

apt install ovmf swptm swtpm-tools
# fix a permissions issue on Debian 12
chown -R tss /var/lib/swtpm-localca

Create the installer command (modify for your configuration)

virt-install \
   --name windows11-vm \
   --cdrom /var/lib/libvirt/iso/win11-22h2.iso \
   --os-variant=win11 \
   --network network=bridged-network,model=virtio \
   --disk size=50,cache=none,bus=virtio \
   --disk path=/var/lib/libvirt/iso/virtio-win.iso,device=cdrom \
   --memory 4096 \
   --sound default \
   --graphics spice,listen=0.0.0.0 \
   --vcpu 4 --video qxl \
   --noautoconsole \
   --features kvm_hidden=on,smm=on \
   --tpm backend.type=emulator,backend.version=2.0,model=tpm-tis \
   --boot loader=/usr/share/OVMF/OVMF_CODE.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/OVMF/OVMF_VARS.ms.fd

Install

Run the above command. It may stop, in which case, you need to edit the config file

virsh edit domainname
  1. Look in <os> for <loader>. Add secure='yes'
  2. Find and delete the <boot> element
  3. Find hard drive, add <boot order='2'/>
  4. Find CDROM for Windows 11, add <boot order='1'>
  5. save and exit, then start the virtual

During installation

  1. Use “load drive” when it can not find the hard disk, locate virtio-win cd, go into AMD64/W11 and select. Wait for drivers to be loaded
  2. Windows will ask to restart. Kill with destroy command and again edit domain config
  3. change boot order of disk to 1, and cdrom to 2
  4. start domain and finish install (no network)
  5. When done, install the rest of the virtio drivers to get network access