Maintained by Thijmen Heuvelink
Enhancing GPU Passthrough on Proxmox: A Comprehensive Guide for Nvidia GPUs Across Multiple LXCs with Shared GPU Access
Motherboard: Asrock B550M Pro4
CPU: Ryzen 5 5600G
RAM: 2x32GB 3200 DDR4
GPU: Nvidia 750 Ti (2GB)
Proxmox: 8.1.10
This guide benefited from various sources, including:
This comprehensive guide aims to streamline the integration process of Nvidia GPUs with Proxmox and LXC containers. It condenses knowledge from various sources into a practical, step-by-step format for ease of implementation.
Visit Nvidia's Driver download page and select the appropriate driver for your GPU.
Copy the download link and execute the following commands:
wget <YOUR_DRIVER_DOWNLOAD_LINK> -O driver.run
chmod +x ./driver.run
sudo ./driver.run
Follow on-screen prompts, selecting defaults as necessary. If prompted to overwrite X defaults, choose "yes."
Ensure the driver installation was successful by running:
nvidia-smi
The output should look similiar to this:
For a detailed understanding of device and group identification, refer to Jim's video.
ls -l /dev/dri
cat /etc/group
Edit the subgid file:
nano /etc/subgid
Replace values with those obtained earlier.
Edit the LXC configuration file:
nano /etc/pve/lxc/<lxc-id>.conf
Add the following lines:
lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 44
lxc.idmap: g 44 44 1
lxc.idmap: g 45 100045 62
lxc.idmap: g 107 104 1
lxc.idmap: g 108 100108 65428
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm 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-tools dev/nvidia-uvm-tools none bind,optional,create=file
Grant root user access to necessary groups:
usermod -aG render,video root
OS: Ubuntu 22.04
Follow the installation guide here, adapting steps as necessary.
Ensure consistency of Nvidia driver versions between Proxmox host and LXC.
Download and install the driver:
wget <YOUR_DRIVER_DOWNLOAD_LINK> -O driver.run
chmod +x ./driver.run
sudo ./driver.run --no-kernel-module
Follow prompts, using default settings. Use the flag "--no-kernel-module" to prevent kernel reinstallation.
Confirm driver installation within LXC:
nvidia-smi
The output should look similiar to this:
Your LXC container is now configured to utilize the Nvidia GPU effectively. For scaling to additional LXCs, repeat the configuration steps outlined above.
For further inquiries or assistance, feel free to reach out:
This knowledge base serves as a valuable tool to simplify installations, troubleshoot common problems and to enhance the overall developer / admin experience. mail@thijmenheuvelink.nl - all rights reserved