linuxserver / docker-emby

GNU General Public License v3.0
120 stars 40 forks source link

VAAPI Failed to initialize on Ubuntu 20.04 (Or Nvidia GPU failed to show up in Emby?) #97

Closed quincarter closed 7 months ago

quincarter commented 7 months ago

Is there an existing issue for this?

Current Behavior

I'm on an amd64 based host system with Ubuntu 20.04. I have 2 SLI GTX 1080TI cards. Looks like nvidia-smi registers them properly on the host and the logs on the container look like the card permissions are okay.

The actual error occurs when trying to initialize the VA API within emby itself (just looking at all the logs)

See below for all the info I have.

nvidia-smi output

Screenshot_20240406-151256~2

/dev/dri in the container

Screenshot_20240406-151350~2

Container output stating permission are okay

Screenshot_20240406-151521~2

Actual error I see from the emby logs.

Screenshot_20240406-151754~2

Expected Behavior

The video cards should mount(?) and the VA API should initialize

Steps To Reproduce

  1. Run in an Ubuntu 20.04 host machine
  2. I have 2 Nvidia GTX 1080TI with the latest Nvidia driver. (553 I think). (I tried it with a downgraded driver too (535))
  3. Running the docker container using docker compose

I have used the Nvidia-ctk to set the runtime to docker. (Not sure if I did that correctly but found quite a few references that looked like I was - I followed the steps)

Environment

- OS: Ubuntu 20.04
- How docker service was installed:
docker compose

CPU architecture

x86-64

Docker creation

emby:
    image: lscr.io/linuxserver/emby:latest
    container_name: emby
   #  network_mode: host
    environment:
      - PUID=${EMBY_UID}
      - PGID=${EMBY_GID}
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
      - TZ=${TIMEZONE}
    volumes:
      - ./.containers/Emby:/config # Configuration directory
      - ./images/logowhite.png:/app/emby/system/dashboard-ui/modules/logoscreensaver/logowhite.png ## Uncomment and create your own logo in the image directory to customize your server
      - ./images/logowhite.png:/app/emby/system/dashboard-ui/modules/themes/logowhite.png ## Uncomment and create your own logo in the image directory to customize your server
      - ./images/logodark.png:/app/emby/system/dashboard-ui/modules/themes/logodark.png ## Uncomment and create your own logo in the image directory to customize your server
      - ${LOCAL_TV_PATH}:/media/Synology/Television # Media directory
      - ${LOCAL_MOVIES_PATH}:/media/Synology/Movies # Media directory
      - ${LOCAL_BACKUPS_PATH}:/media/Synology/Backups #Backups Directory
     #  - /ssl:/ssl # Add SSL Certs to this directory
      - /ssl/fullchain.pem:/ssl/fullchain.pem
      - /ssl/privkey.pem:/ssl/privkey.pem
      - /ssl/token:/ssl/token
    ports:
      - ${EMBY_HOST_PORT}:8096 #http port
      - ${EMBY_HOST_PORT_SSL}:8920 #ssl port
    runtime: nvidia # Expose NVIDIA GPUs if any (Apple Silicon does not use this)
    # network_mode: host # Enable DLNA and Wake-on-Lan
    devices:
      - /dev/dri:/dev/dri # VAAPI/NVDEC/NVENC render nodes
    #   - /dev/vchiq:/dev/vchiq # MMAL/OMX on Raspberry Pi
    #   - /dev/video10:/dev/video10 #optional other video cards
    #   - /dev/video11:/dev/video11 #optional
    #   - /dev/video12:/dev/video12 #optional
    restart: unless-stopped
    profiles:
      - emby

Container logs

➜  ~ docker logs emby                                                                     [migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────

**** adding /dev/dri/renderD128 to video group root with id 0 ****
**** permissions for /dev/dri/card1 are good ****
**** permissions for /dev/dri/card0 are good ****
**** permissions for /dev/dri/renderD129 are good ****
[custom-init] No custom files found, skipping...
Info Main: Application path: /app/emby/system/EmbyServer.dll
Info App: Setting default culture to en-US
Info Main: Emby
        Command line: /app/emby/system/EmbyServer.dll -programdata /config -ffdetect /app/emby/bin/ffdetect -ffmpeg /app/emby/bin/ffmpeg -ffprobe /app/emby/bin/ffprobe -restartexitcode 3
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: app/emby/system/System.Private.CoreLib.dll
        Processor count: 16
        Data path: /config
        Application path: /app/emby/system
Info Main: Logs path: /config/logs
Info Main: Cache path: /config/cache
Info Main: Internal metadata path: /config/metadata
Info App: Emby Server Version: 4.8.3.0
Info App: Loading assemblies
Info App: File /config/plugins/Emby.M3UTuner.dll has version 1.0.29.0
Info App: File /app/emby/system/plugins/Emby.M3UTuner.dll has version 1.0.28.0
Info App: File /config/plugins/Tvdb.dll has version 1.4.6.0
Info App: File /app/emby/system/plugins/Tvdb.dll has version 1.4.5.0
Info App: File /config/plugins/Emby.Server.CinemaMode.dll has version 1.0.47.0
Info App: File /app/emby/system/plugins/Emby.Server.CinemaMode.dll has version 1.0.47.0
Info App: File /config/plugins/Emby.PortMapper.dll has version 1.2.4.0
Info App: File /app/emby/system/plugins/Emby.PortMapper.dll has version 1.2.4.0
Info App: File /config/plugins/OMDb.dll has version 1.0.21.0
Info App: File /app/emby/system/plugins/OMDb.dll has version 1.0.21.0
Info App: File /config/plugins/StudioImages.dll has version 1.0.3.0
Info App: File /app/emby/system/plugins/StudioImages.dll has version 1.0.3.0
Info App: File /config/plugins/MusicBrainz.dll has version 1.0.22.0
Info App: File /app/emby/system/plugins/MusicBrainz.dll has version 1.0.22.0
Info App: File /config/plugins/Emby.Dlna.dll has version 1.3.8.0
Info App: File /app/emby/system/plugins/Emby.Dlna.dll has version 1.3.7.0
Info App: File /config/plugins/NfoMetadata.dll has version 1.0.80.0
Info App: File /app/emby/system/plugins/NfoMetadata.dll has version 1.0.80.0
Info App: File /config/plugins/Fanart.dll has version 1.0.16.0
Info App: File /app/emby/system/plugins/Fanart.dll has version 1.0.16.0
Info App: File /config/plugins/BlurayMounter.dll has version 1.0.2.0
Info App: File /app/emby/system/plugins/BlurayMounter.dll has version 1.0.2.0
Info App: File /config/plugins/DvdMounter.dll has version 1.0.0.0
Info App: File /app/emby/system/plugins/DvdMounter.dll has version 1.0.0.0
Info App: File /config/plugins/MovieDb.dll has version 1.7.4.0
Info App: File /app/emby/system/plugins/MovieDb.dll has version 1.7.4.0
Info App: File /config/plugins/MBBackup.dll has version 1.6.3.0
Info App: File /app/emby/system/plugins/MBBackup.dll has version 1.6.3.0
Info App: File /config/plugins/OpenSubtitles.dll has version 1.0.54.0
Info App: File /app/emby/system/plugins/OpenSubtitles.dll has version 1.0.53.0
Info App: File /config/plugins/AudioDb.dll has version 1.0.18.0
Info App: File /app/emby/system/plugins/AudioDb.dll has version 1.0.18.0
Info App: File /config/plugins/Emby.Webhooks.dll has version 1.0.35.0
Info App: File /app/emby/system/plugins/Emby.Webhooks.dll has version 1.0.35.0
Info App: File /config/plugins/Emby.XmlTV.dll has version 1.1.8.0
Info App: File /app/emby/system/plugins/Emby.XmlTV.dll has version 1.1.8.0
Info App: File /config/plugins/EmbyGuideData.dll has version 1.0.13.0
Info App: File /app/emby/system/plugins/EmbyGuideData.dll has version 1.0.13.0
Info App: Loading Emby.M3UTuner, Version=1.0.29.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Emby.M3UTuner.dll
Info App: Loading Tvdb, Version=1.4.6.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Tvdb.dll
Info App: Loading Emby.Server.CinemaMode, Version=1.0.47.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Emby.Server.CinemaMode.dll
Info App: Loading Trakt, Version=3.7.2.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Trakt.dll
Info App: Loading Emby.PortMapper, Version=1.2.4.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Emby.PortMapper.dll
Info App: Loading OMDb, Version=1.0.21.0, Culture=neutral, PublicKeyToken=null from /config/plugins/OMDb.dll
Info App: Loading MediaBrowser.Plugins.Trailers, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Mediabrowser.Plugins.Trailers.dll
Info App: Loading StudioImages, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null from /config/plugins/StudioImages.dll
Info App: Loading MusicBrainz, Version=1.0.22.0, Culture=neutral, PublicKeyToken=null from /config/plugins/MusicBrainz.dll
Info App: Loading Emby.Dlna, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Emby.Dlna.dll
Info App: Loading NfoMetadata, Version=1.0.80.0, Culture=neutral, PublicKeyToken=null from /config/plugins/NfoMetadata.dll
Info App: Loading Fanart, Version=1.0.16.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Fanart.dll
Info App: Loading BlurayMounter, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null from /config/plugins/BlurayMounter.dll
Info App: Loading DvdMounter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/DvdMounter.dll
Info App: Loading MovieDb, Version=1.7.4.0, Culture=neutral, PublicKeyToken=null from /config/plugins/MovieDb.dll
Info App: Loading MBBackup, Version=1.6.3.0, Culture=neutral, PublicKeyToken=null from /config/plugins/MBBackup.dll
Info App: Loading OpenSubtitles, Version=1.0.54.0, Culture=neutral, PublicKeyToken=null from /config/plugins/OpenSubtitles.dll
Info App: Loading AudioDb, Version=1.0.18.0, Culture=neutral, PublicKeyToken=null from /config/plugins/AudioDb.dll
Info App: Loading Emby.Webhooks, Version=1.0.35.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Emby.Webhooks.dll
Info App: Loading Emby.XmlTV, Version=1.1.8.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Emby.XmlTV.dll
Info App: Loading EmbyGuideData, Version=1.0.13.0, Culture=neutral, PublicKeyToken=null from /config/plugins/EmbyGuideData.dll
Info App: Loading Emby.Api, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Web, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading MediaBrowser.Model, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading MediaBrowser.Common, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading MediaBrowser.Controller, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Providers, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Photos, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Server.Implementations, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.LiveTV, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.ActivityLog, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Server.MediaEncoding, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.LocalMetadata, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Notifications, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Web.GenericUI, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Codecs.Dxva, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Codecs, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Server.Connect, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading Emby.Server.Sync, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info App: Loading EmbyServer, Version=4.8.3.0, Culture=neutral, PublicKeyToken=null
Info SqliteUserRepository: Sqlite version: 3.42.0
Info SqliteUserRepository: Sqlite compiler options: ATOMIC_INTRINSICS=1,COMPILER=gcc-10.3.0,DEFAULT_AUTOVACUUM,DEFAULT_CACHE_SIZE=-2000,DEFAULT_FILE_FORMAT=4,DEFAULT_JOURNAL_SIZE_LIMIT=-1,DEFAULT_MMAP_SIZE=0,DEFAULT_PAGE_SIZE=4096,DEFAULT_PCACHE_INITSZ=20,DEFAULT_RECURSIVE_TRIGGERS,DEFAULT_SECTOR_SIZE=4096,DEFAULT_SYNCHRONOUS=2,DEFAULT_WAL_AUTOCHECKPOINT=1000,DEFAULT_WAL_SYNCHRONOUS=2,DEFAULT_WORKER_THREADS=0,ENABLE_COLUMN_METADATA,ENABLE_DBSTAT_VTAB,ENABLE_FTS3,ENABLE_FTS3_PARENTHESIS,ENABLE_FTS3_TOKENIZER,ENABLE_FTS4,ENABLE_FTS5,ENABLE_GEOPOLY,ENABLE_MATH_FUNCTIONS,ENABLE_PREUPDATE_HOOK,ENABLE_RTREE,ENABLE_SESSION,ENABLE_UNLOCK_NOTIFY,ENABLE_UPDATE_DELETE_LIMIT,LIKE_DOESNT_MATCH_BLOBS,MALLOC_SOFT_LIMIT=1024,MAX_ATTACHED=10,MAX_COLUMN=2000,MAX_COMPOUND_SELECT=500,MAX_DEFAULT_PAGE_SIZE=8192,MAX_EXPR_DEPTH=1000,MAX_FUNCTION_ARG=127,MAX_LENGTH=1000000000,MAX_LIKE_PATTERN_LENGTH=50000,MAX_MMAP_SIZE=0x7fff0000,MAX_PAGE_COUNT=1073741823,MAX_PAGE_SIZE=65536,MAX_SCHEMA_RETRY=25,MAX_SQL_LENGTH=1000000000,MAX_TRIGGER_DEPTH=1000,MAX_VARIABLE_NUMBER=250000,MAX_VDBE_OP=250000000,MAX_WORKER_THREADS=8,MUTEX_PTHREADS,OMIT_LOOKASIDE,SECURE_DELETE,SYSTEM_MALLOC,TEMP_STORE=1,THREADSAFE=1
Info SqliteUserRepository: Opening sqlite connection to /config/data/users.db
Info SqliteUserRepository: Default journal_mode for /config/data/users.db is wal
Info SqliteUserRepository: PRAGMA foreign_keys=1
Info SqliteUserRepository: Result of setting SQLITE_DBCONFIG_DQS_DDL to 0 is 0
Info SqliteUserRepository: Result of setting SQLITE_DBCONFIG_DQS_DML to 0 is 0
Info ActivityRepository: Opening sqlite connection to /config/data/activitylog.db
Info ActivityRepository: Default journal_mode for /config/data/activitylog.db is wal
Info ActivityRepository: PRAGMA foreign_keys=1
Info ActivityRepository: Result of setting SQLITE_DBCONFIG_DQS_DDL to 0 is 0
Info ActivityRepository: Result of setting SQLITE_DBCONFIG_DQS_DML to 0 is 0
Info NetworkManager: Detecting local network addresses
Info NetworkManager: networkInterface: Ethernet eth0, Speed: 10000000000, Description: eth0
Info NetworkManager: GatewayAddresses: 172.21.0.1
Info NetworkManager: UnicastAddresses: 172.21.0.4,fe80::42:acff:fe15:4%41
Info NetworkManager: networkInterface: Loopback lo, Speed: -1, Description: lo
Info NetworkManager: GatewayAddresses:
Info NetworkManager: UnicastAddresses: 127.0.0.1,::1
Info NetworkManager: Detected local ip addresses: [{"IPAddress":"172.21.0.4","HasGateWayAddress":true,"PrefixLength":16,"IPv4Mask":"255.255.0.0"},{"IPAddress":"fe80::42:acff:fe15:4%41","HasGateWayAddress":true,"PrefixLength":64},{"IPAddress":"127.0.0.1","HasGateWayAddress":false,"PrefixLength":8,"IPv4Mask":"255.0.0.0"},{"IPAddress":"::1","HasGateWayAddress":false,"PrefixLength":128}]
Info SqliteDisplayPreferencesRepository: Opening sqlite connection to /config/data/displaypreferences.db
Info SqliteDisplayPreferencesRepository: Default journal_mode for /config/data/displaypreferences.db is wal
Info SqliteDisplayPreferencesRepository: PRAGMA foreign_keys=1
Info SqliteDisplayPreferencesRepository: Result of setting SQLITE_DBCONFIG_DQS_DDL to 0 is 0
Info SqliteDisplayPreferencesRepository: Result of setting SQLITE_DBCONFIG_DQS_DML to 0 is 0
Info ServerConfigurationManager: Saving system configuration
Info App: Begin vacumming SqliteItemRepository
Info SqliteItemRepository: Opening sqlite connection to /config/data/library.db
Info SqliteItemRepository: Default journal_mode for /config/data/library.db is wal
Info SqliteItemRepository: PRAGMA cache_size=-3072000
Info SqliteItemRepository: PRAGMA page_size=4096
Info SqliteItemRepository: PRAGMA foreign_keys=1
Info SqliteItemRepository: Result of setting SQLITE_DBCONFIG_DQS_DDL to 0 is 0
Info SqliteItemRepository: Result of setting SQLITE_DBCONFIG_DQS_DML to 0 is 0
Info App: Completed vacumming SqliteItemRepository after 5725ms
Info App: Begin vacumming SqliteUserRepository
Info App: Completed vacumming SqliteUserRepository after 648ms
Info App: Begin vacumming AuthenticationRepository
Info AuthenticationRepository: Opening sqlite connection to /config/data/authentication.dbInfo AuthenticationRepository: Default journal_mode for /config/data/authentication.db is wal
Info AuthenticationRepository: PRAGMA foreign_keys=1
Info AuthenticationRepository: Result of setting SQLITE_DBCONFIG_DQS_DDL to 0 is 0
Info AuthenticationRepository: Result of setting SQLITE_DBCONFIG_DQS_DML to 0 is 0
Info App: Completed vacumming AuthenticationRepository after 836ms
Info App: Begin vacumming SqliteDisplayPreferencesRepository
Info App: Completed vacumming SqliteDisplayPreferencesRepository after 1110ms
Info App: Begin vacumming ActivityRepository
Info App: Completed vacumming ActivityRepository after 691ms
Info App: Adding HttpListener prefix http://+:8096/
Info App: Adding HttpListener prefix https://+:8920/
Info SqliteItemRepository: Init Complete
Info App: Emby
        Command line: /app/emby/system/EmbyServer.dll -programdata /config -ffdetect /app/emby/bin/ffdetect -ffmpeg /app/emby/bin/ffmpeg -ffprobe /app/emby/bin/ffprobe -restartexitcode 3
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: app/emby/system/System.Private.CoreLib.dll
        Processor count: 16
        Data path: /config
        Application path: /app/emby/system
Info App: Logs path: /config/logs
Info App: Cache path: /config/cache
Info App: Internal metadata path: /config/metadata
Info App: Transcoding temporary files path: /config/transcoding-temp
[ls.io-init] done.
Info FfmpegManager: FFMpeg: /app/emby/bin/ffmpeg
Info FfmpegManager: FFProbe: /app/emby/bin/ffprobe
Info FfmpegManager: FFDetect: /app/emby/bin/ffdetect
Info Skia: SkiaSharp version: 2.88.0.0
Info ImageProcessor: Adding image processor Skia
Info libvips: NetVips version: 2.3.1.0
Info ImageProcessor: Adding image processor libvips
Info TaskManager: Daily trigger for Emby Server Backup set to fire at 04/07/2024 00:10:00, which is 1438.948595525 minutes from now.
Info TaskManager: Daily trigger for Thumbnail image extraction set to fire at 04/06/2024 02:00:00, which is 108.94839632333333 minutes from now.
Info TaskManager: Daily trigger for Rotate log file set to fire at 04/07/2024 00:00:00, which is 1428.9453180716666 minutes from now.
Info TaskManager: Queueing task HardwareDetectionScheduledTask
Info TaskManager: Executing Hardware Detection
Info App: ServerId: 9788d2f967c5430689e6cb69e8ed80fd
Info FfmpegManager: ProcessRun 'ffmpeg -hide_banner -version' Execute: /app/emby/bin/ffmpeg -hide_banner -version
Info App: Starting entry point Emby.Dlna.Main.DlnaEntryPoint
Info FfmpegManager: ProcessRun 'ffmpeg -hide_banner -version' Process exited with code 0 - Succeeded
Info FfmpegManager: FfmpegValidator.Validate complete
Inf
github-actions[bot] commented 7 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

j0nnymoe commented 7 months ago

Any reason you're using vaapi Vs nvenc which is supported in emby?

aptalca commented 7 months ago

https://github.com/linuxserver/docker-emby?tab=readme-ov-file#nvidia

Readme doesn't say to map /dev/dri for Nvidia

quincarter commented 7 months ago

https://github.com/linuxserver/docker-emby?tab=readme-ov-file#nvidia

Readme doesn't say to map /dev/dri for Nvidia

I guess to be fair it doesn't say what exactly to map for my device(s) (exactly how to do it)

I have had this configured for a while and it was working in emby. Can you share your configuration for Nvidia cards?

Roxedus commented 7 months ago

You dont need a explicit mapping for nvidia cards, the toolkit/runtime handles that for you

quincarter commented 7 months ago

Or should I just comment out the cards mapping?

quincarter commented 7 months ago

Screenshot_20240406-155541.png

So why aren't any encoding options showing up here? I just spun up my container without the devices mapped

j0nnymoe commented 7 months ago

Do you get nvidia-smi from within the container?

aptalca commented 7 months ago

To be clear, we don't do anything for Nvidia other than setting one env var (capabilities) in the image. Everything is handled by Nvidia toolkit and the drivers installed on host.

If they're installed correctly, the container is using Nvidia runtime and the other env is set, it should work. But again, none of that is under our control.

Emby displays all valid gpu options it detects in its gui.

quincarter commented 7 months ago

Do you get nvidia-smi from within the container?

actually, no i don't

docker exec -it emby /bin/bash
root@de7ec57a98a0:/# nvidia-smi
Failed to initialize NVML: Unknown Error
quincarter commented 7 months ago

So why would i not have nvidia-smi in the container?

j0nnymoe commented 7 months ago

Have you installed the nvidia container toolkit?

quincarter commented 7 months ago

Have you installed the nvidia container toolkit?

Yeah multiple times i feel like.

nvidia-ctk -v
NVIDIA Container Toolkit CLI version 1.14.6
commit: 5605d191332dcfeea802c4497360d60a65c7887e

also my current /etc/docker/daemon.json and my ~/.config/docker/daemon.json are identical:

{
  "default-runtime": "nvidia",
  "runtimes": {
    "nvidia": {
      "args": [],
      "path": "nvidia-container-runtime"
      }
    },
    "exec-opts": ["native.cgroupdriver=cgroupfs"]
}
quincarter commented 7 months ago

this was the command i ran to configure the nvidia-ctk runtime:

nvidia-ctk runtime configure --runtime=docker --config=$HOME/.config/docker/daemon.json
j0nnymoe commented 7 months ago

How did you install docker?

Note - it might be better you to swing over to our discord for easier help. Github issues are mainly for bugs where this seems to be an issue with your host.

quincarter commented 7 months ago

How did you install docker?

Note - it might be better you to swing over to our discord for easier help. Github issues are mainly for bugs where this seems to be an issue with your host.

Sure. Which channel should i post in? I just joined

j0nnymoe commented 7 months ago

container-support

quincarter commented 7 months ago

Linking here for visibility in case someone finds this searching - added a discord post here: https://discord.com/channels/354974912613449730/1226289649530568725

quincarter commented 7 months ago

I do see in the most recent diff comparing the two versions current and previous -- that the NVIDIA_DRIVER_CAPABILITIES is now being set by the docker image instead of being specified in the docker compose file. See this you can see this is changed. I currently set this to NVIDIA_DRIVER_CAPABILITIES=all in my docker compose. I know that in order to use nvidia-smi in the docker container, you need the utility option. See Driver Capabilities docs.

I am not sure if that is affecting the image at all. But worth mentioning here. Also, why would you not want NVIDIA_DRIVER_CAPABILITIES=all?

Also ----- posted this in discord too:

So i just followed this guide to see if i was truly affected by the bug listed there. And i am not:

$ docker run -d --rm --runtime=nvidia --gpus all \
    --device=/dev/nvidia-uvm \
    --device=/dev/nvidia-uvm-tools \
    --device=/dev/nvidia-modeset \
    --device=/dev/nvidiactl \
    --device=/dev/nvidia0 \
    --device=/dev/nvidia1 \
    nvcr.io/nvidia/cuda:12.0.0-base-ubuntu20.04 bash -c "while [ true ]; do nvidia-smi -L; sleep 5; done"
Unable to find image 'nvcr.io/nvidia/cuda:12.0.0-base-ubuntu20.04' locally
12.0.0-base-ubuntu20.04: Pulling from nvidia/cuda
96d54c3075c9: Pull complete
ac03447731ca: Pull complete
80e3d5e18f2e: Pull complete
b45dc012c6e2: Pull complete
5acbbc202509: Pull complete
Digest: sha256:dcea6188cf23600a396033b88132f86e295f35aa5ef8fee79187280ff6ecc81a
Status: Downloaded newer image for nvcr.io/nvidia/cuda:12.0.0-base-ubuntu20.04
88d8da4340c92cba1f0618e237ec859a2af3aa4e47325c6a364f620030ba252d

$ docker logs 88d8da4340c92cba1f0618e237ec859a2af3aa4e47325c6a364f620030ba252d
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)

$ sudo systemctl daemon-reload

$ docker logs 88d8da4340c92cba1f0618e237ec859a2af3aa4e47325c6a364f620030ba252d
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)
GPU 0: NVIDIA GeForce GTX 1080 (UUID: GPU-e574f97e-40e5-79f0-9128-76c79d5d0c40)
GPU 1: NVIDIA GeForce GTX 1080 (UUID: GPU-4661d3ec-fd8d-9c8d-167d-b1e1502b0fc6)

So i don't know - it may be an issue with the linuxserver image maybe? Pulling that myself looks like it worked fine from nvidia.

quincarter commented 7 months ago

TLDR - solved this in Discord for anyone that comes across this in google and wants to try this solution.

The container wouldn't initialize the nvidia-smi and any cards associated with it. So mapping the nvidia stuff directly (as seen in the command above in the docker command) is what ultimately solved it.

--device=/dev/nvidia-uvm \ --device=/dev/nvidia-uvm-tools \ --device=/dev/nvidia-modeset \ --device=/dev/nvidiactl \ --device=/dev/nvidia0 \ --device=/dev/nvidia1 \

In my docker compose it looks like this (thanks salty):

  emby:
    image: lscr.io/linuxserver/emby:latest
    container_name: emby
    environment:
      - PUID=${EMBY_UID}
      - PGID=${EMBY_GID}
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
      - TZ=${TIMEZONE}
    volumes:
      - ./.containers/Emby:/config # Configuration directory
      - ./images/logowhite.png:/app/emby/system/dashboard-ui/modules/logoscreensaver/logowhite.png 
      - ./images/logowhite.png:/app/emby/system/dashboard-ui/modules/themes/logowhite.png 
      - ./images/logodark.png:/app/emby/system/dashboard-ui/modules/themes/logodark.png 
      - ${LOCAL_TV_PATH}:/media/Synology/Television # Media directory
      - ${LOCAL_MOVIES_PATH}:/media/Synology/Movies # Media directory
      - ${LOCAL_BACKUPS_PATH}:/media/Synology/Backups #Backups Directory
      - /ssl/fullchain.pem:/ssl/fullchain.pem
      - /ssl/privkey.pem:/ssl/privkey.pem
      - /ssl/token:/ssl/token
    ports:
      - ${EMBY_HOST_PORT}:8096 #http port
      - ${EMBY_HOST_PORT_SSL}:8920 #ssl port
    runtime: nvidia
    restart: unless-stopped
    devices:
      - /dev/nvidia-uvm:/dev/nvidia-uvm # Added nvidia devices here
      - /dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools # Added nvidia devices here
      - /dev/nvidia-modeset:/dev/nvidia-modeset # Added nvidia devices here
      - /dev/nvidiactl:/dev/nvidiactl # Added nvidia devices here
      - /dev/nvidia0:/dev/nvidia0 # Added nvidia devices here
      - /dev/nvidia1:/dev/nvidia1 # Added nvidia devices here (i have a 2nd GPU so i needed this too)
      - /dev/dri:/dev/dri # I added this per suggestion, but this is for VAAPI so i don't know if this actually works -- this was what was failing before. 
    profiles:
      - emby

Screenshots

nvidia-smi in the container

Screenshot 2024-04-07 at 12 01 21 PM

Inside of emby in the transcoding section:

Screenshot 2024-04-07 at 12 01 41 PM
quincarter commented 7 months ago

I think this is solved per the suggestion above. So i am closing this now! Thanks for everyone's help! I am not sure why i had to add the devices manually in the docker compose but that's what i had to do to get them to show up now.