Help setting up Windows 11 on Virt-Manager

I’m having trouble getting Windows 11 started on Virt-Manager

Unable to complete install: 'internal error: Could not run '/usr/bin/swtpm_setup'. exitstatus: 1; Check error log '/var/log/swtpm/libvirt/qemu/Windows-swtpm.log' for details.'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 65, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/createvm.py", line 2001, in _do_async_install
    installer.start_install(guest, meter=meter)
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 701, in start_install
    domain = self._create_guest(
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 649, in _create_guest
    domain = self.conn.createXML(install_xml or final_xml, 0)
  File "/usr/lib/python3/dist-packages/libvirt.py", line 4389, in createXML
    raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: internal error: Could not run '/usr/bin/swtpm_setup'. exitstatus: 1; Check error log '/var/log/swtpm/libvirt/qemu/Windows-swtpm.log' for details.

Here’s the XML overview:

<domain type="kvm">
  <name>Windows</name>
  <uuid>87bceb63-c012-48c6-b933-077e0cab5b13</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://microsoft.com/win/10"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory>25165824</memory>
  <currentMemory>25165824</currentMemory>
  <vcpu current="12">12</vcpu>
  <os>
    <type arch="x86_64" machine="q35">hvm</type>
    <loader readonly="yes" type="pflash" secure="yes">/usr/share/OVMF/OVMF_CODE_4M.ms.fd</loader>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state="on"/>
      <vapic state="on"/>
      <spinlocks state="on" retries="8191"/>
    </hyperv>
    <vmport state="off"/>
    <smm state="on"/>
  </features>
  <cpu mode="host-model">
    <topology sockets="1" cores="6" threads="2"/>
  </cpu>
  <clock offset="localtime">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <timer name="hypervclock" present="yes"/>
  </clock>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/home/DATA/870E2TB/yamiyuki/VMs/Windows.qcow2"/>
      <target dev="sda" bus="sata"/>
      <boot order="2"/>
    </disk>
    <controller type="usb" model="qemu-xhci" ports="15"/>
    <interface type="network">
      <source network="default"/>
      <mac address="52:54:00:6b:2c:65"/>
      <model type="virtio"/>
    </interface>
    <console type="pty"/>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
    </channel>
    <input type="tablet" bus="usb"/>
    <tpm model="tpm-tis">
      <backend type="emulator" version="2.0"/>
      <alias name="tpm0"/>
    </tpm>
    <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
      <image compression="off"/>
    </graphics>
    <sound model="ich9"/>
    <video>
      <model type="qxl"/>
    </video>
    <redirdev bus="usb" type="spicevmc"/>
    <redirdev bus="usb" type="spicevmc"/>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw"/>
      <source file="/home/DATA/SGBC2T/yamiyuki/Downloads/ISOs/Win11_English_x64v1.iso"/>
      <target dev="sdb" bus="usb"/>
      <readonly/>
      <boot order="1"/>
    </disk>
  </devices>
</domain>

Please tell me what I’m doing wrong.

I’m currently on Kubuntu 21.10.

Also, /var/log/swtpm/libvirt/qemu/Windows-swtpm.log doesn’t exist.

Update 1: Decided to compile swtpm from GitHub. Now, Windows 11 won’t start.

Update 2: my BIOS update disabled virtualization. Windows finally started to boot.

For completeness because I am not sure you are aware: SWTPM should also be available as a package on *buntu based systems. It is the package providing a virtual or software TPM module. As you might have heard a TPM module is a prerequisite for the installation of Windows11. This package provides this functionality for kvm/libvirt, so that you can add a virtual TPM module to the virtual machine. Nothing more.

Glad you figured it out, have fun virtualizing!