#!/bin/bash # Fix GRUB IOMMU conflict - remove amd_iommu=off that's blocking the passthrough set -e if [ "$EUID" -ne 0 ]; then echo "Please run as root: sudo $0" exit 1 fi echo "=== Fixing GRUB IOMMU Configuration ===" echo "" GRUB_FILE="/etc/default/grub" # Backup cp "$GRUB_FILE" "$GRUB_FILE.backup.$(date +%Y%m%d-%H%M%S)" echo "✓ Backup created" # Remove the conflicting amd_iommu=off sed -i 's/ amd_iommu=off//' "$GRUB_FILE" echo "✓ Removed amd_iommu=off from GRUB config" echo "" echo "New GRUB_CMDLINE_LINUX_DEFAULT:" grep "GRUB_CMDLINE_LINUX_DEFAULT" "$GRUB_FILE" echo "" # Update GRUB echo "Updating GRUB..." update-grub echo "" echo "=== Fix Complete ===" echo "" echo "⚠️ REBOOT NOW to apply changes: sudo reboot" echo "" echo "After reboot, verify with:" echo " ./verify-gpu-passthrough.sh"