Systemd update breaks QEMU / KVM VMs with PCI Passthrough

Note to the community, it looks like the latest systemd update broke many QEMU / KVM VMs with PCI passthrough. You may see an error similar to the following:

Error starting domain: internal error: QEMU unexpectedly closed the monitor (vm='MyVM'): 2023-08-05T20:30:26.787214Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:55:00.0","id":"hostdev4","bootindex":1,"bus":"pci.3","addr":"0x0"}: vfio 0000:55:00.0: failed to setup container for group 35: failed to open /dev/vfio/vfio: Permission denied

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1402, in startup
    self._backend.create()
  File "/usr/lib/python3.11/site-packages/libvirt.py", line 1373, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: QEMU unexpectedly closed the monitor (vm='MyVM'): 2023-08-05T20:30:26.787214Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:55:00.0","id":"hostdev4","bootindex":1,"bus":"pci.3","addr":"0x0"}: vfio 0000:55:00.0: failed to setup container for group 35: failed to open /dev/vfio/vfio: Permission denied

This has been identified by the systemd team and a fix has already been merged (https://github.com/systemd/systemd/pull/28590) so expect to receive an update in the next couple of days.

Between now and then, a temporary fix is to execute the following:

sudo chmod 666 /dev/vfio/vfio

but you’ll need to re-execute the command again after a reboot / restart.

Hope this is helpful for any community members impacted.

6 Likes

Update to this issue, systemd v254.1-1 which is now in the repositories fixes the permissions issue for QEMU / KVM VMs with PCI pass through on /dev/vfio/vfio. Update and return to normal operations.

1 Like