Plex HW acceleration in LXC container - anyone with success?

its a p2000 inside a r620 poweredge. running proxmox and centos 7 lxe.
yes they are listing the same. any suggestion to whay to check?

anyone?

Hello everyone. Im having a strange issue. Or maybe its normal. I finally got my gpu pass through to work well with advice of this page so thank you all very much.
The problem I am having is transcode works flawlessly, cpu use is a little high on 6 cores of a Ryzen 2700. 60% or so. The other issue well the real one is I noticed the gpu isn’t being utilized for encoding or decoding when I am doing dvr recording jobs. Is this normal? I checked usage on the host with nvidia-smi. Also on the lxc client. Any advice?

you need to check you host mechine for a few folders the folders only get created when you lunch nvidia-smi and a few other commands so promox and and nvidia have created scripts to automate this process

I’ve been at loss lately as to why it’s not starting hardware encoding sessions so I went digging through logs like you did.

My installer log says it found transcode HW, however, when I go to start a transcode session, it says that it could not find a hardware accelerated decoder just like in your logs.

I may have gone a bit overboard with the number of things I included, but no dice on any of them.

Running proxmox 6.2-12 with NVIDIA 450.x and PMC 1.20.x

Config below:

lxc.cgroup.devices.allow: c 194:* rwm
lxc.cgroup.devices.allow: c 195:* rwm
lxc.cgroup.devices.allow: c 226:* rwm
lxc.cgroup.devices.allow: c 226:* rwm
lxc.cgroup.devices.allow: c 235:* rwm
lxc.cgroup.devices.allow: c 236:* rwm
lxc.cgroup.devices.allow: c 510:* rwm
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
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/nvidia-cap1 dev/nvidia-caps/nvidia-caps1 none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-caps/nvidia-cap2 dev/nvidia-caps/nvidia-caps2 none bind,optional,create=file
lxc.mount.entry: /dev/dri/card0 dev/dri/card0 none bind,optional,create=file
lxc.mount.entry: /dev/dri/card1 dev/dri/card1 none bind,optional,create=file
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
lxc.mount.entry: /dev/dri/renderD129 dev/dri/renderD129 none bind,optional,create=file

Anyone have any ideas?
I saw @saberwolf has published a new guide that goes back to the old hook method.
Is that method more reliable now than this one?

Thanks everyone!

i have created a new fix to my script check it out on github but for simply sake this work and you dont have to install drivers on LXC running Promox 6.2-1 ubuntu 20.X and NVIDIA 455.28
Saberwolf64 github page

script is a automation script it will patch Proxmox UI nag for updates and it will fully update proxmox using apt update && apt upgrade it will download the latest nvidia driver from nvidia’s website it will configure a new LXC ct update and install nvtop and it will configure lxc to pass drivers and apps to lxc for use.

I had everything working great following the guide from constiens until I upgraded my Proxmox host with apt upgrade. I then went through the guide one more time and now transcoding only works when selecting “Convert Automatically” in plex. If I manually select any other option the video fails to play.

check you permissions of your /dev/nvidia*
and repost

what might have happend it that you got a new kernel and you have to reinstall nvidia drivers any time you install new kernel you need to reinstall the nvidia drivers to rebuild modules

run these command
apt-get install -qqy pve-headers-uname -r
reboot
run the section of code just under # Install NVidia drivers
reboot
reboot lxc and update lxc reboot lxc

trans code working fine

after an update of kernel you must reboot server and reinstall pve-headers and nvidia drivers everything should work fine

i just ran the same update and setup my plex it working fine with transcode

I have done as you suggested. Transcoding will now only work on Convert Automatically and any bitrate above 3mbps. If I try lower resolution the file will not play.

Permissions for /dev/nvidia* are:
cr-------- 1 root root 241, 1 Nov 28 13:08 nvidia-cap1
cr–r--r-- 1 root root 241, 2 Nov 28 13:08 nvidia-cap2

It looks like you have permission issues permissions should look like the pic i am submitting the first set is the proxmox server and the second set are the lxc

Just reboot proxmox a couple time your dev dir should like mine.

It seems like kernel modules are not loading properly

I changed the permissions of nvidia-cap1 and nvidia-cap2 to 666 and transcoding is working as it should now. Wondering why nvidia-cap does not show up on your system and I have two?

Thank you for the assistance Saberwolf.

I am running a NVidia Quadro p2000 might be why. I have a different driver, you missed a step in your set up I might not have mention it but you must run a chown command before you start LXC if your having permission issues and pass pre-hook in your config to make is persistent

#configure LXC
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
cat <> $LXC_CONFIG
lxc.hook.pre-start: sh -c ‘[ ! -f /dev/nvidia-uvm ] && /usr/bin/nvidia-modprobe -c0 -u’
lxc.environment: NVIDIA_VISIBLE_DEVICES=all
lxc.environment: NVIDIA_DRIVER_CAPABILITIES=all
lxc.hook.mount: /usr/share/lxc/hooks/nvidia
lxc.hook.pre-start: sh -c ‘chown :100000 /dev/nvidia*’
EOF

is what i have set up in your config but you see the last line above EOF you must run chown command out of config in proxmox shell it should fix any further issues

check permissions on your /dev/Nvidia* and repost

Anyone else with integrated Intel gpu getting
‘/dev/fb0’: No such file or directory

Am I supposed to have /dev/fbo? I’ve followed the original tutorial but no dice on HW acceleration. Obviously, I am expert. Thanks.
prox-plex

Registering to help out. Not sure if you’re still looking to do this unprivileged or for anyone else that wants to do it, I was able to figure it out. I’m on Proxmox 6.3-2 running an Ubuntu 20.04 container on an Intel NUC 10 (NUC10i5FNK1).

Host Part 1

Install some drivers (not entirely sure you need vainfo, but I think you at least need the iris driver):

root@proxmox:~# apt install vainfo i965-va-driver

Get the render group id you need for mapping to the container:

root@proxmox:~# cat /etc/group | grep render
render:x:108:

You want to map it so add it to the /etc/subgid file:

root@proxmox:~# echo "root:108:1" >> /etc/subgid

LXC Part 1

Get the render group you need to map to the host:

root@plex:~# cat /etc/group | grep render
render:x:107:

Shut down the container since you need to edit some configs on the host and restart the container.

Host Part 2

Edit config:

vim /etc/pve/lxc/<id>.conf
  1. Mount the device and allow access
lxc.cgroup.devices.allow: c 226:128 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
  1. Map uids and guids:
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 107
lxc.idmap: g 107 108 1
lxc.idmap: g 108 100108 65428

First line is to map the uids so your container can access the network, apt, etc. Second line is to map the gids up till the mismatch for render group. Third line is mapping the render group. Fourth line maps the rest of the gids.

LXC Part 2

  1. Boot up the container and check the mappings worked, you should see the group associated with the device:
root@plex:~# ls -al /dev/dri/
total 0
drwxr-xr-x 2 root   root         60 Dec 12 20:14 .
drwxr-xr-x 6 root   root        480 Dec 12 20:14 ..
crw-rw---- 1 nobody render 226, 128 Dec  3 03:24 renderD128
  1. Install Plex Media Server
  2. Add the plex user to the render group:
root@plex:~# usermod -G render plex

Enjoy your hardware transcoding in your unprivileged container.

image

Hi there
I have successfully been running an lxc container on proxmox with hardware transcoding using this documentation PMS installation guide when using a Proxmox 5.1 LXC container
Recently, I discovered that tone mapping was available, yay ! Except that it seems that when tone mapping is needed, hw transcoding does not work with that configuration. Am I the only one? Has anyone figured how to adapt the configuration in order to have hardware tone mapping, assuming this is possible of course ?

so i am totally guessing but it might be the capabilities of your card but most of the issue i see with hardware transcoding are with permissions do an
ls -la /dev/nvidia* what are the output should look something like this

you have now in a sense created a privileged container when you map uids and gids to lxc witch is the same as creating a privileged container all security concern have just been by passed meaning your system has root privileges