filebot / filebot-docker

Docker build files for FileBot
https://hub.docker.com/r/rednoah/filebot/
Apache License 2.0
55 stars 18 forks source link

Latest node image won't start #12

Closed BrianDMG closed 2 years ago

BrianDMG commented 2 years ago

Using the latest node image, image won't start (goes into restart loop). The log outputs:

adduser: The user `filebot' already exists.
sudo: unable to open /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

I'm passing PUID and PGID of 1000 as env vars. This issue was not present until the latest Docker update.

rednoah commented 2 years ago

How are you configuring and starting the docker container? Please include screenshots if you're using a WebUI of some kind.

Here's what I get:

$ docker run --rm -it -v $PWD:/volume1 -v data:/data -p 5452:5452 rednoah/filebot:node
...
USER { UID: 1000, GID: 1000 }
filebot-node listening at http://0.0.0.0:5452/
rednoah commented 2 years ago

Setting PUID=0 will restore the previous behaviour of running everything as super user without downgrading to a normal user: https://github.com/filebot/filebot-docker/blob/master/generic/opt/bin/run-as-user#L5

Ashkaan commented 2 years ago

I'm having an identical issue. Setting PUID=0 creates new errors. Everything was working great a day ago.

Here are screenshots of my setup:

Screen Shot 2021-10-10 at 10 57 31 AM Screen Shot 2021-10-10 at 10 57 59 AM
BrianDMG commented 2 years ago

My current config is as such:

Docker compose:

    image: rednoah/filebot:node
    container_name: filebot
    env_file:
      - ./env/general.env
      - ./env/filebot.env
    volumes:
      - /path/apps/filebot:/data
      - /path/downloads/completed:/watch
      - /path/media:/output
    ports:
      - 5452:5452
    restart: unless-stopped

Env:

FILEBOT_NODE_AUTH_USER=user
FILEBOT_NODE_AUTH_PASS=pass
FILEBOT_NODE_HTTPS='NO'
FILEBOT_NODE_HTTPS_PORT='5453'
PUID=1000
PGID=1000
KEEP_APP_RUNNING='1'
APP_NICENESS='10'
CLEAN_TMP_DIR='1'
SECURE_CONNECTION='0'
VNC_PASSWORD='pass'
ENABLE_CJK_FONT='0'
AMC_INTERVAL='600'
AMC_INPUT_STABLE_TIME='10'
AMC_ACTION'copy'
AMC_CONFLICT='auto'
AMC_MATCH_MODE='opportunistic'
AMC_ARTWORK='n'
AMC_MUSIC_FORMAT='{plex}'
AMC_MOVIE_FORMAT="/output/movies/{n} ({y})"
AMC_SERIES_FORMAT="/output/tv/{n}/{'Season '+s}/{n} - {S00E00} - {t}"
AMC_ANIME_FORMAT="/output/tv/{n}/{'Season '+s}/{n} - {S00E00} - {t}"
AMC_PROCESS_MUSIC='n'
AMC_SUBTITLE_LANG='en,cz'
AMC_CUSTOM_OPTIONS=''
AMC_INPUT_DIR='/watch/'
AMC_OUTPUT_DIR='/output/'

I think it's more important to note that this configuration has not changed in quite a while, so it's unusual that it's not currently working.

rednoah commented 2 years ago

1. Note that this is not a rednoah/filebot:node configuration. The vast majority of the environment variables you're passing in aren't used at all. Notably, PUID and PGID were not in use until the recent update, but are now in use. So PUID=1000 didn't do anything until the recent update, but does now run the process as the given user, which is somehow incompatible with your docker-compose configuration?

PUID=0 will restore the previous behaviour. Make sure you're using the very latest image to make sure that you have this line in the startup script: https://github.com/filebot/filebot-docker/blob/master/generic/opt/bin/run-as-user#L5

2. What is the difference between my working docker run --rm -it -v $PWD:/volume1 -v data:/data -p 5452:5452 rednoah/filebot:node call and your docker-compose configuration? The difference will give us a hint as to why PUID=1000 is not working for you.

BrianDMG commented 2 years ago

Alright, so you're right about my config: it turns out the config I pasted was an old config I was using on my raspi for a forked image. I've not been using that config since I moved off the raspi. I've gone back and specified PGID/PUID as 0 per your suggestion, and that does work. However, I have previous been using PUID/PGID 1000 (as it's included in my general.env for my mostly linuxserver.io images), and that had previously been working fine before the latest couple of updates (there were 2 close together recently, I believe).

rednoah commented 2 years ago

PUID/PGID 1000 was not used, and so it ran as UID=0 and worked. PUID/PGID 1000 is now used, and will run as UID=1000, and that doesn't work for you for some reason. If you could find out what that reason might be, then maybe we could do something about it.

What is the difference between my working docker run --rm -it -v $PWD:/volume1 -v data:/data -p 5452:5452 rednoah/filebot:node call and your docker-compose configuration? The difference will give us a hint as to why PUID=1000 is not working for you.

EDIT: Might be related to how docker-compose is reusing containers when you only change environment variables in a way that is different from how the docker command works for repetitive calls.

Ashkaan commented 2 years ago

This is still not working for me. I built a completely fresh instance and it doesn't work because it cannot write to the data folder. PUID=1000 doesn't work because it's not the PUID of the files. PUID=1026 (mine) doesn't work, but I have no idea why. Maybe the env var is not applying properly?

Ashkaan commented 2 years ago

Testing this more, I'm finding that if I set it to PUID=1000, Filebot can read its own configurations, but not my files. If I set it to PUID=1026, Filebot cannot read its own configuration files.

I have chown-ed and chmod-ed everything to death.

rednoah commented 2 years ago

What does the console output say?

Not being able to read it's own application data files shouldn't be possible, because it's running chown -R on launch every time: https://github.com/filebot/filebot-docker/blob/master/generic/opt/bin/run-as-user#L16

Ashkaan commented 2 years ago

PUID=1000

`filebot -script 'fn:amc' /YouTube --output '/TV Shows' --action move -non-strict --order Airdate --conflict auto --lang en --def 'ut_label=TV' 'subtitles=eng' 'clean=y' 'skipExtract=y' 'minLengthMS=0' 'minFileSize=0' 'seriesFormat={n} - {s00e00} - {t}.WEBDL-{vf}' --apply refresh --log all --log-file '/data/filebot/node/filebot.log'


Initialize Cache folder: /data/filebot/cache Initialize Logs folder: /data/filebot/logs Initialize TemporaryFiles folder: /data/filebot/tmp Initialize new disk cache: /data/filebot/cache/0 Oct 13, 2021 5:28:15 AM java.util.prefs.FileSystemPreferences$1 run INFO: Created user preferences directory. Run script [fn:amc] at [Wed Oct 13 05:28:18 GMT 2021] Parameter: utlabel = TV Parameter: subtitles = eng Parameter: clean = y Parameter: skipExtract = y Parameter: minLengthMS = 0 Parameter: minFileSize = 0 Parameter: seriesFormat = {n} - {s00e00} - {t}.WEBDL-{vf} Argument[0]: /YouTube Invalid usage: output folder must exist and must be a writable directory: /TV Shows Permission denied: /YouTube Permission denied: /YouTube No files selected for processing Done ¯_(ツ)/¯ `

PUID=1026

`$ filebot -version


[Process error]

🔺 Exit Code: EPERM `

Screen Shot 2021-10-12 at 10 30 42 PM
Ashkaan commented 2 years ago

Also, I don't think that Line 16 (working or not) is the issue because I've also tried manually chown-ing.

rednoah commented 2 years ago

FileBot application data is perfectly writable:

Initialize Cache folder: /data/filebot/cache
Initialize Logs folder: /data/filebot/logs
...

If you compare the permissions of files in /data/filebot/logs and files in /data/filebot/node/log can you see any differences?

Ashkaan commented 2 years ago

The folders and files are all the same.

Screen Shot 2021-10-12 at 11 00 47 PM

However, when I tested PUID=1000 with a blank folder, it wrote 1000:1000 files. But none of my media is 1000:1000, hence needing to use the env var to get the right PUID:PGID.

rednoah commented 2 years ago

What about the files in /data/filebot/logs and files in /data/filebot/node/log?

ls -l /data/filebot/logs
ls -l /data/filebot/node/log

If use you use PUID=1026 then then everything should be chown-ed to that user.

Ashkaan commented 2 years ago

I feel foolish. I deleted the image and downloaded the latest-latest (it looks like you made a recent edit). It's all working now. Thank you for the engagement!