Files
vfio-native/scripts/restore-stock-kvm.sh

20 lines
804 B
Bash
Executable File

#!/bin/bash
# Roll back to stock KVM: remove the patched modules and load the in-tree ones.
# The counterpart to install-modules.sh. Safe to run at any time.
#
# If the host hard-locked and you force-rebooted, run this before starting any VM.
set -euo pipefail
K=$(uname -r)
# the DKMS package owns updates/dkms/; remove it through pacman so dkms cleans up every kernel
if pacman -Q vfio-native-kvm-dkms >/dev/null 2>&1; then
pacman -R --noconfirm vfio-native-kvm-dkms
fi
rm -f "/usr/lib/modules/$K/updates/kvm.ko.zst" \
"/usr/lib/modules/$K/updates/kvm-amd.ko.zst" \
"/usr/lib/modules/$K/updates/kvm-intel.ko.zst"
depmod -a "$K"
modprobe -r kvm_amd 2>/dev/null || true
modprobe -r kvm 2>/dev/null || true
modprobe kvm_amd
echo "stock KVM restored: $(cat /sys/module/kvm/srcversion)"