Didstopia / 7dtd-server

Provides a dedicated linux server for 7 Days to Die running inside a Docker container.
MIT License
108 stars 45 forks source link

Can't start server because of permission denied #30

Closed PascalMinder closed 4 years ago

PascalMinder commented 4 years ago

I use the following command to create the server:

docker run -d \
   --name=7d2d \
   -e PUID=1000 \
   -e PGID=100 \
   -e TZ=Europe/Zurich \
   -v /sharedfolders/docker/config/7d2d/steam:/steamcmd/7dtd \
   -v /sharedfolders/docker/config/7d2d/game:/app/.local/share/7DaysToDie \
   -p 26900-26902:26900-26902 \
   -p 26900-26902:26900-26902/udp \
   didstopia/7dtd-server

This leads to creation of two folders game and steam. The game folder has the right user permissions, while the steam folder has root:root. This leads to the error:

/app/start.sh: line 116: /steamcmd/7dtd/7DaysToDieServer.x86_64: Permission denied

Dids commented 4 years ago

Both volumes need to be set to the same user id (PUID) and group id (PGID).

PascalMinder commented 4 years ago
image

Yes they are. But still the same error

Dids commented 4 years ago

Just to be sure, did your run chown -R to apply the permissions recursively?

I'll be deploying a potential fix upstream to the base images, which should fix this automagically. I'll let you know when the fix is live.

Dids commented 4 years ago

Okay, can you pull the latest version and give that one a go? It should now always fix the permissions on startup, so long as you're not using any custom container paths, outside of /steamcmd and /app.

PascalMinder commented 4 years ago

I will try it tonight. Thanks

PascalMinder commented 4 years ago

Hmm, I still have the same error. Is there any way to get more error information? I am trying to run it on an OMV host.

Dids commented 4 years ago

Could you try deleting the volumes/folders again? Both game and steam should now be under the non-root user, and the permissions are set whenever the container starts. Additionally, could you try running the container as root, if the previous attempt fails? Just sudo docker run ... should do, just to rule out anything else.

PascalMinder commented 4 years ago

I will try it tonight. Sorry for the late reply.

PascalMinder commented 4 years ago

So I tried it again tonight. First I deleted everything. Then I created both folders: image After that I created the container with the following:

docker run -d \
   --name=7d2d \
   -e PUID=1000 \
   -e PGID=100 \
   -e TZ=Europe/Zurich \
   -v /sharedfolders/docker/config/7d2d/steam:/steamcmd/7dtd \
   -v /sharedfolders/docker/config/7d2d/game:/app/.local/share/7DaysToDie \
   -p 26900-26902:26900-26902 \
   -p 26900-26902:26900-26902/udp \
   didstopia/7dtd-server 

image image image

Could it be that somehow the platforms are incompatible?

image

image

Dids commented 4 years ago

Have you tried without creating the folders manually? Because Docker should ideally be in charge of creating them, as then it could also set the permissions accordingly.

PascalMinder commented 4 years ago

I might have found the issue. cat /etc/mtab gives me: /dev/md0 /home/steam/7d2d/server ext4 rw,noexec,relatime,stripe=384,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group 0 0 /dev/md0 /home/steam/7d2d/save ext4 rw,noexec,relatime,stripe=384,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group 0 0

I think the problem is noexec

Dids commented 4 years ago

It's possible, but then noexec should be coming from the filesystem/partition mount flags and there's not much Docker can do about it.

PascalMinder commented 4 years ago

Yeah, OMV does this for the data partition. So I guess it's my error. Sorry.

Dids commented 4 years ago

No worries! As a last resort, you could try again, but this time with PUID=0 and PGID=0, which would effectively run the container as root again.