Need help getting HW transcoding to work: /dev/dri is there but no being used

Server Version#: 1.20.2
Player Version#: 8.72.20952

I deployed Plex server via Docker using the official image: plexinc/pms-docker 1.20.2.3402-0fec14d92. I mapped /dev/dri from the host to the container. The container starts up like

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
s6-chown: fatal: unable to chown /var/run/s6/etc/cont-init.d/41-plex-preferences: Read-only file system
s6-chmod: fatal: unable to change mode of /var/run/s6/etc/cont-init.d/41-plex-preferences: Read-only file system
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 40-plex-first-run: executing...
Attempting to obtain server token from claim token
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Plex Media Server first run setup complete
[cont-init.d] 40-plex-first-run: exited 0.
[cont-init.d] 41-plex-preferences: executing...
Plex Media Server preferences update run complete
[cont-init.d] 41-plex-preferences: exited 0.
[cont-init.d] 45-plex-hw-transcode-and-connected-tuner: executing...
[cont-init.d] 45-plex-hw-transcode-and-connected-tuner: exited 0.
[cont-init.d] 50-plex-update: executing...
[cont-init.d] 50-plex-update: exited 0.
[cont-init.d] done.
[services.d] starting services
Starting Plex Media Server.
[services.d] done.

I went into the config and ticked the checkbox “Use hardware acceleration when available” and started playing a video. Checking the dashboard, I can see that hw accelleration is not being used:

Screenshot 2020-10-20 at 11.02.13

There’s no “(hw)” next to “Transcode”.

In the container /dev/dri looks like this:

ls -l /dev/dri
total 0
drwxr-xr-x 2 root root         80 Oct 19 21:03 by-path
crw-rw---- 1 root video  226,   0 Oct 19 21:03 card0
crw-rw---- 1 root video2 226, 128 Oct 19 21:03 renderD128

This is where my troubleshooting skills end. Can someone chime in?

I see you have groups video and video2 ??

Which PGID are you using for PMS to run with?
Is it the GID of the group (which should be video – not video2)

Also, are you manually forcing the GID to video2 ?
What’s shown here is not how Linux does by default.

Thanks for you reply! I gathered some more information to give insight into what’s configured and to answer you questions:

On the host:

root@ratchet:~# ls -ln /dev/dri
total 0
drwxr-xr-x 2 0   0       80 Oct 20 20:48 by-path
crw-rw---- 1 0  44 226,   0 Oct 20 20:48 card0
crw-rw---- 1 0 107 226, 128 Oct 20 20:48 renderD128
root@ratchet:~# cat /etc/group | grep video
video:x:44:mewald
root@ratchet:~# cat /etc/group | grep render
render:x:107:
root@ratchet:~#

In the container:

root@plex-5f9b496fd7-mkgwp:/# ls -l /dev/dri
total 0
drwxr-xr-x 2 root root         80 Oct 20 20:48 by-path
crw-rw---- 1 root video  226,   0 Oct 20 20:48 card0
crw-rw---- 1 root video2 226, 128 Oct 20 20:48 renderD128
root@plex-5f9b496fd7-mkgwp:/# cat /etc/group | grep video
video:x:44:plex
video2:x:107:plex
root@plex-5f9b496fd7-mkgwp:/# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0    204     4 ?        Ss   Oct20   0:00 s6-svscan -t0 /var/run/s6/services
root        31  0.0  0.0    208     4 ?        S    Oct20   0:00 s6-supervise s6-fdholderd
root       283  0.0  0.0    208     4 ?        S    Oct20   0:00 s6-supervise plex
plex       286  0.0  0.0   4508   760 ?        Ss   Oct20   0:00 /bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver:/usr/lib/plexmediaserver/lib /usr/lib/plexmediaserver/Plex\ Media\ Server
plex       304  0.3  0.6 2160392 200192 ?      Sl   Oct20   2:08 /usr/lib/plexmediaserver/Plex Media Server
plex       319  0.1  0.1 1792792 54188 ?       SNl  Oct20   1:20 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources/Versions/2/Python/boots
plex       369  0.0  0.0 435488 15904 ?        Sl   Oct20   0:01 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/lib/plexmediaserver/Resources/Tuner/Shared 1.20.2
root       501  0.0  0.0  19976  3672 pts/0    Ss   08:20   0:00 bash
root       515  0.0  0.0  36132  3236 pts/0    R+   08:23   0:00 ps aux
root@plex-5f9b496fd7-mkgwp:/#

Plex runs as the user “plex” who is member of groups “video” and “video2”. The “video2” groups does not exist on the host, but is created by this script which is executed when the container start up: https://github.com/plexinc/pms-docker/blob/master/root/etc/cont-init.d/45-plex-hw-transcode-and-connected-tuner

So I believe the plex process should have “rw” access to those files.

Thanks for that. Everything does map correctly for the GID.

Now your logs will be needed to see what PMS is doing.

  1. Verify DEBUG logging only (not VERBOSE)
  2. Start a playback which should HW transcode
  3. Play 30 seconds
  4. Stop
  5. Wait 30 for logs to flush
  6. Download Logs
  7. Attach ZIP

Plex Media Server Logs_2020-10-22_08-19-30.zip (1.4 MB)

Thx

Last checks, which I think are going to point out the problem.

On all systems I’ve seen so far, card0 and renderD128 are always in the same group. I’ve never seen it initialize differently.

What are the PUID and PGID you are using?
When you grep /etc/group for that PGID value, which username(s) show up?
Can you back track and close the loop to confirm the PUID is a member of the group?

(the PUID user has to be a member of the group which has ownership)

Which OS distro and version are you using?

Lastly, to confirm (partial repeat),
please ls -la /dev/dri from within the container and from the main host terminal window.

Ok, so this is the container I am using: plexinc/pms-docker:1.20.2.3402-0fec14d92 And is allows environment variables PLEX_UID and PLEX_GID (I think that’s what you mean by PUID/PGID, right?) The environment variables are not set in the container:

root@plex-f75f87976-645m4:/# env | grep PLEX_UID
root@plex-f75f87976-645m4:/# env | grep PLEX_GID
root@plex-f75f87976-645m4:/#

So I can get the UID/GID via the PID:

root@plex-f75f87976-645m4:/# ps auxn
    USER   PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
       0     1  0.0  0.0    204     4 ?        Ss   21:24   0:00 s6-svscan -t0 /var/run/s6/services
       0    31  0.0  0.0    208     4 ?        S    21:24   0:00 s6-supervise s6-fdholderd
       0   297  0.0  0.0    208     4 ?        S    21:24   0:00 s6-supervise plex
    1000   300  0.0  0.0   4508   696 ?        Ss   21:24   0:00 /bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver:/usr/lib/plexmediaserver/lib /usr/lib/plexmediaserver/Plex\ Media\ Server
    1000   318  2.5  0.7 4150728 250636 ?      Sl   21:24   0:18 /usr/lib/plexmediaserver/Plex Media Server
    1000   331  0.3  0.1 2783772 55212 ?       SNl  21:24   0:02 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources/Versions/2/Py
    1000   381  0.0  0.0 435496 15732 ?        Sl   21:24   0:00 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/lib/plexmediaserver/Resources/Tuner/Sha
    1000   408  0.1  0.1 946688 34876 ?        Sl   21:24   0:00 Plex Plug-in [tv.plex.agents.movie] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources/Versions/2/
    1000   469  0.1  0.1 948212 36752 ?        Sl   21:24   0:00 Plex Plug-in [com.plexapp.agents.opensubtitles] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources
    1000   471  0.1  0.1 956728 44984 ?        Sl   21:24   0:01 Plex Plug-in [com.plexapp.agents.thetvdb] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources/Versi
    1000   477  0.1  0.1 947904 36076 ?        Sl   21:24   0:00 Plex Plug-in [tv.plex.agents.music] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources/Versions/2/
    1000   634  0.1  0.1 946684 35148 ?        Sl   21:24   0:00 Plex Plug-in [org.musicbrainz.agents.music] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources/Ver
    1000   701  0.1  0.1 957764 50772 ?        Sl   21:24   0:01 Plex Plug-in [com.plexapp.agents.imdb] /usr/lib/plexmediaserver/Resources/Plug-ins-0fec14d92/Framework.bundle/Contents/Resources/Versions
       0  1541  0.0  0.0  19980  3712 pts/0    Ss   21:34   0:00 bash
    1000  1692  2.4  0.1 249484 53232 ?        Rl   21:36   0:00 /usr/lib/plexmediaserver/Plex Media Scanner --analyze --log-file-suffix  Analysis --no-thumbs --item 823
       0  1702  0.0  0.0  36132  3168 pts/0    R+   21:36   0:00 ps auxn
root@plex-f75f87976-645m4:/# egrep "^(U|G)id" /proc/300/status
Uid:	1000	1000	1000	1000
Gid:	1000	1000	1000	1000
root@plex-f75f87976-645m4:/#

Cross-referencing that with /etc/passwd and /etc/group:

root@plex-f75f87976-645m4:/# cat /etc/group | grep 1000
plex:x:1000:
root@plex-f75f87976-645m4:/# cat /etc/passwd | grep 1000
plex:x:1000:1000::/config:/bin/false
root@plex-f75f87976-645m4:/#

Checking members of groups that own /dev/dri/card0 and renderD128

root@plex-f75f87976-645m4:/# ls -l /dev/dri
total 0
drwxr-xr-x 2 root root         80 Oct 22 19:01 by-path
crw-rw---- 1 root video  226,   0 Oct 22 19:01 card0
crw-rw---- 1 root video2 226, 128 Oct 22 19:01 renderD128
root@plex-f75f87976-645m4:/# cat /etc/group | grep video
video:x:44:plex
video2:x:107:plex
root@plex-f75f87976-645m4:/#

I think that confirms, that the user who runs plex also owns the the 2 devices.

Distro? The container runs on Ubuntu 16.04 (pms-docker/Dockerfile at master · plexinc/pms-docker · GitHub). The host is Debian 10.

And finally the ls on the host:

root@ratchet:~# ls -la /dev/dri
total 0
drwxr-xr-x  3 root root        100 Oct 22 19:01 .
drwxr-xr-x 16 root root       3220 Oct 22 19:01 ..
drwxr-xr-x  2 root root         80 Oct 22 19:01 by-path
crw-rw----  1 root video  226,   0 Oct 22 19:01 card0
crw-rw----  1 root render 226, 128 Oct 22 19:01 renderD128
root@ratchet:~#

To me all of this looks good :smiley: But I hope I am wrong.

1 Like

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