It is quite tricky to get Plex hardware transcoding working on OMV in a docker container with nvidia graphics cards.
It took me some weeks to find out all the little details and I want to share it with you.
My configuration is tested for:
- Debian 10 Buster (wich is OMV5)
- OMV 5.6.1-1 Usul
- Kernel Linux 5.10.0-0.bpo.3-amd64
- Docker 5:20.10.5~3-0~debian-buster
- Portainer 2.1.1
- Nvidia driver 460.39
- Cuda Version 11.2
- Nvidia Quadro P1000 graphics card
- Plex 184.108.40.20645
First of all and very important:
Hardware transcoding must work on the intel hardware ! There are several tutorials for that. Mainly it is related to access rights like the "noexex" to "exec" option in the fstab.
if you already tried to install nvidia driver: purge it out !
prepare your header files. Very important !
Step 3: installing Nvidia Driver
follow the instructions given by Nvidia:
Add buster-backports to your /etc/apt/sources.list , for example:
watch the messages during intallation. It there are any error messages something is wrong and you might not have debian buster with backports ! You have to solve this issue first before proceeding !!!
now we have to configure nvidia:
Since Docker 220.127.116.11 (I think) there was a change how docker gets access to hardware via cgroups. You need this workaround in the kernel boot parameters:
now reboot and the nvidia driver should already work.
Step 4: Install Nvidia container toolkit
Follow the Installation guide by Nvidia:
Install curl if you don't have it already:
stable repository and the GPG key:
<span style="font-size: 10pt;">nvidia-docker2</span>
package (and dependencies) after updating the package listing:
Now install Nvidia encode library and nvidia-smi:
Step 5: install Nvidia container runtime:
Step 6: some modifications:
Change/edit the Daemon configuration file
Step 7: starting Plex (in Portainer)
in Portainer you have to add the following parameters in the "Env" tab:
and in the tab "Runtime & Ressources":
change the "Runtime" Value from runc to nvidia !!!
No Privileged mode and no Init set.
Step 8: try and error:
this is how it worked for me. If you want to check operation you can display GPU load with:
You can also try/use the docker command line interface (cli) to start Plex:
Step 9: get rid of the session limit:
If you want to disable the session limit (my P1000 had a limit of 3) go ahead with this link. It worked for me also:
if you don't have git, install it:
Patch the nvidia driver:
If you want to rollback:
Step 10: Nvidia Power Management:
You need these modifications if you are using autoshutdown as the nvidia driver (or the pci-bus of the card?) is falling of if restarting from hibernate or suspend mode !
You can read more about that in the nvidia documentation:
First of all you need the dedicated nvidia scripts for power management and you have to find them in the nvidia driver install package:
Download the nvidia install package from:
or for the 460 driver the direct link:
Or on the system:
Now do not install the driver (!) - just extract it:
In the next step you have to search for the following files and copy them to the given directories (I used an ssh client for this)
then enable the services:
change nvidia kernel config:
now make nvidia-sleep.sh executable and update modules:
I still use the script files from the 450 driver version and they still work with 460. So I think they are more general and not driver specific. But if you experience problems
with hardware transcoding on a new driver version after a resume maybe you have to extract them fresh from the new driver package.
And I don't know if this final part is really needed, but if you still have issues with resume from suspend you can try to disable active state power management on pcie:
Change/add kernel parameter pcie_aspm=off in /etc/default/grub to:
and after changing grub:
That was a long way
Please let me know if there are still issues with htis guide. I'll try to keep it up to date...