linuxserver / docker-jellyfin

GNU General Public License v3.0
607 stars 91 forks source link

Access to the path '/config/custom-cont-init.d' is denied #166

Closed ZapperDJ closed 1 year ago

ZapperDJ commented 1 year ago

linuxserver.io


Expected Behavior

Jellyfin should start properly

Current Behavior

Jellyfin refuses to start because it complains it can't access the '/config/custom-cont-init.d' directory. This worked OK on version 10.7.7 but not on newer versions

Steps to Reproduce

  1. Install using the docker-compose.yml provided below

Environment

OS: Ubuntu 20.04 CPU architecture: x86_64 How docker service was installed: from the official docker repo

Command used to create docker container (run/create/compose/screenshot)

version: "2.1"
volumes:
  pelis:
    driver: local
    driver_opts:
      type: cifs
      o: username=guest,password=,uid=1000,gid=1000
      device: "//192.168.1.3/media/Pelis"
  series:
    driver: local
    driver_opts:
      type: cifs
      o: username=guest,password=,uid=1000,gid=1000
      device: "//192.168.1.3/media/Series"
  pelis-torrents:
    driver: local
    driver_opts:
      type: cifs
      o: username=guest,password=,uid=1000,gid=1000
      device: "//192.168.1.3/torrents/__NO VISTAS__/Pelis"
  series-torrents:
    driver: local
    driver_opts:
      type: cifs
      o: username=guest,password=,uid=1000,gid=1000
      device: "//192.168.1.3/torrents/__NO VISTAS__/Series"
  anime:
    driver: local
    driver_opts:
      type: cifs
      o: username=guest,password=,uid=1000,gid=1000
      device: "//192.168.1.3/media/Anime"
  pelis-galego:
    driver: local
    driver_opts:
      type: cifs
      o: username=guest,password=,uid=1000,gid=1000
      device: "//192.168.1.3/media/PelisGalego"      
services:
  jellyfin:
    image: lscr.io/linuxserver/jellyfin
    container_name: jellyfin
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Madrid
      - JELLYFIN_PublishedServerUrl=192.168.1.4 #optional
    volumes:
      - ./config:/config
      - series:/data/tvshows
      - pelis:/data/movies
      - series-torrents:/data/tvshows-torrents
      - pelis-torrents:/data/movies-torrents
      - pelis-galego:/data/pelis-galego
      - anime:/data/anime
    ports:
      - 8096:8096
      - 8920:8920 #optional
      - 7359:7359/udp #optional
      - 1900:1900/udp #optional
    restart: unless-stopped

Docker logs

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service 00-legacy: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service 00-legacy successfully started
cont-init: info: running /etc/cont-init.d/01-envfile
cont-init: info: /etc/cont-init.d/01-envfile exited 0
cont-init: info: running /etc/cont-init.d/01-migrations
[migrations] started
[migrations] no migrations found
cont-init: info: /etc/cont-init.d/01-migrations exited 0
cont-init: info: running /etc/cont-init.d/02-tamper-check
cont-init: info: /etc/cont-init.d/02-tamper-check exited 0
cont-init: info: running /etc/cont-init.d/10-adduser

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

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
-------------------------------------

cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/30-config
cont-init: info: /etc/cont-init.d/30-config exited 0
cont-init: info: running /etc/cont-init.d/40-gid-video
cont-init: info: /etc/cont-init.d/40-gid-video exited 0
cont-init: info: running /etc/cont-init.d/90-custom-folders
cont-init: info: /etc/cont-init.d/90-custom-folders exited 0
cont-init: info: running /etc/cont-init.d/99-custom-scripts
[custom-init] no custom files found exiting...
cont-init: info: /etc/cont-init.d/99-custom-scripts exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun jellyfin (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started
Unhandled Exception
System.UnauthorizedAccessException: Access to the path '/config/custom-cont-init.d' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.IO.FileStatus.ThrowOnCacheInitializationError(ReadOnlySpan`1 path)
   at System.IO.Enumeration.FileSystemEntry.get_IsSymbolicLink()
   at System.IO.Enumeration.FileSystemEntry.Initialize(FileSystemEntry& entry, DirectoryEntry directoryEntry, ReadOnlySpan`1 directory, ReadOnlySpan`1 rootDirectory, ReadOnlySpan`1 originalRootDirectory, Span`1 pathBuffer)
   at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext()
   at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
   at System.IO.FileSystemWatcher.RunningInstance..ctor(FileSystemWatcher watcher, SafeFileHandle inotifyHandle, String directoryPath, Boolean includeSubdirectories, NotifyFilters notifyFilters, CancellationToken cancellationToken)
   at System.IO.FileSystemWatcher.StartRaisingEvents()
   at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
   at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
   at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at Jellyfin.Server.Program.CreateAppConfiguration(StartupOptions commandLineOpts, IApplicationPaths appPaths)
   at Jellyfin.Server.Program.StartApp(StartupOptions options)
   at Jellyfin.Server.Program.
(String[] args)
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

aptalca commented 1 year ago

You must have set that location or a parent folder as a media/source path in jellyfin. That folder should have nothing to do with jellyfin the app by default.

ZapperDJ commented 1 year ago

That is not the case, I don't have any of my libraries pointing to the /config directory. All that is there is the jellyfin configuration files. It worked fine with version 10.7.7, which didn't create the custom-cont-init.d directory El 26 ago 2022 0:14zg  +0200, aptalca @.***>, escribió:

You must ,zt ,y ,have set that location or a parent folder as a media/source path in jellyfin. That folder should have nothing to do with jellyfin the app by default. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

aptalca commented 1 year ago

That folder has been created forever. It's not used by jellyfin. It's used by the container init. You must have changed some setting in jellyfin.

A fresh container with that folder existing in /config starts up just fine: https://ci-tests.linuxserver.io/linuxserver/jellyfin/10.8.4-1-ls177/index.html

ZapperDJ commented 1 year ago

I tried a fresh container with an empty config directory and it gave me the same error, so I tried some things. My setup involves a virtual machine which is running docker exclusively, all of this on top of TrueNAS. The directory where I store my docker-compose files for my containers and their respective configuration files is mounted on /containers via a NFS share like so:

192.168.1.3:/mnt/tank/docker/containers on /containers type nfs4 (rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.4,local_lock=none,addr=192.168.1.3)

So the full path to my jellyfin config directory is /containers/jellyfin/config. However, if I change the config folder location to somewhere in the local filesystem and not a network share, like /home/docker/config everything works and it doesn't give that error. Furthermore if I do ls -l /containers/jellyfin/config on the virtual machine after running the container and gett9ing the error i see this:

drwxrwx--- 2 docker docker    2 Aug 26 13:15 cache
?????????? ? ?      ?         ?            ? custom-cont-init.d
?????????? ? ?      ?         ?            ? custom-services.d
drwxrwx--- 4 docker docker    4 Aug 26 13:15 data
drwxrwx--- 2 docker docker    2 Aug 26 13:15 log
-rwxrwx--- 1 docker docker 1362 Aug 26 13:15 logging.default.json

All those ????? seemed odd so I tried that same ls -l on the TrueNAS server and I get this:

drwxrwx---+ 2 zapper  zapper     2 Aug 26 15:15 cache
drwxrwx---+ 2 root    wheel      2 Aug 26 15:15 custom-cont-init.d
drwxrwx---+ 2 root    wheel      2 Aug 26 15:15 custom-services.d
drwxrwx---+ 4 zapper  zapper     4 Aug 26 15:15 data
drwxrwx---+ 2 zapper  zapper     2 Aug 26 15:15 log
-rwxrwx---+ 1 zapper  zapper  1362 Aug 26 15:15 logging.default.json

So it seems that something is wrong with the share. I noticed that the wheel group doesn't exist in Ubuntu, and the root group doesn't exist on TrueNAS, even though that shouldn't be a problem because both groups use 0 as their id. So anyway i tried 'sudo chown root:1000 custom-services.d' and sudo chown root:1000 custom-cont-init.d after starting the container and it cleared the error and jellyfin started OK. However this is a temporary fix, as if I destroy the container and recreate it again the problem shows up again, so I have to manually apply the workaround each time I want to update, which is not idel because I use watchtower to update my containers

aptalca commented 1 year ago

The user/group names should not matter as they're merely cosmetic. The id number is what is actually used.

Custom init and services folders should only be created if they don't already exist, or if they're not owned by root (0). If changing the group id fixes it for you, that would be a fix for you.

However, keep in mind that we don't support /config folders residing on remote shares for this reason and other. Data and media shares are fine on nfs, but /config folders often have lots of issues.

ZapperDJ commented 1 year ago

Even if the directories are already created and owner by root:1000 when the container starts, it still goes nuts. However I made it work and survive contianer destruction and recreation by simply simlinking the problematic directories out of the config share like this:

cd /containers/jellyfin/config
mkdir /home/docker/jellyfin/config/custom-services.d
mkdir /home/docker/jellyfin/config/custom-cont-init.d
sudo chown root:root /home/docker/jellyfin/config/custom-cont-init.d/
sudo chown root:root /home/docker/jellyfin/config/custom-services.d/
ln -s /home/docker/jellyfin/config/custom-services.d/ custom-services.d
ln -s /home/docker/jellyfin/config/custom-cont-init.d/ custom-cont-init.d
sudo chown root:root custom-services.d
sudo chown root:root custom-cont-init.d
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

drizuid commented 1 year ago

OP said they resolved issue, closing.