1

I've succeeded in setting up my windows 11 VM for single gpu passthrough, however, when stopping the vm, my screen remains black. I'm using arch linux. start script: (working)

set -x
source "/etc/libvirt/hooks/kvm.conf"

systemctl stop display-manager.service
systemctl stop sddm

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

#uncomment the next line if you're getting a black screen
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind

sleep 10

modprobe -r amdgpu
modprobe -r snd_hda_intel

virsh nodedev-detach $VIRSH_GPU_VIDEO
virsh nodedev-detach $VIRSH_GPU_AUDIO

sleep 10

modprobe vfio
modprobe vfio_pci
modprobe vfio_iommu_type1

end script: (not working)

set -x
source "/etc/libvirt/hooks/kvm.conf"

systemctl stop display-manager.service
systemctl stop sddm

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

#uncomment the next line if you're getting a black screen
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind

sleep 10

modprobe -r amdgpu
modprobe -r snd_hda_intel

virsh nodedev-detach $VIRSH_GPU_VIDEO
virsh nodedev-detach $VIRSH_GPU_AUDIO

sleep 10

modprobe vfio
modprobe vfio_pci
modprobe vfio_iommu_type1

When ssh-ing into my system, sddm and display-manager.service are inactive. The ram used by Qemu is freed, so the VM gets stopped. I suspect some part of the script does not execute correctly, which causes an error, which causes the rest of the script to not execute. However, I don't know how to verify this theory, nor how to debug it. Any help would be appreciated!

2
  • Generally, when you suspect an error in the a script, you use a debug mode to step through the script line by line, or you add some output to the script to check values and success/failure of each line. I'm not super familiar with this system, and so I'm not sure how precisely this would be done in this case, but hopefully this suggestion can get you pointed in a productive direction? Commented Jun 13 at 20:26
  • @music2myear I'm still not sure how I should go about doing this. Would you suggest I run the script by itself? In that case, I would run the start script, wait for it to finish, then ssh into my machine to run the end script in a debug mode. However, I'm not sure how I can run a script in debug mode. Is there a way to go over a script line by line, similar to using a debugger in an IDE?
    – Twiston
    Commented Jun 16 at 9:08

0

You must log in to answer this question.