joeknock90 / Single-GPU-Passthrough

1.49k stars 75 forks source link

Black screen after starting the VM #41

Closed zentros closed 3 years ago

zentros commented 3 years ago

Specs :

My start script : ` GNU nano 5.6 /etc/libvirt/hooks/qemu.d/win10/prepare/begin/start.sh
set -x

source "/etc/libvirt/hooks/kvm.conf"

systemctl stop ssdm.service

echo 0 > /sys/class/vtconsole/vtcon0/bind echo 0 > /sys/class/vtconsole/vtcon1/bind

echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind

sleep 5

modprobe -r nvidia_drm modprobe -r nvidia_modeset modprobe -r drm_kms_helper modprobe -r nvidia modprobe -r i2c_nvidia_gpu modprobe -r drm modprobe -r nvidia_uvm

virsh nodedev-detach pci_0000_01_00_0 virsh nodedev-detach pci_0000_01_00_1 virsh nodedev-detach pci_0000_01_00_2 virsh nodedev-detach pci_0000_01_00_3

modprobe vfio modprobe vfio_pci modprobe vfio_iommu_type1 `

My stop script : `set -x

source "/etc/libvirt/hooks/kvm.conf"

modprobe -r vfio_pci modprobe -r vfio_iommu_type1 modprobe -r vfio

virsh nodedev-reattach pci_0000_01_00_0 virsh nodedev-reattach pci_0000_01_00_1 virsh nodedev-reattach pci_0000_01_00_2 virsh nodedev-reattach pci_0000_01_00_3

echo 1 > /sys/class/vtconsole/vtcon0/bind echo 1 > /sys/class/vtconsole/vtcon1/bind

nvidia-xconfig --query-gpu-info > /dev/null 2>&1

echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind

modprobe nvidia_drm modprobe nvidia_modeset modprobe drm_kms_helper modprobe nvidia modprobe drm modprobe nvidia_umv

systemctl start sddm.service `

My libvirt settings : `

win10 be66376b-126f-4868-a504-173fcd214cc8 8601600 8601600 4 hvm /usr/share/edk2-ovmf/x64/OVMF_CODE.fd /var/lib/libvirt/qemu/nvram/win10_VARS.fd destroy restart destroy /usr/bin/qemu-system-x86_64

`

### HELP ME PLEASE

joeknock90 commented 3 years ago

Best way to see what's going on is to SSH into your machine while it's running and run each part manually

  1. SSH in
  2. Run the start script, make sure it completes sucessfully. If not, let me know where
  3. If it runs successfully, run the vm with virsh start {vmname}

Let me know what happens there.

austra221 commented 3 years ago

Hi zentros.

I also have an rtx card and I needed to do one extra command in the script for it to work. Add sudo nvidia-persistenced before modprobe -r nvidia_drm.

Without sudo nvidia-persistenced, the nvidia-related processes won't shutdown.

I would also recommend setting your wait to 10 seconds instead of 5. Also, do what joeknock said above.

Good luck

zentros commented 3 years ago

Best way to see what's going on is to SSH into your machine while it's running and run each part manually

1. SSH in

2. Run the start script, make sure it completes sucessfully. If not, let me know where

3. If it runs successfully, run the vm with `virsh start {vmname}`

Let me know what happens there.

don't have any device to ssh in

zentros commented 3 years ago

Best way to see what's going on is to SSH into your machine while it's running and run each part manually

1. SSH in

2. Run the start script, make sure it completes sucessfully. If not, let me know where

3. If it runs successfully, run the vm with `virsh start {vmname}`

Let me know what happens there.

don't have any device to ssh in

Hi zentros.

I also have an rtx card and I needed to do one extra command in the script for it to work. Add sudo nvidia-persistenced before modprobe -r nvidia_drm.

Without sudo nvidia-persistenced, the nvidia-related processes won't shutdown.

I would also recommend setting your wait to 10 seconds instead of 5. Also, do what joeknock said above.

Good luck

I added sudo nvidia-persistenced still the same issue

zentros commented 3 years ago

Best way to see what's going on is to SSH into your machine while it's running and run each part manually

  1. SSH in
  2. Run the start script, make sure it completes sucessfully. If not, let me know where
  3. If it runs successfully, run the vm with virsh start {vmname}

Let me know what happens there.

Used my brother's phone to ssh in : http://imgur.com/gallery/3MPs3X2

rickythewoof commented 3 years ago

it seems like the drivers for Nvidia gpu aren't installed. you should try doing that first also, it's better if you remove all of the spice devices, or else nvidia could spit out error 43

joeknock90 commented 3 years ago

Yeah definitely remove all of the spice devices connected to the VM, I sort of assumed that had been done already.

The only video device on the VM should be the passed through GPU.

The start script looks like it runs just fine so that's good.

zentros commented 3 years ago

I think i found the problem. Nvidia drivers weren't configured properly. I already removed the spice devices. I'll test the vm tomorrow as it's really late right now

zentros commented 3 years ago

Yeah definitely remove all of the spice devices connected to the VM, I sort of assumed that had been done already.

The only video device on the VM should be the passed through GPU.

The start script looks like it runs just fine so that's good.

configured the nvidia drivers. Ssh'd in and this is what i get : http://imgur.com/gallery/nEzABvC

zentros commented 3 years ago

Yeah definitely remove all of the spice devices connected to the VM, I sort of assumed that had been done already. The only video device on the VM should be the passed through GPU. The start script looks like it runs just fine so that's good.

configured the nvidia drivers. Ssh'd in and this is what i get : http://imgur.com/gallery/nEzABvC

i managed to make it work, still a black screen tho. no errors while running the script. I also removed spice

joeknock90 commented 3 years ago

Take out that nvidia-persistenced and try. I don't even know why it's there. Where did you read that it was required?

rickythewoof commented 3 years ago

Yeah definitely remove all of the spice devices connected to the VM, I sort of assumed that had been done already. The only video device on the VM should be the passed through GPU. The start script looks like it runs just fine so that's good.

configured the nvidia drivers. Ssh'd in and this is what i get : http://imgur.com/gallery/nEzABvC

i managed to make it work, still a black screen tho. no errors while running the script. I also removed spice

what does starting the vm via sudo virsh start win10 tell you?

joeknock90 commented 3 years ago

Something is using the nvidia driver. The script is NOT completing. If you don't take out that sudo nvidia-persistenced command in the start script, the nvidia driver will not be able to unbind from the video card and it will continue to not work.

zentros commented 3 years ago

Something is using the nvidia driver. The script is NOT completing. If you don't take out that sudo nvidia-persistenced command in the start script, the nvidia driver will not be able to unbind from the video card and it will continue to not work.

removed the nvidia-persistenced but now almost all the nvida modules give an error : FATAL ERROR : Module nvidia still in use

joeknock90 commented 3 years ago

Try running the script twice. Bear with me here, just curious about something.

zentros commented 3 years ago

Try running the script twice. Bear with me here, just curious about something.

managed to fix it. everything works perfectly now. The problem was nvidia-settings. It started in the background as soon as i started my pc up. Thanks for all the help

imadethisfor1page commented 3 years ago

Nvidia-settings? I know this issue is long old but I might actually need a fix, where?