Why do your drivers fail to install? What is error 43, and why do you experience it? Do you need a new gpu? — All common questions among Nvidia-based newcomers to passthrough gaming. Hopefully, we can provide an adequate explanation of these issues.
Read Also: Using nvidia-xrun for Dynamic Intel + NVIDIA GPU Switching on Linux
Nvidia cards make up nearly 90% of consumer GPU marketshare, according to steam’s hardware survey, so it stands to reason that error 43 is a very common roadblock for passthrough gaming newcomers. While the workaround is simple, it isn’t particularly well documented, in large part due to the fact that the error was intentionally contrived by Nvidia. The purpose of this article is to first, explain the problem in as simple terms as possible. And second, show the method to get an nvidia card working in a windows virtual machine.
To start off, I’d like to present the reason why code 43 appears when trying to pass through an nvidia gpu. The issue is, and this important to mention, present only in the GeForce line of cards. The quadro and tesla gpus don’t have this issue. Nvidia doesn’t want to cannibalize its own products in the professional market segment, and as such disables their consumer cards intentionally when users attempt to use them in a virtual machine, because enabling use cases like running a mainstream graphics card in a virtual machine would hurt the sale of more expensive cards.
Applying the Workaround Manually
Since the reason for the error’s occurance is clear, let’s move on to the workaround. The gist of how it works is that the hypervisor hides it’s existence. Thus, KVM tricks the graphics card into installing the drivers. The steps to get rid of the “Error 43: Driver failed to load” message, are as follows:
using your favorite text editor and while your virtual machine is off, edit its xml file. Do make sure to replace win10 and vim with the values applicable to you:
sudo EDITOR=vim virsh edit win10
First, set a vendor ID as shown below, a 12 character one is recommended. Insert the following line in the hyperv section:
<vendor_id state='on' value='123456789ab'/>
Second, instruct kvm to hide it’s state by adding the following code under the hyperv section:
save the xml file and exit out of your text editor.
you can restart libvirt, in case the change doesn’t take effect, using:
sudo systemctl restart libvirtd
Applying the Workaround: Virsh-Patcher
Easy as the manual method may seem once you’ve gotten it to work, there is an easier to way to achieve the same result as above. Our virsh-patcher package, available on our github, facilitates the application of this workaround. The use of a more friendly user interface is more appealing to those not familiar with a command line.
you can launch it and apply the fix using:
sudo virshpatcher --error43 --vendor-id 123456789ab win10
Of course, swap out win10 with the name of your virtual machine.
The owners of consumer nvidia cards can enjoy a virtualized gaming experience with a few simple tweaks, and while the error 43 workaround resembles a hack, without official support it’s all we’ve got. So, go ahead and apply the fix without fear and keep on gaming.
Discuss this subject and join the conversation about VFIO in our Discord server and play on our Steam Group with other VFIO enthusiasts!
Featured image courtesy of PixaBay