Passing a GPU through to a Proxmox container

Published: 13 March 2022
on channel: LoRes DIY
34,420
693

We will pass a GPU through to a proxmox container and utilize it for video transcoding.

In the shell of the node

Check to see what kernel version you are running

uname -r

Install headers

apt-cache search pve-header

apt install pve-headers-*.*.*-*-pve

Blacklist Nouveau

nano /etc/modprobe.d/blacklist.conf

blacklist nouveau

update-initramfs -u

Reboot



Install Dependencies

apt install build-essential

Download Drivers

wget (YOURDRIVERS)

Nvidia driver site: https://www.nvidia.com/Download/index...

Make driver file executable

chmod +x (YOURDRIVERFILE)

Install the drivers

./(YOURDRIVERFILE)

Make sure drivers load when restarted


nano /etc/modules-load.d/modules.conf

Add these lines

Nvidia modules
nvidia
nvidia-modeset
nvidia_uvm

Update initramfs

update-initramfs -u

Create udev rules

nano /etc/udev/rules.d/70-nvidia.rules

Add lines

KERNEL=="nvidia", RUN+="/bin/bash -c '/usr/bin/nvidia-smi -L && /bin/chmod 666 /dev/nvidia*'"
KERNEL=="nvidia_modeset", RUN+="/bin/bash -c '/usr/bin/nvidia-modprobe -c0 -m && /bin/chmod 666 /dev/nvidia-modeset*'"
KERNEL=="nvidia_uvm", RUN+="/bin/bash -c '/usr/bin/nvidia-modprobe -c0 -u && /bin/chmod 666 /dev/nvidia-uvm*'"

Reboot

Check that the drivers are running

nvidia-smi

Edit the conf container you want to passthrough too

nano /etc/pve/lxc/(YOURCONTAINERID).conf

Add these lines but make sure the path (numbers) are correct

ls -l /dev/nv*

Allow cgroup access
lxc.cgroup2.devices.allow = c 195:0 rw
lxc.cgroup2.devices.allow = c 195:255 rw
lxc.cgroup2.devices.allow = c 195:254 rw
lxc.cgroup2.devices.allow = c 509:0 rw
lxc.cgroup2.devices.allow = c 509:1 rw
lxc.cgroup2.devices.allow = c 10:144 rw

Pass through device files
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-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/nvram dev/nvram none bind,optional,create=file

Start the container

apt update && apt upgrade -y

Download Drivers in the container this time

wget (YOURDRIVERS)

Nvidia driver site: https://www.nvidia.com/Download/index...

Make driver file executable

chmod +x (YOURDRIVERFILE)

Run the drivers file with the extension

./(YOURDRIVERFILE) --no-kernel-module

Reboot

nvidia-smi

Install Plex

wget https://downloads.plex.tv/plex-media-...

dpkg -i plexmediaserver*.deb

systemctl enable plexmediaserver.service

systemctl start plexmediaserver.service

Access Plex

(YOURIPADDRESS):32400/web

Number of transcodes for your card: https://developer.nvidia.com/video-en...

Quadro K620 Specs: https://www.techpowerup.com/gpu-specs....

Ebay seller I used: https://www.ebay.com/itm/373781310061

Level1Tech article and youtube channel:

Article: https://theorangeone.net/posts/lxc-nv...

Youtube Channel:    / level1techs  


#loresdiy

My Channel:    / loresdiy  


Watch video Passing a GPU through to a Proxmox container online without registration, duration hours minute second in high quality. This video was added by user LoRes DIY 13 March 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 34,420 once and liked it 693 people.