Score:2

qemu failed to passthrough a tpm device

cf flag

Hi i'd like to install windows 11 on kvm.

I have tpm enabled on my system. ubuntu 21.04 (qemu 5.2+dfsg-9ubuntu3.1)

ls -ls /dev/tpm*

0 crw-rw-rw- 1 root root  10,   224 Sep 25 18:18 /dev/tpm0
0 crw-rw-rw- 1 tss  tss  253, 65536 Sep 25 18:18 /dev/tpmrm0

the w11 xml file contains the passthrough code:

<tpm model="tpm-tis">
  <backend type="passthrough">
    <device path="/dev/tpm0"/>
  </backend>
</tpm>

When starting the vm I get the following error:

Unable to complete install: 'internal error: qemu unexpectedly closed the monitor: 2021-09-26T06:28:55.041197Z qemu-system-x86_64: -tpmdev passthrough,id=tpm-tpm0,path=/dev/fdset/3,cancel-path=/dev/fdset/4: '/dev/fdset/3' is not a TPM device.'

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.9/site-packages/libvirt.py", line 4376, in createXML
    raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: internal error: qemu unexpectedly closed the monitor: 2021-09-26T06:28:55.041197Z qemu-system-x86_64: -tpmdev passthrough,id=tpm-tpm0,path=/dev/fdset/3,cancel-path=/dev/fdset/4: '/dev/fdset/3' is not a TPM device.

Any ideas how to properly pass the tpm to the vm.

Thanks

Score:4
in flag

I have run into the same error.

I refered the next web page and found the Apparmor makes this problem.

I added /dev/tpm0 rw in /etc/apparmor.d/abstractions/libvirt-qemu and restarted apparmor. The error dialog will not show.

I hope this make some help.

Ref. Here’s what you’ll need to upgrade to Windows 11 https://arstechnica.com/gadgets/2021/06/heres-what-youll-need-to-upgrade-to-windows-11/?utm_brand=arstechnica&utm_source=twitter&utm_social-type=owned&utm_medium=social

David avatar
cn flag
Anything to do with upgrading Windows is off topic on this site.
cf flag
Yes this solved the problem
cn flag
+100 great solve here, amazing
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.