linuxserver / docker-jellyfin

GNU General Public License v3.0
640 stars 96 forks source link

[BUG] Crash on first launch #224

Closed PassiveLemon closed 9 months ago

PassiveLemon commented 9 months ago

Is there an existing issue for this?

Current Behavior

When first booting up my system, all my containers will start except for Jellyfin (its set to always restart). If I start it after the fact, it will launch fine.

Expected Behavior

Jellyfin launches upon first launch on a system boot.

Steps To Reproduce

  1. Boot system
  2. Observe that Jellyfin did not start
  3. Start Jellyfin manuallly
  4. Observe Jellyfin working properly

Environment

- OS: NixOS 23.11
- How docker service was installed: Docker service module with nvidia-docker also enabled:

...
virtualisation = {
    docker = { 
      enable = true;
      enableOnBoot = true;
      enableNvidia = true;
    };
};

The container is set up to support hardware accelerated transcoding.

CPU architecture

x86-64

Docker creation

jellyfin:
    image: lscr.io/linuxserver/jellyfin:latest
    container_name: jellyfin
    restart: always
    ports:
      - 50096:8096/tcp
    volumes:
      - /home/docker/Containers/Media/Jellyfin/config:/config
      - /home/docker/Containers/Media/Jellyfin/web/dist:/usr/share/jellyfin/web:ro
      - /home/HDD2TBEXT4/Media:/data/media:ro
      # Required for Hardware Accel
      - /dev/nvidia-caps:/dev/nvidia-caps
      - /dev/nvidia0:/dev/nvidia0
      - /dev/nvidiactl:/dev/nvidiactl
      - /dev/nvidia-modeset:/dev/nvidia-modeset
      - /dev/nvidia-uvm:/dev/nvidia-uvm
      - /dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools
    environment:
      PUID: '1000'
      PGID: '1000'
      TZ: 'America/New_York'
      NVIDIA_VISIBLE_DEVICES: 'all'
      NVIDIA_DRIVER_CAPABILITIES: 'all'
    runtime: nvidia
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 3000M
        reservations:
          devices:
            - driver: nvidia
              capabilities: [ gpu ]

Container logs

───────────────────────────────────────

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

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

To support the app dev(s) visit:
Jellyfin: https://opencollective.com/jellyfin

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

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

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

[custom-init] No custom files found, skipping...
[13:17:05] [INF] [1] Main: Jellyfin version: 10.8.13
[13:17:05] [INF] [1] Main: Environment Variables: ["[JELLYFIN_LOG_DIR, /config/log]", "[JELLYFIN_WEB_DIR, /usr/share/jellyfin/web]", "[JELLYFIN_CACHE_DIR, /config/cache]", "[JELLYFIN_DATA_DIR, /config/data]", "[JELLYFIN_CONFIG_DIR, /config]"]
[13:17:05] [INF] [1] Main: Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll", "--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg"]
[13:17:05] [INF] [1] Main: Operating system: Linux
[13:17:05] [INF] [1] Main: Architecture: X64
[13:17:05] [INF] [1] Main: 64-Bit Process: True
[13:17:05] [INF] [1] Main: User Interactive: True
[13:17:05] [INF] [1] Main: Processor count: 2
[13:17:05] [INF] [1] Main: Program data path: /config/data
[13:17:05] [INF] [1] Main: Web resources path: /usr/share/jellyfin/web
[13:17:05] [INF] [1] Main: Application directory: /usr/lib/jellyfin/bin/
[13:17:05] [INF] [1] Emby.Server.Implementations.AppBase.BaseConfigurationManager: Setting cache path: /config/cache
[13:17:05] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loading assemblies
[13:17:05] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.AniList, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null from /config/data/plugins/AniList_7.0.0.0/Jellyfin.Plugin.AniList.dll
[13:17:05] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly ConfusedPolarBear.Plugin.IntroSkipper, Version=0.1.7.0, Culture=neutral, PublicKeyToken=null from /config/data/plugins/Intro Skipper_0.1.7.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
[13:17:05] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.OpenSubtitles, Version=19.0.0.0, Culture=neutral, PublicKeyToken=null from /config/data/plugins/Open Subtitles_19.0.0.0/Jellyfin.Plugin.OpenSubtitles.dll
[13:17:05] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.SessionCleaner, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null from /config/data/plugins/Session Cleaner_2.0.0.0/Jellyfin.Plugin.SessionCleaner.dll
[13:17:05] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.TMDbBoxSets, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null from /config/data/plugins/TMDb Box Sets_10.0.0.0/Jellyfin.Plugin.TMDbBoxSets.dll
[13:17:05] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN addresses : [fc00::/7,fe80::/10,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16]
[13:17:05] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN exclusions : []
[13:17:05] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using LAN addresses: [fc00::/7,fe80::/10,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16]
[13:17:05] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind addresses: []
[13:17:05] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind exclusions: []
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: AniList 7.0.0.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Intro Skipper 0.1.7.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Open Subtitles 19.0.0.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Session Cleaner 2.0.0.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: TMDb Box Sets 10.0.0.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: TMDb 10.8.13.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Studio Images 10.8.13.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: OMDb 10.8.13.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: MusicBrainz 10.8.13.0
[13:17:07] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: AudioDB 10.8.13.0
[13:17:07] [INF] [1] Main: Kestrel listening on All Addresses
[13:17:07] [WRN] [1] Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository: Using an in-memory repository. Keys will not be persisted to storage.
[13:17:07] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
[13:17:07] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: No XML encryptor configured. Key {f93baf8e-4682-4356-9370-37489dffef22} may be persisted to storage in unencrypted form.
[13:17:07] [INF] [1] Emby.Server.Implementations.ApplicationHost: Running startup tasks
[13:17:07] [INF] [1] Emby.Server.Implementations.ScheduledTasks.TaskManager: Daily trigger for Detect Introductions set to fire at 2023-12-30 00:00:00.000 -05:00, which is 10:42:52.3612494 from now.
[13:17:07] [INF] [1] Emby.Server.Implementations.ScheduledTasks.TaskManager: Daily trigger for Extract Chapter Images set to fire at 2023-12-30 02:00:00.000 -05:00, which is 12:42:52.3489823 from now.
[13:17:07] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Found ffmpeg version 5.1.4
[13:17:07] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available decoders: ["libdav1d", "av1", "av1_cuvid", "av1_qsv", "h264", "h264_qsv", "h264_cuvid", "hevc", "hevc_qsv", "hevc_cuvid", "mpeg2video", "mpeg2_qsv", "mpeg2_cuvid", "mpeg4", "mpeg4_cuvid", "msmpeg4", "vc1_qsv", "vc1_cuvid", "vp8", "libvpx", "vp8_cuvid", "vp8_qsv", "vp9", "libvpx-vp9", "vp9_cuvid", "vp9_qsv", "aac", "ac3", "dca", "flac", "mp3", "truehd"]
[13:17:07] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available encoders: ["libx264", "h264_amf", "h264_nvenc", "h264_qsv", "h264_v4l2m2m", "h264_vaapi", "libx265", "hevc_amf", "hevc_nvenc", "hevc_qsv", "hevc_vaapi", "mpeg4", "msmpeg4", "libvpx", "libvpx-vp9", "aac", "libfdk_aac", "ac3", "dca", "flac", "libmp3lame", "libopus", "truehd", "libvorbis", "srt"]
[13:17:07] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available filters: ["deinterlace_qsv", "deinterlace_vaapi", "hwupload_cuda", "hwupload_vaapi", "overlay_opencl", "overlay_qsv", "overlay_vaapi", "overlay_cuda", "procamp_vaapi", "scale_cuda", "scale_opencl", "scale_qsv", "scale_vaapi", "tonemap_cuda", "tonemap_opencl", "tonemap_vaapi", "vpp_qsv", "yadif_cuda", "zscale", "alphasrc"]
[13:17:07] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available hwaccel types: ["cuda", "vaapi", "qsv", "drm", "opencl", "vulkan"]
[13:17:07] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: FFmpeg: /usr/lib/jellyfin-ffmpeg/ffmpeg
[13:17:07] [INF] [1] Emby.Server.Implementations.ApplicationHost: ServerId: 34a2e6a55d934f5c80285f3b0457c1c7
[13:17:08] [INF] [1] Emby.Server.Implementations.ApplicationHost: Executed all pre-startup entry points in 0:00:00.0901147
[13:17:08] [INF] [1] Emby.Server.Implementations.ApplicationHost: Core startup complete
[13:17:08] [INF] [1] ConfusedPolarBear.Plugin.IntroSkipper.Entrypoint: Running startup enqueue
[13:17:08] [INF] [1] ConfusedPolarBear.Plugin.IntroSkipper.QueueManager: Running enqueue of items in library Shows (a656b907eb3a73532e40e44b968d0225)
[13:17:08] [INF] [1] ConfusedPolarBear.Plugin.IntroSkipper.QueueManager: Running enqueue of items in library Anime Shows (29391378c4118b35b77f84980d25f0a6)
[13:17:08] [INF] [10] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /data/media/Movies
[13:17:08] [INF] [8] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /data/media/Anime Movies
[13:17:08] [INF] [10] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /data/media/Recordings
[13:17:08] [INF] [8] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /data/media/Shows
[13:17:08] [INF] [1] Emby.Server.Implementations.ApplicationHost: Executed all post-startup entry points in 0:00:00.2704217
[13:17:08] [INF] [1] Main: Startup complete 0:00:05.4434614
[13:17:08] [INF] [12] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /data/media/Anime Shows
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'AccessSchedule' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ActivityLog' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'CustomItemDisplayPreferences' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'DisplayPreferences' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'HomeSection' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ImageInfo' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ItemDisplayPreferences' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'Permission' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'Preference' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ApiKey' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'Device' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'DeviceOptions' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[13:17:09] [WRN] [10] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'User' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
[ls.io-init] done.
[13:17:10] [INF] [8] Emby.Server.Implementations.ScheduledTasks.TaskManager: StartupTrigger fired for task: Update Plugins
[13:17:10] [INF] [8] Emby.Server.Implementations.ScheduledTasks.TaskManager: Queuing task PluginUpdateTask
[13:17:10] [INF] [10] Emby.Server.Implementations.ScheduledTasks.TaskManager: Executing Update Plugins
[13:17:11] [INF] [12] Emby.Server.Implementations.ScheduledTasks.TaskManager: Update Plugins Completed after 0 minute(s) and 1 seconds
[13:17:11] [INF] [12] Emby.Server.Implementations.ScheduledTasks.TaskManager: ExecuteQueuedTasks
[13:17:13] [INF] [8] Jellyfin.Server.Implementations.Users.UserManager: Authentication request for Lemon has succeeded.
[13:17:13] [INF] [8] Emby.Server.Implementations.Session.SessionManager: Current/Max sessions for user Lemon: 0/0
[13:17:13] [INF] [8] Emby.Server.Implementations.Session.SessionManager: Reissuing access token: fb4a37497e5046b293a5b76f9c88070c
[15:07:00] [INF] [2] Main: Received a SIGTERM signal, shutting down
[15:07:00] [INF] [2] Main: Running query planner optimizations in the database... This might take a while
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing CoreAppHost
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing RecordingNotifier
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing SchedulesDirect
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing EmbyTV
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing EntryPoint
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing AutoSkip
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing MusicBrainzAlbumProvider
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing UdpServerEntryPoint
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing Entrypoint
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing UserDataChangeNotifier
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing LibraryChangedNotifier
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing EntryPoint
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing LibraryMonitorStartup
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing TMDbBoxSetManager
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing NotificationEntryPoint
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing ExternalPortForwarding
[15:07:00] [INF] [2] Emby.Server.Implementations.EntryPoints.ExternalPortForwarding: Stopping NAT discovery
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing DlnaEntryPoint
[15:07:00] [INF] [2] Emby.Dlna.Main.DlnaEntryPoint: Disposing DeviceDiscovery
[15:07:00] [INF] [2] Emby.Dlna.Main.DlnaEntryPoint: Disposing SsdpCommunicationsServer
[15:07:00] [INF] [2] Emby.Server.Implementations.ApplicationHost: Disposing DeviceAccessEntryPoint
github-actions[bot] commented 9 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.

PassiveLemon commented 9 months ago

I suspect it has to do with the Nvidia devices not being fully initialized at launch time but there's nothing in the logs, that I can see, that would indicate the problem.

j0nnymoe commented 9 months ago

The container works fine with Nvidia. It's likely due to something specific with nixos. You wouldn't normally have to mount all those Nvidia volumes as the Nvidia runtime handles that all for you.

You likely have to delay the docker Daemon from starting.

PassiveLemon commented 9 months ago

I just set the Docker systemd service to start after 15 seconds and it still occurs so I'm thinking its not Nvidia. I'll do some more testing and see what mounts I can remove. I remember I had problems getting hardware transcoding to work and setting those did fix it.

I noticed a large gap in time in these 2 lines:

[15:40:34] [INF] [10] Emby.Server.Implementations.Session.SessionManager: Reissuing access token: fb4a37497e5046b293a5b76f9c88070c
[15:41:30] [INF] [2] Main: Received a SIGTERM signal, shutting down

Could this indicate something?

j0nnymoe commented 9 months ago

Does the container start fine without Nvidia?

PassiveLemon commented 9 months ago

The solution was to remove those device mounts.

What I'm guess happened is that, at some point a while ago, I updated my system and didn't realize the Nvidia driver got updated in the process, which requires a reboot, so when transcoding stopped in the container, I added those mounts and restarted the system which made me think those mounts did something when it was just the restart.