docker-makemkv icon indicating copy to clipboard operation
docker-makemkv copied to clipboard

Failing to start with NFS-mounted output

Open 34will opened this issue 3 years ago • 9 comments

When the /output volume is mounted to an NFS (v4) share, the container fails to start with the error:

chown: /output: Invalid argument
[cont-init.d] 90-makemkv.sh: ERROR: Failed to take ownership and no write permission on /output.
[cont-init.d] 90-makemkv.sh: exited 1.

However I can confirm that I can write to the location.

34will avatar May 14 '21 18:05 34will

Did you check that the user configured as USER_ID/GROUP_ID does have write access ? This is what the failed check is doing.

jlesage avatar May 17 '21 21:05 jlesage

Yes, it does seem to have write access. I spun up a second container of justcontainers/base-alpine:latest to test the s6 compatibility, with that volume mounted in it. I then created a script to mimic the ownership tests:

#!/usr/bin/with-contenv sh

if s6-setuidgid 1000:1000 [ ! -w /output ]; then
        echo "No Write Access"
else
        echo "Write Access"
fi

if s6-setuidgid 1000:1000 mkdir /output/temp ; then
        echo "Write Access"
else
        echo "No Write Access"
fi

if [ ! -w /output ]; then
        echo "No Write Access"
else
        echo "Write Access"
fi

(I know the chown doesn't work because of the above errors) After running the above, I got the following output:

No Write Access
Write Access
Write Access

And I can verify that the /output/temp directory was successfully created.

So (to me) it looks like a weird interaction between s6-setuidgid and the bash [ -w <folder> ] check. I have had problems in the past with these kinds of volumes on my system, (NFSv4 on TrueNAS Core, i.e. FreeBSD) but they've largely worked because the other containers I've run just try the chown and assume that's good enough 😅 which is why is my pull request #116 I just added a flag to disable the check, since my above test script seems to indicate no problems actually writing to it.

Also, my issue and pull request on your HandBrake repo are the same issue and resolution.

34will avatar May 19 '21 00:05 34will

To have a complete picture of the problem, could you provide the output of ls -ld /output ?

I think that it should be possible to fix the check itself.

jlesage avatar May 19 '21 00:05 jlesage

ls -ld /output gives:

drwxrwxr--    3 42949672 42949672         3 May 19 00:48 /output/

34will avatar May 19 '21 00:05 34will

I adjusted the write test. Can you try the latest image to see if it fixes your issue ?

jlesage avatar Jul 24 '21 02:07 jlesage

Yes, that works great! Thank you for changing it. I do still have to run it with the TAKE_CONFIG_OWNERSHIP flag, because the /config folder has the same issue, so I don't know if you'd want to change the check there too.

Also, I know it's a lot to ask, but would you be able to adapt https://github.com/jlesage/docker-handbrake and https://github.com/jlesage/docker-mkvtoolnix to use this check too? I want to use them too, but this issue stops me with them as well. Much thanks!

34will avatar Jul 26 '21 12:07 34will

Thanks for confirming that the /output folder is now working for you. I will do the change for the /config folder as well.

And yes, I will make sure other contains are also fixed. There are no new images yet, but the fix for the /output folder is already propagated to other containers.

jlesage avatar Jul 26 '21 12:07 jlesage

Shouldn't you simply use the mount type nfs for the volume itself instead of tweaking that in the container?

Wobak avatar Sep 20 '22 22:09 Wobak

@34will, do you still have the same setup? I would be interested in your NFS server configuration.

jlesage avatar Feb 11 '23 04:02 jlesage