Skip to main content

PVE: NVIDIA GPU Passthrough

This guide walks you through creating a Linux VM in Proxmox (with GPU pass-through or related capabilities) and installing the NVIDIA driver on both Arch Linux and Debian (Bookworm).


1. Proxmox VM Configuration

  1. Locate and edit the VM configuration file:
/etc/pve/qemu-server/<VMID>.conf
  1. Add the following settings:
args: -cpu 'host,+kvm_pv_unhalt,+kvm_pv_eoi,hv_vendor_id=NV43FIX,kvm=off'
bios: ovmf
machine: q35
vga: none
  1. Note about VGA:
    • For the initial operating system installation, you may need to set:
    vga: std
    
    • After installation, change it to:
    vga: none
    
    and then reboot the VM.

2. Update GRUB

2.1 For Arch Linux

  1. Edit the GRUB configuration:
sudo nano /etc/default/grub
  1. Modify the GRUB_CMDLINE_LINUX_DEFAULT line to include:
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet splash nvidia-drm.modeset=1"

(Add any other parameters you need for your setup here.) 3. Regenerate the GRUB configuration:

sudo grub-mkconfig -o /boot/grub/grub.cfg

2.2 For Debian (Bookworm)

  1. Edit the GRUB configuration:
sudo nano /etc/default/grub
  1. Modify or add these lines:
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="nvidia-drm.modeset=1"
  1. Update GRUB:
sudo update-grub

3. Update Package Sources

3.1 For Arch Linux

Arch Linux uses rolling releases, so you typically do not need to edit package sources. Simply keep your system up to date:

sudo pacman -Syu

3.2 For Debian (Bookworm)

  1. Edit the sources list:
sudo nano /etc/apt/sources.list
  1. Ensure it contains something like:
deb http://deb.debian.org/debian/ bookworm main non-free-firmware contrib non-free
deb-src http://deb.debian.org/debian/ bookworm main non-free-firmware contrib non-free
deb http://security.debian.org/debian-security bookworm-security main non-free-firmware contrib non-free
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware contrib non-free
deb http://deb.debian.org/debian/ bookworm-updates main non-free-firmware contrib non-free
deb-src http://deb.debian.org/debian/ bookworm-updates main non-free-firmware contrib non-free
  1. Update and upgrade your packages:
sudo apt update
sudo apt upgrade

4. Install the NVIDIA Driver

4.1 For Arch Linux

  1. Install the NVIDIA driver:
sudo pacman -S nvidia
  1. Create/edit the modprobe configuration file:
sudo nano /etc/modprobe.d/nvidia.conf
  1. Add the following lines:
options nvidia_drm modeset=1
options nvidia_drm fbdev=1
  1. Save and close the file.

4.2 For Debian (Bookworm)

  1. Install the NVIDIA driver:
sudo apt install nvidia-driver
  1. Depending on your hardware and kernel, Debian may automatically create the appropriate modprobe files. If additional configuration is needed, you can place them in /etc/modprobe.d/.

5. Secure Boot Configuration

Before rebooting, decide how you want to handle Secure Boot. If your VM or host uses UEFI with Secure Boot enabled, you have two main options:

Option A: Disable Secure Boot (Easier)

  1. Disable validation:
mokutil --disable-validation
  1. Follow the on-screen prompts on the first reboot to complete the process.

Option B: Sign the Driver (More Secure)


6. Reboot

After completing all the steps relevant to your distribution and Secure Boot configuration:

  1. Reboot your system:
sudo reboot
  1. Verify that the NVIDIA drivers are in use by checking:
    • Arch Linux:
    nvidia-smi
    
    • Debian:
    nvidia-smi
    
    If the command shows information about your NVIDIA GPU, the driver is successfully loaded.

Final Notes

  • VM Performance: If you are using this VM for GPU pass-through, make sure your Proxmox host IOMMU groups and passthrough settings are properly configured.
  • Troubleshooting:
    • Check kernel messages (e.g., dmesg) for signs of driver load failures.
    • Ensure your VM configuration (qemu-server/<VMID>.conf) properly masks the CPU vendor (hv_vendor_id=NV43FIX) if you are trying to hide the virtualization from the driver (useful in some GPU pass-through scenarios).