ilayna / Single-GPU-passthrough-amd-nvidia

My way of doing single gpu passthrough the simplest way, I've gathered many sources together to make the perfect Single GPU passthrough guide the simplest and easiest way.
GNU General Public License v3.0
397 stars 39 forks source link

Hand off back to host not working correctly - desktop manager crashing #2

Closed bhoglo closed 2 years ago

bhoglo commented 2 years ago

Hello,

I am running into the issue when I shutdown the VM, where it hands it back to the host OS, where my desktop manager keeps crashing and/or restarting. The only fix I can seem to find is restarting my PC. Seems I am running into the same issues as this person: https://github.com/joeknock90/Single-GPU-Passthrough/issues/81

Any ideas?

QuinsZouls commented 2 years ago

same issue here...

ilayna commented 2 years ago

Providing information about your system is necessary, display manager, distro etc...

bhoglo commented 2 years ago

Sorry, I apologize for the lack of details. I am currently on Pop OS 21.04 using the default display manager, gdm3. Anything else I can provide you with? I followed Risingprism's guide to 6 and finished the rest with yours, and I used your nvidia scripts. Works brilliantly until I shutdown the VM, that's when I run into the desktop manager seemingly restarting over and over again.

ilayna commented 2 years ago

Sorry, I apologize for the lack of details. I am currently on Pop OS 21.04 using the default display manager, gdm3. Anything else I can provide you with? I followed Risingprism's guide to 6 and finished the rest with yours, and I used your nvidia scripts. Works brilliantly until I shutdown the VM, that's when I run into the desktop manager seemingly restarting over and over again.

Driver version please, might be to do with the new nvidia drivers. Will check later

bhoglo commented 2 years ago

Sorry, I apologize for the lack of details. I am currently on Pop OS 21.04 using the default display manager, gdm3. Anything else I can provide you with? I followed Risingprism's guide to 6 and finished the rest with yours, and I used your nvidia scripts. Works brilliantly until I shutdown the VM, that's when I run into the desktop manager seemingly restarting over and over again.

Driver version please, might be to do with the new nvidia drivers. Will check later

I am using the System76's nvidia driver. Current version is 470.86

ilayna commented 2 years ago

It seems to come out a few days ago, might be the problem try using an older version tbh, this problem is something specific to a recent event. I don't have else much to offer. maybe you should try r/vfio but honstly I don't think it would do much. Try messing around with the drivers and making sure you got all steps working.

bhoglo commented 2 years ago

Alright, can you tell me what driver version you are using? What leads you to believe it is driver related?

ilayna commented 2 years ago

Alright, can you tell me what driver version you are using? What leads you to believe it is driver related?

From my understanding nvidia did something with the driver to "improve virtual machines support" and enable some features or whatever, i don't remember where seeing it and find it rn, but i think its the driver since it is the only thing changed. Also if it was the scripts to blame you won't be able to either, enter the guest os or exist the guest os, you would get a black screen both times. having wm issues after exiting guest means the problem is most likley not in the scripts. Currently I am not using a vm or nvidia gpu so I can't tell you what version to use but I think this should work. https://www.nvidia.com/Download/driverResults.aspx/177149/en-us

also found this https://nvidia.custhelp.com/app/answers/detail/a_id/5173/~/geforce-gpu-passthrough-for-windows-virtual-machine-%28beta%29

bhoglo commented 2 years ago

Alright, can you tell me what driver version you are using? What leads you to believe it is driver related?

From my understanding nvidia did something with the driver to "improve virtual machines support" and enable some features or whatever, i don't remember where seeing it and find it rn, but i think its the driver since it is the only thing changed. Also if it was the scripts to blame you won't be able to either, enter the guest os or exist the guest os, you would get a black screen both times. having wm issues after exiting guest means the problem is most likley not in the scripts. Currently I am not using a vm or nvidia gpu so I can't tell you what version to use but I think this should work. https://www.nvidia.com/Download/driverResults.aspx/177149/en-us

also found this https://nvidia.custhelp.com/app/answers/detail/a_id/5173/~/geforce-gpu-passthrough-for-windows-virtual-machine-%28beta%29

Thank you for your time, and for the info! I will dig into it.

bhoglo commented 2 years ago

This issue was resolved for me by rolling back the drivers to the suggested. Thank you!

Mollomm1 commented 1 year ago

I resolved this issue with a proprietary NVIDIA driver 535.104.05 (on Pop OS 22.04).

I modified the file /bin/vfio-teardown.sh as follows:

#!/bin/bash

set -x

# Unload VFIO-PCI Kernel Driver
modprobe -r vfio_pci
modprobe -r vfio_iommu_type1
modprobe -r vfio

# Re-Bind GPU to AMD Driver
virsh nodedev-reattach "0000:01:00:1"
virsh nodedev-reattach "0000:01:00:0"

# Rebind VT consoles
echo 1 > /sys/class/vtconsole/vtcon0/bind
echo 0 > /sys/class/vtconsole/vtcon1/bind

nvidia-xconfig --query-gpu-info > /dev/null 2>&1
# Re-Bind EFI-Framebuffer
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind

#Load nvidia driver
modprobe nvidia_drm
modprobe nvidia_uvm
modprobe nvidia_modeset
modprobe drm_kms_helper
modprobe nvidia
modprobe i2c_nvidia_gpu
modprobe drm

# Restart Display Manager
systemctl start display-manager

just change "0000:01:00:1" and "0000:01:00:0" by your own GPU PCI address, GDM should start when you shut down the guest OS.