How to install Nvidia HW transcoding support for Proxmox 6.2-1 LXC install

When I try and run the command “sh -c -f /dev/nvidia-uvm” in my unprivileged container, I get the following error:

root@plex:~# sh -c -f /dev/nvidia-uvm
sh: 1: /dev/nvidia-uvm: Permission denied

Also, I have previously installed the nvidia driver in the LXC container due to following the previous guides. Is it possible this is causing an issue?

Hardware encoding is working for me using the following lines added to my config:

lxc.hook.pre-start: sh -c ‘chown :100000 /dev/nvidia*’
lxc.environment: NVIDIA_VISIBLE_DEVICES=all
lxc.environment: NVIDIA_DRIVER_CAPABILITIES=all
lxc.hook.mount: /usr/share/lxc/hooks/nvidia

2020-10-29_13-18-14

[ ! -f /dev/nvidia-uvm ] && /usr/bin/nvidia-modprobe -c0 -u
is the command you need to run outside of your config but inside config it should be
lxc.hook.pre-start: sh -c ‘[ ! -f /dev/nvidia-uvm ] && /usr/bin/nvidia-modprobe -c0 -u’
or
sh -c ‘[ ! -f /dev/nvidia-uvm ] && /usr/bin/nvidia-modprobe -c0 -u’

you can not run that command in the container itself it is meant for proxmox system shell that line of code is only looking for a device in the /dev/ location nvidia-uvm if it finds it does nothing if it is missing it runs /usr/bin/nvidia-modprobe -c0 -u to add missing /dev/

it my not be required if you hardware encoding it working without driver changes and container runtimes must have been updated remove if necessary.

you might be able to also remove the last line in config that changes ownership of /dev/nvidia* folder as it was once need you should only need LXC.Environment Variables

i have not full updated my readme on github up or in this forum. to reflect most recent changes

you could try and run the chown command on proxmox before you run CT with commands in config

my most uptodate scripts are on my github site they are tested to work this is a fully automated script that will download 455.28 or the latest version of nvidia drivers

Update Proxmox

commands

apt-get update && apt-get upgrade -qqy

Driver install NVidia

Commands

wget -qLO - https://raw.githubusercontent.com/Saberwolf64/Proxmox-Nvidia-LXC-/proxmox-6.2-1-ubunutu-contributor-Whiskerz007/Nvidia-driver-setup.sh

this will create a temp folder to downloads nvidia drivers from nvidia website it will remove and blacklist nouveau drivers it will install NVidia Persistenced from nvidia driver package install not from repo it will install nvidia container runtime from nvidia’s github page

Create lxc download install plex and nvtop

Commands

wget -qLO - https://raw.githubusercontent.com/Saberwolf64/Proxmox-Nvidia-LXC-/proxmox-6.2-1-ubunutu-contributor-Whiskerz007/LXC_configure.sh

this will download a ubuntu 20.04 and create a new LXC CT and configure it to a basic setup of unlimited cpus 4096 memory dhcp networking and 8 gig hard drive space. it will install NVtop and the latest Plex version from plex repos i suggest you use NVtop to check your gpu loads from inside the LXC instead of nvidia-smi

if you have any further question or suggestion please if it is related to my scripts please post on my github errors or issues your having so i can track and fix them if you are doing a new install of proxmox i suggest you run

Commands

wget -qLO - https://raw.githubusercontent.com/Saberwolf64/Proxmox-Nvidia-LXC-/proxmox-6.2-1-ubunutu-contributor-Whiskerz007/6.2-1.sh

this is an automated script from a fresh install of proxmox it will remove the UI NAg and every thing above.

So in case anyone was scratching their head trying to get this to work on an existing container that you have NFS mounts set up for - a reminder that you can’t run the nvidia hook script on a privileged container. If your container set up as privileged to be able to mount an NFS share, this method will not work to my knowledge. There may be a workaround, but I don’t know it.

TL;DR: I should have read the thread more closely.

When running your automated script (thanks a lot for all the work), I get an error when it tries to start

Script exec /usr/share/lxc/hooks/lxc-pve-poststop-hook 100 lxc post-stop produced output: command 'umount --
 /var/lib/lxc/.pve-staged-mounts/mp0' failed: exit code 32

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.