GioF71 / minidlna-docker

Easily run MiniDLNA with Docker
Apache License 2.0
45 stars 1 forks source link

Syntax error in run-minidlna.sh #12

Closed cneukom closed 10 months ago

cneukom commented 10 months ago

Hi there

I'm trying to run MiniDLNA using your Docker image. Unfortunately, I'm getting this error message:

/app/bin/run-minidlna.sh: line 97: [: too many arguments
/app/bin/run-minidlna.sh: line 97: [: too many arguments

I use this command to start the container:

$ docker run -d --name=minidlna \
  -e USER_MODE=Y \
  -e MINIDLNA_ROOT_CONTAINER=V \
  -e MINIDLNA_DIR_V_1=/media/videos \
  -e MINIDLNA_ENABLE_INOTIFY=YES \
  -e MINIDLNA_FRIENDLY_NAME=MiniDLNA \
  -v /.../videos:/media/videos \
  -v /.../log:/log \
  -v /.../db:/db \
  --net=host \
  giof71/minidlna
$ docker logs minidlna 
Current user id is [0]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[/media/videos]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
/app/bin/run-minidlna.sh: line 97: [: too many arguments
/app/bin/run-minidlna.sh: line 97: [: too many arguments
# MINIDLNA CONFIG
media_dir=V,/media/videos
db_dir=/db
log_dir=/log
root_container=V
port=8200
friendly_name=gioDLNA
inotify=yes
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
force_sort_criteria=
CMD_LINE=/usr/sbin/minidlnad -S -f /tmp/minidlna.conf -P /tmp/minidlnad.pid
USER_MODE=[N]
$ cat /.../log/minidlna.log 
minidlna.c:521: warn: Unset locale
minidlna.c:1126: warn: Starting MiniDLNA version 1.3.0.
sql.c:88: error: prepare failed: no such table: SETTINGS
SELECT VALUE from SETTINGS where KEY = 'UPDATE_ID'
minidlna.c:393: warn: Creating new database at /db/files.db
minidlna.c:405: fatal: Failed to clean old file cache!  Exiting...

Am I doing something wrong?

GioF71 commented 10 months ago

Hello, I think you are doing nothing wrong, the is a bug for sure, I will be checking asap

GioF71 commented 10 months ago

Please try the newest version. Your paths don't look correct:

  -v /.../videos:/media/videos \
  -v /.../log:/log \
  -v /.../db:/db \

maybe you wanted:

  -v ./videos:/media/videos \
  -v ./log:/log \
  -v ./db:/db \

Let me know!

GioF71 commented 10 months ago

new images are now available

cneukom commented 10 months ago

Thanks for having a look so quickly!

It looks better - the error message too many arguments is gone :)

However, the fatal log line Failed to clean old file cache! Exiting... in the minidlna.log is still there. So, that seems to be a separate issue:

minidlna.c:521: warn: Unset locale
minidlna.c:1126: warn: Starting MiniDLNA version 1.3.0.
minidlna.c:393: warn: Creating new database at /db/files.db
minidlna.c:405: fatal: Failed to clean old file cache!  Exiting...

Your paths don't look correct:

Yes, I replaced the real paths from my system with ... before pasting the command here, but the paths seem not to be the problem, as the log and DB file get created where I'd expect them :)

GioF71 commented 10 months ago

Hello, I don't have the issues with the db... maybe check the permissions although they should be set by the run script. A better way than this user mode is using the --user method which is supported since the end of last year. Maybe can you post your final docker compose file so I can try and reproduce the issue?

cneukom commented 10 months ago

Hmm, when I use --user with docker run, it does not run minidlna in user mode:

$ docker run -d --name=minidlna --user="1000:1000" -e MINIDLNA_ROOT_CONTAINER=V -e MINIDLNA_DIR_V_1=/media/videos -e MINIDLNA_ENABLE_INOTIFY=YES -e MINIDLNA_FRIENDLY_NAME=gioDLNA -v /.../videos:/videos -v /.../log:/log -v /.../db:/db --net=host giof71/minidlna && docker logs minidlna
abc408cbdfddef27c633676672978d65f18a778d1750f0ca5a2a57327554442b
Current user id is [1000]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[/media/videos]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
# MINIDLNA CONFIG
media_dir=V,/media/videos
db_dir=/db
log_dir=/log
root_container=V
port=8200
friendly_name=gioDLNA
inotify=yes
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
force_sort_criteria=
CMD_LINE=/usr/sbin/minidlnad -S -f /tmp/minidlna.conf -P /tmp/minidlnad.pid
USER_MODE=[N]

However, regarding the db issue, I have tried to run the Docker image on a different machine, and there it works out of the box. So there might be a problem with my Docker setup...

GioF71 commented 10 months ago

Hello, yes it is running in user mode, see this line:

Current user id is [1000]

Considering that the container does not run as root (uid=0) it will not (and would have not been able to) create a user. It will run using the current user, in your case the one with uid=1000

I'm glad to hear that it works on another setup. Anyway we can try and reproduce the issue (and maybe fix it if needed) if you want to.

cneukom commented 10 months ago

Ah, I see! I was confused by the last line USER_MODE=[N], but that makes sense now.

Actually, the "other machine" is the machine where I intended to run it in the first place. Also, I was able to run some tests and it looks good. So, I am happy the way it is :)

Thanks a lot!

GioF71 commented 10 months ago

Thank you for the feedback. Consider starring the repo if that is not an issue for you. Cheers!