nVidia Hardware Acceleration Error in Plex

Hello All,
I can’t get hardware acceleration going on the plex container. I’m re-building my setup with different hardware using a Cuadro P4000.

Error I get in the plex console:

[Req#4358/Transcode] [FFMPEG] - cu->cuInit(0) failed
[Req#4358/Transcode] [FFMPEG] - -> CUDA_ERROR_UNKNOWN: unknown error
[Req#4358/Transcode] [FFMPEG] -

Here is my docker compose file. The docker container can see the GPU, confirmed using nvidia-smi:

  plex:
    image: linuxserver/plex:latest #1.19.5.3112-b23ab3896-ls114
    security_opt:
      - no-new-privileges:true
    restart: unless-stopped
    networks:
      t2_proxy:
        ipv4_address: 192.168.50.99 # You can specify a static IP
    # deploy:                       # Tested deploy by itself. Does not pass the GPU to the Plex container.
      # resources:
        # reservations:
          # devices:
            # - driver: nvidia 
              # capabilities: [gpu]
    ports:
      - "32400:32400/tcp"
      - "3005:3005/tcp"
      - "8324:8324/tcp"
      - "32469:32469/tcp"
      - "1900:1900/udp"
      - "32410:32410/udp"
      - "32412:32412/udp"
      - "32413:32413/udp"
      - "32414:32414/udp"
      - "33400:33400" # If you use Plex Web Tools
    runtime: nvidia
    devices:
      - /dev/dri:/dev/dri # for hardware transcoding
    volumes:
      - $DOCKERDIR/appdata/plex:/config
      - $DOWNLOADSDIR:/downloads
      - $DATADIR/Media:/media
      # - $DATADIR2/media:/media2
      - /dev/shm:/transcode
    environment:
      TZ: $TZ
      HOSTNAME: "Plex"
      VERSION: latest # 1.19.5.3112-b23ab3896
      PLEX_UID: $PUID
      PLEX_GID: $PGID
      NVIDIA_VISIBLE_DEVICES: all
      NVIDIA_DRIVER_CAPABILITIES: compute,video,utility

Output of the nvidia-smi command.

±----------------------------------------------------------------------------+
| NVIDIA-SMI 390.157 Driver Version: 390.157 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Quadro 4000 Off | 00000000:08:00.0 Off | N/A |
| 40% 41C P0 N/A / N/A | 0MiB / 1983MiB | 0% Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
±----------------------------------------------------------------------------+

The recommended driver version for the Cuadro P4000 is nvidia-390. I tried using an older version of the plex media server as well, to rule out compatibility issues. I get the same error.

Also tried installing higher versions of the nvidia driver. But if I install anything higher than 390 the computer would not boot.

I’m using Ubuntu 22.04

x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
5.15.0-89-generic

Any help will be appreciated!

You have the important part commented out.

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

And in my config I don’t use this bit personally

    runtime: nvidia
    devices:
      - /dev/dri:/dev/dri # for hardware transcoding

the runtime is required unless you set it globally, but the dri bit is for intel transcoding, not nvidia. I think the OP didn’t read the instructions closely, but removing that bit and uncommenting what you told them to, should get them working, assuming there are no host issues or if the OP forgot to deploy the nvidia container.

Hey @aflextwin, thanks for your comments!

I commented it out because it didn’t work for me. If I use “runtime”, then I can see the nVidia card in the container, by using nvidia-smi. If I use the part I commented, then I can’t see the GPU with nvidia-smi. In both cases, I can’t get the hardware transcoder going. Anyhow, I tested with the configuration you recommeded, and I get a different error in the plex media server.

DEBUG - [Req#48b/Transcode] Codecs: testing h264_vaapi (encoder)
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: testing API vaapi for device '' ()
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
DEBUG - [Req#48b/Transcode] Could not create hardware context for h264_vaapi
DEBUG - [Req#48b/Transcode] Codecs: testing h264_nvenc (encoder)
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: testing API nvenc for device '' ()
ERROR - [Req#48b/Transcode] [FFMPEG] - Cannot load libcuda.so.1
ERROR - [Req#48b/Transcode] [FFMPEG] - Could not dynamically load CUDA
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Operation not permitted
DEBUG - [Req#48b/Transcode] Could not create hardware context for h264_nvenc
DEBUG - [Req#48b/Transcode] Codecs: testing hevc (decoder) with hwdevice vaapi
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: testing API vaapi for device '' ()
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
DEBUG - [Req#48b/Transcode] Could not create hardware context for hevc
DEBUG - [Req#48b/Transcode] Codecs: testing hevc (decoder) with hwdevice nvdec
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: testing API nvdec for device '' ()
ERROR - [Req#48b/Transcode] [FFMPEG] - Cannot load libcuda.so.1
ERROR - [Req#48b/Transcode] [FFMPEG] - Could not dynamically load CUDA
DEBUG - [Req#48b/Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Operation not permitted
DEBUG - [Req#48b/Transcode] Could not create hardware context for hevc```

Looks like CUDA is missing from what the logs are saying. Did you make sure to follow the prerequisites? Runtime options with Memory, CPUs, and GPUs | Docker Docs

You mentioned re-building your setup. Can you provide more specifics? It might help determine where your issue originates.

Also where did you determine that 390 is the recommended driver? Why would it not be the latest?

I’m using a P600 on very recent drivers and this is what my output looks like:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.147.05   Driver Version: 525.147.05   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro P600         Off  | 00000000:00:10.0 Off |                  N/A |
| 37%   50C    P8    N/A /  40W |      4MiB /  2048MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Hello @aflextwin The prerequisites did the trick, thanks!!

The driver version is what is recommended by Ubuntu sudo ubuntu-drivers install, when I tried to use driver more recent than those, my computer would not boot. The 390 would be the only one where I can get the PC to boot.

1 Like

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