Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Helpful to read output when debugging
- set -x
- ## Load the config file with our environmental variables
- source "/etc/libvirt/hooks/kvm.conf"
- # Stop display manager (KDE specific)
- systemctl stop sddm.service
- #sleep 3
- # Unbind VTconsoles
- echo 0 > /sys/class/vtconsole/vtcon0/bind
- #sleep 2
- # Unbind EFI-Framebuffer
- echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
- # Avoid a race condition
- sleep 5
- # Unload all Nvidia drivers
- modprobe -r nvidia_drm
- modprobe -r nvidia_modeset
- modprobe -r drm_kms_helper
- modprobe -r nvidia
- modprobe -r i2c_nvidia_gpu
- modprobe -r drm
- sleep 2
- # Unbind the GPU from display driver
- virsh nodedev-detach $VIRSH_GPU_VIDEO
- virsh nodedev-detach $VIRSH_GPU_USB
- virsh nodedev-detach $VIRSH_GPU_SERIAL
- #It hangs right here when it tries to detach audio device
- virsh nodedev-detach $VIRSH_GPU_AUDIO
- # Load VFIO kernel module
- modprobe vfio
- modprobe vfio_pci
- modprobe vfio_iommu_type1
- sleep 2
Advertisement
Add Comment
Please, Sign In to add comment