[Ubuntu] [Docker] Need help with Nvidia hardware acceleration in Jellyfin
from LazerDickMcCheese@sh.itjust.works to selfhosted@lemmy.world on 15 Feb 15:58
https://sh.itjust.works/post/55397111

Does anyone have a compose.yaml for an Nvidia GPU that works that they would like to share? Here’s my current file, it gives a white screen with “server error” on it: pastebin.com/AaV17cTz

I went through Jellyfin’s instructions on setting a GPU up, but the instructions weren’t clear (in my opinion) so who knows if it’s correct. I installed some Nvidia tools as a prerequisite and ‘nvidia-smi’ shows the card. I attached my Jellyfin settings from before it self-destructed according to Nvidia’s transcoding matrix (which also wasn’t descriptive enough in my opinion), do they look right for a 2080?

Update: after making this post, and changing nothing, it suddenly works

#selfhosted

threaded - newest

LadyMeow@lemmy.blahaj.zone on 15 Feb 19:46 next collapse

Here are some relevant stuff, also have nvidia drivers and vids libs installed.

Running in a podman quadlet on fedora

After=nvidia-cdi-generator

[Container]

Image=docker.io/jellyfin/jellyfin

PodmanArgs=–privileged --gpus=all

Environment=NVIDIA_VISIBLE_DEVICES=all

AddDevice=/dev/dri/card0:/dev/dri/card0

jia_tan@lemmy.blahaj.zone on 15 Feb 16:10 next collapse

I have an intel igpu. It was hella painful to pass through the guy into a normal container and I never figured it out. I just ended up running the container with the —privileged flag. QuickSync hwaccel works fine now, I assume it would be the same for NVENC, since the flag basically just passes everything to the container.

Lemmchen@feddit.org on 16 Feb 03:49 next collapse

Huh? I have an ARC A380 and I just followed the tutorial. AFAICT everything’s working fine.

jellyfin.org/docs/general/post-install/…/intel#co…

ohshit604@sh.itjust.works on 16 Feb 11:38 collapse

Jellyfin isn’t the most secure piece of software out there, I would avoid giving it permissions it doesn’t need.


Step 1) Check /dev/dri for the GPU

user@debian:~/compose$ ls /dev/dri
total 0
drwxr-xr-x  3 root root        120 Jan 25 11:50 .
drwxr-xr-x 18 root root       3360 Feb 11 03:03 ..
drwxr-xr-x  2 root root        100 Jan 25 11:50 by-path
crw-rw----  1 root video  226,   0 Jan 25 11:50 card0
crw-rw----  1 root video  226,   1 Jan 25 16:39 card1
crw-rw----  1 root render 226, 128 Jan 25 11:50 renderD128

Documentation indicates renderDXXX typically refers to Intel GPU’s

Make sure at least one renderD* device exists in /dev/dri. Otherwise upgrade your kernel or enable the iGPU in the BIOS.

  1. Edit your docker-compose.yaml and add this In your Jellyfin block
devices:
 - /dev/dri/renderD128:/dev/dri/renderD128
  1. Start your container and enter it to verify the device is recognized.

sudo docker compose up -d; sudo docker exec -it jellyfin bash

Once inside ls /dev/dri to confirm the GPU is recognized inside the container, once you confirm it then you can exit the container.

user@debian:~/compose$ sudo docker exec -it jellyfin bash
I have no name!@jellyfin:/$ ls /dev/dri
renderD128
I have no name!@jellyfin:/$ exit
exit
user@debian:~/compose$
  1. On the Jellyfin dashboard go to the hardware acceleration page and follow the notes left by Jellyfin devs.

<img alt="" src="https://sh.itjust.works/pictrs/image/9d0f6573-4286-457f-8fc6-3215e922914e.jpeg">

[deleted] on 16 Feb 03:55 next collapse

.

the_shwa@programming.dev on 15 Feb 18:29 next collapse

This works for me, rtx 4060

   jellyfin:
     image: jellyfin/jellyfin:latest
     container_name: jellyfin
     user: 108:114
     network_mode: 'host'
     environment:
       - JELLYFIN_CACHE_DIR=/var/cache/jellyfin
       - JELLYFIN_CONFIG_DIR=/etc/jellyfin
       - JELLYFIN_DATA_DIR=/var/lib/jellyfin
       - JELLYFIN_LOG_DIR=/var/log/jellyfin
       - JELLYFIN_PublishedServerUrl=URL_REDACTED
       - NVIDIA_DRIVER_CAPABILITIES=all
       - NVIDIA_VISIBLE_DEVICES=all
     volumes:
       - /etc/jellyfin:/etc/jellyfin
       - /mnt/driveF/jellyfin/cache:/var/cache/jellyfin
       - /mnt/driveF/jellyfin/data:/var/lib/jellyfin
       - /mnt/driveF/jellyfin/log:/var/log/jellyfin
       - /mnt/Movies:/movies
       - /mnt/TV:/tv
       - /mnt/Music:/music
     runtime: nvidia
     deploy:
       resources:
         reservations:
           devices:
             - driver: nvidia
               count: all
               capabilities: [gpu]
     restart: 'unless-stopped'
     extra_hosts:
       - "host.docker.internal:host-gateway"
antsu@discuss.tchncs.de on 16 Feb 06:13 next collapse

I had the same problem: Debian host + official Jellyfin Docker image, all set up according to the official guide, but it would fail to transcode anything.

There was no relevant information about what was wrong in the logs so what I did was:

  • Copy the ffmpeg command from the logs.
  • docker exec -it into the Jellyfin container.
  • run the same ffmpeg command manually so I could see the error directly.

Long story short, because the Nvidia toolkit uses the driver/libraries from the host, the error was that I was missing the library libnvidia-encode1 on the host. After installing that, everything works as it should.

HybridSarcasm@lemmy.world on 15 Feb 16:07 collapse

The biggest concern here would be 1) have you installed the Nvidia container toolkit, and 2) how are you passing the GPU into the Jellyfin docker container.

I’ve got an Ansible-playbook that takes care of the Nvidia stuff. I’ve also got a compose file I can share. Will edit this post when I can provide a link.

LazerDickMcCheese@sh.itjust.works on 15 Feb 16:12 collapse

  1. yes
  2. in my compose file, I’ve set the extra variables that (supposedly) pass the GPU according to Jellyfin’s instructions
Kushan@lemmy.world on 16 Feb 07:52 collapse

In your compose file, make sure you’ve added runtime: nvidia.

You also don’t need to deploy the resources and reserve the GPU, you can remove the entire deploy section when using the nvidia runtime.