• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support General Questions Race condition between Jellyfin and NAS

     
    • 0 Vote(s) - 0 Average

    Race condition between Jellyfin and NAS

    unmesh59
    Offline

    Junior Member

    Posts: 17
    Threads: 5
    Joined: 2024 Feb
    Reputation: 0
    #1
    2024-10-16, 01:29 AM (This post was last modified: 2024-10-16, 02:13 AM by unmesh59. Edited 1 time in total.)
    I have Jellyfin running on Ubuntu on one server and a separate NAS with the media files. After a power outage, the machine with Jellyfin powers up first with the consequence that the SMB mount of the NAS fails and I have to run "sudo mount -a" manually after some time.

    Is there a way to automate the sequencing of events so that the dependencies are met? 

    I'd be willing to live with a single mount event firing a fixed time after reboot if deterministically waiting for the NAS to be up is too difficult.
    1
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #2
    2024-10-16, 03:50 PM
    You can modify the jellyfin service file to require that a mount be present before attempting to start.

    Modify /etc/systemd/system/multi-user.target.wants/jellyfin.service and add "RequiresMountFor" in the [Service] section. I've provided an example below.

    Code:
    [Unit]
    Description = Jellyfin Media Server
    After = network-online.target

    [Service]
    RequiresMountsFor=/media/library
    Type = simple
    EnvironmentFile = /etc/default/jellyfin
    User = jellyfin
    Group = jellyfin
    WorkingDirectory = /var/lib/jellyfin
    ExecStart = /usr/bin/jellyfin $JELLYFIN_WEB_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_SERVICE_OPT $JELLYFIN_NOWEBAPP_OPT $JELLYFIN_ADDITIONAL_OPTS
    Restart = on-failure
    TimeoutSec = 15
    SuccessExitStatus=0 143

    [Install]
    WantedBy = multi-user.target

    I want to note that this will only work if you've defined your SMB mount in /etc/fstab. RequiresMountFor uses the fstab parameters to determine when the mount is actually available.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    unmesh59
    Offline

    Junior Member

    Posts: 17
    Threads: 5
    Joined: 2024 Feb
    Reputation: 0
    #3
    2024-10-17, 03:47 AM (This post was last modified: 2024-10-17, 03:52 AM by unmesh59. Edited 1 time in total.)
    My fstab entry is
    //192.168.1.206/Share1 /mnt/Syno cifs credentials=/etc/cifs-credentials

    I expect I should replace /media/library in your example with my mount point which is /mnt/Syno

    Also, my experience with power outages is that Ubuntu does not seem to retry the mount if it fails the first time and I have to automount using the fstab entry. Did I not wait long enough or will this change somehow cause the OS to retry mounting? Or something more has to be done on/to Ubuntu?

    Thanks.
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #4
    2024-10-17, 02:53 PM
    Yes, you'd replace /media/library with your mount location.

    In your fstab you can try adding the retry option.

    Code:
    //192.168.1.206/Share1 /mnt/Syno cifs credentials=/etc/cifs-credentials,retry=5

    This will retry for 5 minutes before giving up.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    unmesh59
    Offline

    Junior Member

    Posts: 17
    Threads: 5
    Joined: 2024 Feb
    Reputation: 0
    #5
    2024-10-17, 05:06 PM
    Awesome! I will add that and wait for the next power outage which may not be too far away :-(
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode