↓ Skip to Main Content

NVIDIA GPU LXC Passthrough in Proxmox 8.4

·· loading · loading · ·

Prerequisite Host Driver Installation
#

Assuming the download file remains available, install the GPU driver with the following commands:

wget https://us.download.nvidia.com/XFree86/Linux-x86_64/570.144/NVIDIA-Linux-x86_64-570.144.run
chmod +x NVIDIA-Linux-x86_64-570.144.run
./NVIDIA-Linux-x86_64-570.144.run --dkms
  • Reboot if necessary.

After installtion, check GPU status with nvidia-smi.

Prerequisite LXC Configuration
#

Where GPU0 is used for transcoding, and while GPU1 is a dedicated utility GPU utilized by Ollama, add the following lines to the container’s configuration file (/etc/pve/lxc/<ID>.conf):

# Allow access to only nvidia1 and required shared devices, ADJUST GPU 1 or 0 BASED ON REQUIREMENT
lxc.cgroup2.devices.allow: c 195:1 rwm       # nvidia1
lxc.cgroup2.devices.allow: c 195:254 rwm     # nvidia-modeset
lxc.cgroup2.devices.allow: c 195:255 rwm     # nvidiactl
lxc.cgroup2.devices.allow: c 510:* rwm       # nvidia-uvm
lxc.cgroup2.devices.allow: c 511:* rwm
lxc.cgroup2.devices.allow: c 235:* rwm       # nvidia-caps

# Mount the necessary device files
lxc.mount.entry: /dev/nvidia1 dev/nvidia1 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-modeset dev/nvidia-modeset none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-caps dev/nvidia-caps none bind,optional,create=dir

# Required for unconfined runtime
lxc.apparmor.profile: unconfined
lxc.cap.drop:

NVIDIA GPU LXC Driver Installation
#

The download file for the NVIDIA GPU is fluid and should be adjusted as needed. This installation assumes Ubuntu Server 22.04 or 24.04. Additionally, the NVIDIA GPU driver version must match the Proxmox host NVIDIA GPU driver version (you must install the same driver version on the host AND the LXC) Use --no-kernel-module on LXC installs.

Assuming the download file remains available, provision new LXC’s requiring GPU access with the following commands:

wget https://us.download.nvidia.com/XFree86/Linux-x86_64/570.144/NVIDIA-Linux-x86_64-570.144.run
chmod +x NVIDIA-Linux-x86_64-570.144.run
./NVIDIA-Linux-x86_64-570.144.run --no-kernel-module
  • Reboot if necessary.

After installtion, check GPU status with nvidia-smi.

Reply by Email