Fighting error 43 – how to use Nvidia GPU in a virtual machine.

The infamous error 43 is the answer of Nvidia windows driver, in case it  recognizes the GPU is beeing used inside a virtual machine.

Luckily, with a few tweaks in the virtual machine configuration file the Nvidia driver can be tricked.

System setup

This method worked for me with these system evironment:

  • Host: Ubuntu 18.04, as well as a 16.04 host. 
  • Host: QEMU emulator version 2.12.0
  • Host: virsh version 4.6.0.
  • Guest: Windows 10
  • VM chipset: x440FX
  • Guest: Nvidia driver 399.07
  • Guest: GPU Geforce GTX 970 and Geforce GTX 1060

Virtual machine config changes

In order edit the virtual machines configuration use:

cd /etc/libvirt/qemu
sudo virsh define windows10.xml (change this according to your virtual machine name)
sudo virsh edit windows10

once your done with the edits and have saved your config re-run:

sudo virsh define windows10.xml

Fixing error 43

First of all find the very first line, which should read:

<domain type='kvm'>

and replace it with:

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

Now find the block <features> and add (or update if it already exists) the following block in parallel to the <acpi> block:

 <kvm> 
<hidden state='on'/>

</kvm>

Attention: Make sure <acpi> and <kvm> have the same indent.

Find the line which ends with </devices>
and add the following block afterwards (or alter the block if it already exists):

<qemu:commandline> 
<qemu:arg value='-cpu'/>
<qemu:arg value='host,hv_time,kvm=off,hv_vendor_id=null'/> </qemu:commandline>

Attention: Make sure <devices> and <qemu:commandline> have the same indent.

Thats it – these settings work for me. Instead of adding the hv_vendor_id=null to the qemu commandline, one can also directly set a tag in the <hyperv> section – but as I said these are the settings which worked for me.

As usual, the glorious arch wiki has further information and help; i.e. it recommends using a 12-character alphanumeric string as vendor ID.

Leave a Reply

Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.