mdhiggins / sonarr-sma

Sonarr docker based on linuxserver/sonarr with SMA built in using python3
MIT License
38 stars 18 forks source link

Error caused by log file ownership #33

Closed KaHooli closed 2 years ago

KaHooli commented 2 years ago

I’m using the build setup of Sonarr-SMA & Radarr-SMA as I’m using an NVIDIA GPU to assist with the FFMPEG compute, but I’m wanting to convert my existing collection.

To do this, I’m running the manual.py from within the container, but it keeps creating logs as root. This then causes issues when SMA is called by Sonarr or Radarr, as it can’t overwrite the log file.

I’ve specified PUID (username 1000) and PGID (docker 998) as environment variables, and even set them as UID & GID in autoProcess.ini.

Am I doing something wrong? If not, could SMA write the log files as per the UID/GID in the autoProcess.ini file?

mdhiggins commented 2 years ago

You just need to not launch manual.py as root which is probably what you're doing. The Python logging system doesn't allow you to specify alternative users when it's doing its file creation or rotation and if you're executing it using docker exec this defaults to using root

Not sure exactly what command you're doing to run manual.py but you can probably solve it using

docker exec -it --user abc <container id> <command>

abc is the user used by the linuxserver containers for everything and setting the environment variable just matches abc's UID and GID with the external UID and PID set by the environment variables but doesn't impact log file creation if you execute the script from a different user (in this case root)

You can also just use the PUID as well to achieve the same result

docker exec -it --user $PUID <container id> <command>

Reference: https://docs.docker.com/engine/reference/commandline/exec/

mdhiggins commented 2 years ago

Quick test of

 docker exec -it --user $PUID sonarr bash

shows that I am successfully logged in as abc

abc@f9b0df2211ce:/$
KaHooli commented 2 years ago

Thank you, I was leaving out the --user option from the docker exec, dah!

I thought I was missing something obvious... that's what happens when you've been up all night then try and troubleshoot something.

I'll try that. Thanks again.

mdhiggins commented 2 years ago

No prob, easy fix