qemu 无法通过 tpm 设备

use*_*726 4 virtualization qemu tpm

您好,我想在 kvm 上安装 Windows 11。

我的系统上启用了 tpm。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
Run Code Online (Sandbox Code Playgroud)

w11 xml 文件包含直通代码:

<tpm model="tpm-tis">
  <backend type="passthrough">
    <device path="/dev/tpm0"/>
  </backend>
</tpm>
Run Code Online (Sandbox Code Playgroud)

启动虚拟机时出现以下错误:

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.
Run Code Online (Sandbox Code Playgroud)

任何关于如何正确地将 tpm 传递到虚拟机的想法。

谢谢

小智 10

我遇到了同样的错误。

\n

我参考了下一个网页,发现 Apparmor 会出现这个问题。

\n

/dev/tpm0 rw,之前在 /etc/apparmor.d/abstractions/libvirt-qemu 中添加了/dev/net/tun rw,(注意,) and restarted apparmor. The error dialog will not show.

\n

我希望这能有所帮助。

\n

参考。\n这里\xe2\x80\x99是您\xe2\x80\x99升级到 Windows 11 所需的内容\n https://arstechnica.com/gadgets/2021/06/heres-what-youll-need-to-升级到 windows-11/?utm_brand=arstechnica&utm_source=twitter&utm_social-type=owned&utm_medium=social

\n