EGL errors with qemu / KVM and Virtio w/ hardware acceleration

Hi, I’ve struggled to use virtual machines with hardware acceleration via the proprietary Nvidia drivers for the entirety of the 500 driver series (I think the latest time this worked was with the 470-series drivers).

I’m using virt-manager 4.1 and KVM to run Linux guest VMs on a Linux host. Every attempt at enabling 3d acceleration for Linux guests has resulted in the following error message:

Error starting domain: internal error: process exited while connecting to monitor: 2025-01-03T20:05:04.310608Z qemu-system-x86_64: egl: eglInitialize failed: EGL_NOT_INITIALIZED
2025-01-03T20:05:04.310679Z qemu-system-x86_64: egl: render node init failed

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/dist-packages/libvirt.py”, line 1379, in create
raise libvirtError(‘virDomainCreate() failed’)
libvirt.libvirtError: internal error: process exited while connecting to monitor: 2025-01-03T20:05:04.310608Z qemu-system-x86_64: egl: eglInitialize failed: EGL_NOT_INITIALIZED
2025-01-03T20:05:04.310679Z qemu-system-x86_64: egl: render node init failed

Using the open-source nouveau drivers, this configuration works as expected. However, it always breaks when I try to use Nvidia’s proprietary Linux drivers. Has anyone else had this issue?

Software:

  • Ubuntu 24.04.1 LTS (Linux kernel 6.8.0-51-generic)
  • Nvidia driver 565.77 via Proprietary GPU Drivers : “Graphics Drivers” team (I’ve been trying just about every driver in the 5XX series, they’ve all given the same error)
  • I’ve tried both the X11 and Wayland stacks that ship w/ Ubuntu
  • virt-manager 4.1 w/ the following config:
    • Video model: virtio w/ 3d acceleration enabled
    • Display type: Spice server w/ OpenGL enabled

Hardware:

  • Nvidia RTX 4080 (single display, 4k @ 60hz)
  • AMD Ryzen 7900X w/ 32 GB of RAM
1 Like

Same issue here.
On Arch 6.12.10, 565.77-12 driver, 5.0.0-1 virt manager running a Fedora VM. Looking forward to a solution.

Same issue with NixOS unstable

1 Like

HW accel relies on virglrender/Venuswhich to the best of my knowledge only works as part of mesa, which you don’t have access to after installing the driver, but nouveau does.

The only way I know of to get it with NV drivers is through passthrough, either an extra card or some hackery.

https://wiki.archlinux.org/title/QEMU/Guest_graphics_acceleration

I’ve never been able to do Spice with OpenGL with NVIDIA drivers. Neither with 470 nor with any other version. Are you sure you’ve seen Spice with OpenGL work on 470?

The only configuration that brings virtual GL into the guest with NVIDIA drivers has always been a separate EGL (headless) display for 3D rendering for me:

    <graphics type="spice">
      <listen type="none"/>
    </graphics>
    <graphics type="egl-headless">
      <gl rendernode="/dev/dri/renderD128"/>
    </graphics>
    <video>
      <model type="virtio" heads="1" primary="yes">
        <acceleration accel3d="yes"/>
      </model>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
    </video>

Just wanted to add as a data point that the situation is the same with Nvidia open source driver:

  • Arch Linux x86_64
  • kernel 6.13.5-arch1-1
  • NVIDIA Corporation TU117GLM [T1200 Laptop GPU]
  • nvidia-open 570.124.04-2
  • nvidia-utils 570.124.04-1

Fortunately for me this is a hybrid/Optimus laptop, so in the Spice device configuration panel in virt-manager, instead of “Auto” I can select my Intel iGPU and then the VMs boot normally.