Finally got around to fixing hardware acceleration on the plex container running in my proxmox server. These instructions work for Proxmox 8 and plex running in an unprivileged lxc container on debian (distribution should not matter, but I’m using Debian in the container).
To make hardware acceleration work, we need to accomplish two things:
- Pass the hardware rendering device to the container with appropriate privileges
- Allow mapping of plex group in the container to a group in the host that has access to the device
For the second, the “render” group is what you want. This excellent gist has all the steps you need to follow in order to set this up. I took the step of doing what one of the comments in the gist suggested – namely, mapping the render group in the plex container to the render group in the host, instead of mapping the plex group in the plex container to the render group in the host. You will need the following information to get hardware acceleration in your unprivileged plex container:
- Group ID of “render” group in the plex container
- Group ID of “render” group in the host
Then you need to do the following:
- Allow remapping of the “render” group in the host in containers – add the render group ID to
/etc/subgid
- Update the plex container configuration in proxmox to setup the remapping of the container “render” group to host “render” group. Edit
/etc/pve/nodes/server/lxc/container.conf
and add these lines where 106 is the group ID of “render” group in the container and “104” is the group ID of render in the host. The last line should start from lxc “render” group ID + 1 and the second number (65429) is basically 65535 – 107:
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 106
lxc.idmap: g 106 104 1
lxc.idmap: g 107 100107 65429
- Finally, we need to pass the render device to the container and mount it, give permissions for the container to use the device. Add these lines to
/etc/pve/nodes/server/lxc/container.conf
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0 0
Where 228:128 come from the output of ls -la /dev/dri
on the host – check the two numbers listed for the render*
device and /dev/dri/renderD128
is the device that we are going to use for hardware acceleration which we find through ls -la /dev/dri
as well.
- Reboot the plex container and you should be using hardware acceleration for transcoding. You can check this by playing something that requires transcoding on another device and checking the plex web dashboard, expanding the playback details and see if you see Transcode (hw)