--- tags: Hypervisor --- # Ubuntu KVM Passthrough (Access GPUs in Guest OS) {On Going still unsccessful} ###### tags: NVIDIA, KVM, Passthrough KVM, Ubuntu, Hypervisor ## HW Equipment SCB 1921 Xeon 6264 16GB*24 Video Link: https://www.youtube.com/watch?v=8o5DOf-_w-w ### Super user and update the apt ```javascript= sudo -i sudo apt-get update sudo apt-get upgrade ``` ### Edit the grub setting ```javascript= sudo gedit /etc/default/grub ``` ### Update existing line with this line ```javascript= GRUB_CMDLINE_LINUX_DEFAULT="quite splash intel_immou=on rd.driver.pre=vfio-pci" ``` ### Update the grub ```javascript= update-grub ``` ### Add the modules in gedit ```javascript= sudo gedit /etc/modules ``` ### Add these parameters in the file ```javascript= vfio vfio_iommu_type1 vfio_pci kvm kvm_intel ``` ![](https://i.imgur.com/K62CWfB.png) ### Create a small script, I've named mine /sbin/vfio-pci-override-vga.sh ```javascript= sudo gedit /sbin/vfio-pci-override-vga.sh ``` ### and write http://vfio.blogspot.com/2015 ```javascript= #!/bin/sh for i in $(find /sys/devices/pci* -name boot_vga); do if [ $(cat $i) -eq 0 ]; then GPU=$(dirname $i) AUDIO=$(echo $GPU | sed -e "s/0$/1/") echo "vfio-pci" > $GPU/driver_override if [ -d $AUDIO ]; then echo "vfio-pci" > $AUDIO/driver_override fi fi done modprobe -i vfio-pci ``` ### make it executable ```javascript= chmod 755 /sbin/vfio-pci-override-vga.sh ``` ### create another conf file ```javascript= sudo gedit /etc/modprobe.d/local.conf ``` ### update the local.conf file with ```javascript= install vfio-pci /sbin/vfio-pci-override-vga.sh ``` ### edit the initramfs-tools/modules file ```javascript= sudo gedit /etc/initramfs-tools/modules ``` ### update the initramfs-tools/modules with ```javascript= install_items+="/sbin/vfio-pci-override-vga.sh /usr/bin/find /usr/bin/dirname" ``` ![](https://i.imgur.com/JFJ8ZTs.png) ### update the initramfs ```javascript= update-initramfs -u ``` ### Install qemu and virt manager ```javascript= sudo apt install qemu qemu-utils virt-manager ovmf reboot ``` ### Keep this link open https://libvirt.org/formatdomain.html >Domain XML Format >> Hypervisor Features ### open virt XML code ```javascript= sudo virhsh edit <Machine name e.g. Ubuntu> ``` Add this line after <kvm> <hidden state='on'/> </kvm> ![](https://i.imgur.com/lfXJYnj.png) ## Errrrroooorrrrrsssss ![](https://i.imgur.com/0PPIDrn.jpg) Solved This issue removing the NIC Cards. ## When we Successfully bind the passthough PCI device and run the VM again its show these issues## ![](https://i.imgur.com/NAINXSC.jpg) ![](https://i.imgur.com/EspBpas.jpg)