jlesage / docker-makemkv

Docker container for MakeMKV
MIT License
435 stars 50 forks source link

[Bug] 55-makemkv.sh: ln: /config/.MakeMKV: Not supported #214

Closed niko86 closed 3 months ago

niko86 commented 3 months ago

Current Behavior

The docker container (running on portainer) seems to fail on a permission error on xdg and nginx, the storage is a smb share which I believe is now properly setup in the host linux OS.

EDIT: Initially the container startup failed due to [cont-init ] 55-makemkv.sh: ln: /config/.MakeMKV: Not supported i fixed this by adding "mfsymlinks" to my systems fstab.

Container creation

version: '3'
services:
  makemkv:
    image: jlesage/makemkv
    ports:
      - "5800:5800"
    volumes:
      - "/mnt/prox-share/docker/makemkv/config:/config:rw"
      - "/mnt/prox-share/docker/makemkv:/storage:ro"
      - "/mnt/prox-share/ripped:/output:rw"
    devices:
      - "/dev/sr0:/dev/sr0"
      - "/dev/sg1:/dev/sg1"

Container log

[init        ] container is starting...
[cont-env    ] loading container environment variables...
[cont-env    ] APP_NAME: loading...
[cont-env    ] APP_VERSION: loading...
[cont-env    ] DISPLAY: executing...
[cont-env    ] DISPLAY: terminated successfully.
[cont-env    ] DISPLAY: loading...
[cont-env    ] DOCKER_IMAGE_PLATFORM: loading...
[cont-env    ] DOCKER_IMAGE_VERSION: loading...
[cont-env    ] GTK2_RC_FILES: executing...
[cont-env    ] GTK2_RC_FILES: terminated successfully.
[cont-env    ] GTK2_RC_FILES: loading...
[cont-env    ] GTK_THEME: executing...
[cont-env    ] GTK_THEME: terminated successfully.
[cont-env    ] GTK_THEME: loading...
[cont-env    ] HOME: loading...
[cont-env    ] QT_STYLE_OVERRIDE: executing...
[cont-env    ] QT_STYLE_OVERRIDE: terminated successfully.
[cont-env    ] QT_STYLE_OVERRIDE: loading...
[cont-env    ] SUP_GROUP_IDS_INTERNAL: executing...
[cont-env    ] SUP_GROUP_IDS_INTERNAL: terminated successfully.
[cont-env    ] SUP_GROUP_IDS_INTERNAL: loading...
[cont-env    ] TAKE_CONFIG_OWNERSHIP: loading...
[cont-env    ] XDG_CACHE_HOME: loading...
[cont-env    ] XDG_CONFIG_HOME: loading...
[cont-env    ] XDG_DATA_HOME: loading...
[cont-env    ] XDG_RUNTIME_DIR: loading...
[cont-env    ] XDG_STATE_HOME: loading...
[cont-env    ] container environment variables initialized.
[cont-secrets] loading container secrets...
[cont-secrets] container secrets loaded.
[cont-init   ] executing container initialization scripts...
[cont-init   ] 10-certs.sh: executing...
[cont-init   ] 10-certs.sh: terminated successfully.
[cont-init   ] 10-check-app-niceness.sh: executing...
[cont-init   ] 10-check-app-niceness.sh: terminated successfully.
[cont-init   ] 10-clean-logmonitor-states.sh: executing...
[cont-init   ] 10-clean-logmonitor-states.sh: terminated successfully.
[cont-init   ] 10-clean-tmp-dir.sh: executing...
[cont-init   ] 10-clean-tmp-dir.sh: terminated successfully.
[cont-init   ] 10-fontconfig-cache-dir.sh: executing...
[cont-init   ] 10-fontconfig-cache-dir.sh: terminated successfully.
[cont-init   ] 10-init-users.sh: executing...
[cont-init   ] 10-init-users.sh: terminated successfully.
[cont-init   ] 10-nginx.sh: executing...
[cont-init   ] 10-nginx.sh: terminated successfully.
[cont-init   ] 10-openbox.sh: executing...
[cont-init   ] 10-openbox.sh: terminated successfully.
[cont-init   ] 10-pkgs-mirror.sh: executing...
[cont-init   ] 10-pkgs-mirror.sh: terminated successfully.
[cont-init   ] 10-set-tmp-dir-perms.sh: executing...
[cont-init   ] 10-set-tmp-dir-perms.sh: terminated successfully.
[cont-init   ] 10-vnc-password.sh: executing...
[cont-init   ] 10-vnc-password.sh: terminated successfully.
[cont-init   ] 10-web-data.sh: executing...
[cont-init   ] 10-web-data.sh: terminated successfully.
[cont-init   ] 10-x11-unix.sh: executing...
[cont-init   ] 10-x11-unix.sh: terminated successfully.
[cont-init   ] 10-xdg-runtime-dir.sh: executing...
[cont-init   ] 10-xdg-runtime-dir.sh: terminated successfully.
[cont-init   ] 15-cjk-font.sh: executing...
[cont-init   ] 15-cjk-font.sh: terminated successfully.
[cont-init   ] 15-install-pkgs.sh: executing...
[cont-init   ] 15-install-pkgs.sh: terminated successfully.
[cont-init   ] 54-check-optical-drive.sh: executing...
[cont-init   ] 54-check-optical-drive.sh: looking for usable optical drives...
[cont-init   ] 54-check-optical-drive.sh: found optical drive [/dev/sr0, /dev/sg1], group 24.
[cont-init   ] 54-check-optical-drive.sh: terminated successfully.
[cont-init   ] 55-makemkv.sh: executing...
[cont-init   ] 55-makemkv.sh: checking for new beta key...
[cont-init   ] 55-makemkv.sh: registration key already up-to-date.
[cont-init   ] 55-makemkv.sh: getting supported drives...
[cont-init   ] 55-makemkv.sh: terminated successfully.
[cont-init   ] 85-take-config-ownership.sh: executing...
[cont-init   ] 85-take-config-ownership.sh: terminated successfully.
[cont-init   ] 89-info.sh: executing...
    ╭――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╮
    │                                                                      │
    │ Application:           MakeMKV                                       │
    │ Application Version:   1.17.7                                        │
    │ Docker Image Version:  24.06.1                                       │
    │ Docker Image Platform: linux/amd64                                   │
    │                                                                      │
    ╰――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╯
[cont-init   ] 89-info.sh: terminated successfully.
[cont-init   ] all container initialization scripts executed.
[init        ] giving control to process supervisor.
[supervisor  ] loading services...
[supervisor  ] loading service 'default'...
[supervisor  ] loading service 'app'...
[supervisor  ] loading service 'gui'...
[supervisor  ] loading service 'openbox'...
[supervisor  ] loading service 'xvnc'...
[supervisor  ] loading service 'certsmonitor'...
[supervisor  ] service 'certsmonitor' is disabled.
[supervisor  ] loading service 'nginx'...
[supervisor  ] loading service 'logmonitor'...
[supervisor  ] service 'logmonitor' is disabled.
[supervisor  ] loading service 'logrotate'...
[supervisor  ] loading service 'autodiscripper-2'...
[supervisor  ] service 'autodiscripper-2' is disabled.
[supervisor  ] loading service 'autodiscripper-11'...
[supervisor  ] service 'autodiscripper-11' is disabled.
[supervisor  ] loading service 'autodiscripper-8'...
[supervisor  ] service 'autodiscripper-8' is disabled.
[supervisor  ] loading service 'autodiscripper-14'...
[supervisor  ] service 'autodiscripper-14' is disabled.
[supervisor  ] loading service 'autodiscripper-4'...
[supervisor  ] service 'autodiscripper-4' is disabled.
[supervisor  ] loading service 'autodiscripper-10'...
[supervisor  ] service 'autodiscripper-10' is disabled.
[supervisor  ] loading service 'autodiscripper-0'...
[supervisor  ] service 'autodiscripper-0' is disabled.
[supervisor  ] loading service 'autodiscripper-3'...
[supervisor  ] service 'autodiscripper-3' is disabled.
[supervisor  ] loading service 'autodiscripper-13'...
[supervisor  ] service 'autodiscripper-13' is disabled.
[supervisor  ] loading service 'autodiscripper-9'...
[supervisor  ] service 'autodiscripper-9' is disabled.
[supervisor  ] loading service 'autodiscripper-1'...
[supervisor  ] service 'autodiscripper-1' is disabled.
[supervisor  ] loading service 'autodiscripper-12'...
[supervisor  ] service 'autodiscripper-12' is disabled.
[supervisor  ] loading service 'autodiscripper-5'...
[supervisor  ] service 'autodiscripper-5' is disabled.
[supervisor  ] loading service 'autodiscripper-7'...
[supervisor  ] service 'autodiscripper-7' is disabled.
[supervisor  ] loading service 'autodiscripper'...
[supervisor  ] service 'autodiscripper' is disabled.
[supervisor  ] loading service 'autodiscripper-6'...
[supervisor  ] service 'autodiscripper-6' is disabled.
[supervisor  ] loading service 'autodiscripper-15'...
[supervisor  ] service 'autodiscripper-15' is disabled.
[supervisor  ] all services loaded.
[supervisor  ] starting services...
[supervisor  ] starting service 'xvnc'...
[xvnc        ] Xvnc TigerVNC 1.13.1 - built Dec 21 2023 00:55:16
[xvnc        ] Copyright (C) 1999-2022 TigerVNC Team and many others (see README.rst)
[xvnc        ] See https://www.tigervnc.org for information on TigerVNC.
[xvnc        ] Underlying X server release 12014000
[xvnc        ] Tue Jun 25 22:32:43 2024
[xvnc        ]  vncext:      VNC extension running!
[xvnc        ]  vncext:      Listening for VNC connections on /tmp/vnc.sock (mode 0660)
[xvnc        ]  vncext:      Listening for VNC connections on all interface(s), port 5900
[xvnc        ]  vncext:      created VNC server for screen 0
[supervisor  ] starting service 'openbox'...
[openbox     ] Openbox-Message: 22:32:43.705: Unable to make directory '/config/xdg/cache/openbox': Permission denied
[openbox     ] Fontconfig error: No writable cache directories
[openbox     ] Fontconfig error: No writable cache directories
[openbox     ] Fontconfig error: No writable cache directories
[openbox     ] Fontconfig error: No writable cache directories
[openbox     ] Fontconfig error: No writable cache directories
[openbox     ] Fontconfig error: No writable cache directories
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTP connections on port 5800.
[nginx       ] nginx: [alert] could not open error log file: open() "/config/log/nginx/error.log" failed (13: Permission denied)
[nginx       ] 2024/06/25 22:32:44 [emerg] 848#848: open() "/config/log/nginx/error.log" failed (13: Permission denied)
[supervisor  ] service 'nginx' failed to be started: not ready after 5000 msec, giving up.
[supervisor  ] stopping service 'nginx'...
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] stopping service 'openbox'...
[supervisor  ] service 'openbox' exited (with status 0).
[supervisor  ] stopping service 'xvnc'...
[xvnc        ] Tue Jun 25 22:32:49 2024
[xvnc        ]  ComparingUpdateTracker: 0 pixels in / 0 pixels out
[xvnc        ]  ComparingUpdateTracker: (1:-nan ratio)
[supervisor  ] service 'xvnc' exited (with status 0).
[finish      ] executing container finish scripts...
[finish      ] all container finish scripts executed.
jlesage commented 3 months ago

Is /mnt/prox-share/docker/makemkv/config mounted with a specific user/group id ? Looks like the container doesn't have permission to write to it. Note that by default, the container runs with user/group ID 1000/1000. This can be changed via USER_ID and GROUP_ID environment variables if needed.

niko86 commented 3 months ago

Thank you for the response. I’m very much an amateur when using Linux but I checked the user I’m running portainer under and it’s uid and gid are both 1000.

I got things working using a config and user location in a docker volume. But I couldn’t locate the SMB share for ripping to so was obviously still a permissions problem.

TRUENAS which is serving the share has the SMB user setup with suitable permissions, but no SUDO ability. I can confirm the docker images can write folders and some files like a .conf (forget the name as I’m not at my PC, not in the log as it has been generated on a previous boot of the container). So I assume your docker container requires the ability to make some files with SUDO? I’ll try adding SUDO permission in TRUENAS as well.

jlesage commented 3 months ago

I can confirm the docker images can write folders and some files like a .conf

How did you test that ? Writing as root from the container might work, but not from user 1000/1000.

So I assume your docker container requires the ability to make some files with SUDO?

sudo is not needed. The problems seems that writing as user 1000/1000 is not allowed by the SMB mount on truenas. Usually, when you mount a share on linux, you have the ability to specify the associated user/group id. For example, see https://serverfault.com/a/49238.

niko86 commented 3 months ago

How did you test that ? Writing as root from the container might work, but not from user 1000/1000.

It worked just with the default 1000/1000, which is why I was surprised it failed on the services. I'm finding Linux permissions are a very steep learning curve! In TrueNAS the user and group ids are 3000/3000, videos on YouTube show others with 1000/1000 so definitely is something i have configured incorrectly. I will read over that article this evening, thank you for your help.

niko86 commented 3 months ago

Ok got to the bottom of the issue, my mistake in setting the share in fstab, i used the UID and GID from TRUENAS e.g. 3000/3000 rather than the local user UID and GID of 1000/1000. Once it was changed its all working.

So not a bug in the container, but hopefully my mistake might help someone else.

A huge thank you jlesage for the guidance in the right direction and this great container :)