Renegade-Master/zomboid-dedicated-server

Running as Root User - No such file or directory

pawl opened this issue ยท 10 comments

pawl commented

I tried to use docker-compose up with this project, and it encountered this error and didn't finish starting the server:

zomboid-server_1  | ### Starting Project Zomboid Server...
zomboid-server_1  | timeout: failed to run command '/home/steam/ZomboidDedicatedServer/start-server.sh': No such file or directory
zomboid-server_1  | 
zomboid-server_1  | ### First run check complete.
zomboid-server_1  | 
zomboid-server_1  | ### Applying Post Install Configuration...
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer_SandboxVars.lua: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/ZomboidDedicatedServer/ProjectZomboid64.json: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer.ini: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer_SandboxVars.lua: No such file or directory
zomboid-server_1  | sed: can't read /home/steam/Zomboid/Server/ZomboidServer_SandboxVars.lua: No such file or directory
zomboid-server_1  | 
zomboid-server_1  | ### Post Install Configuration applied.
zomboid-server_1  | 
zomboid-server_1  | ### Starting Project Zomboid Server...
zomboid-server_1  | timeout: failed to run command '/home/steam/ZomboidDedicatedServer/start-server.sh': No such file or directory

Hmm...
Is this repeatable? Does it happpen if you tried again?

This is an example of what a successful run should look like. Everything above the line I linked should also happen.

pawl commented

It's repeatable on Ubuntu 20.04.3. Maybe it has something to do with me running as root?

pawl commented

I was able to use this other project's image successfully: https://github.com/PepeCitron/projectzomboid-server

Maybe the fix is in there?

Ah, you shouldn't be running it as root. There is no need.

Running containers as root isn't advised anywhere, especially on a server connected directly to the Internet.

If there is some way that an attacker can gain root access in the Docker Container, it is much easier for them to gain root access on the Host too.

Better to stick with User accounts. If you follow the instructions in the Readme, you should have no issues running without sudo ๐Ÿ™‚

@pawl, I take it that I can close this issue now?
You raised a good point though, and I should probably mention in the README that this image is not intended to be run as the root user to prevent this confusion for others.

Ah, you shouldn't be running it as root. There is no need.

Running containers as root isn't advised anywhere, especially on a server connected directly to the Internet.

If there is some way that an attacker can gain root access in the Docker Container, it is much easier for them to gain root access on the Host too.

Better to stick with User accounts. If you follow the instructions in the Readme, you should have no issues running without sudo ๐Ÿ™‚

Use runuser -l docker -c 'printf "UID: %s\nGID: %s\n" $(id -u) $(id -g)' to get the proper numbers for the docker user. This worked for me on Vultr's default Docker instance.

    USER_ID: 1000
    GROUP_ID: 998
restart: unless-stopped
user: "1000:998"

Use runuser -l docker -c 'printf "UID: %s\nGID: %s\n" $(id -u) $(id -g)' to get the proper numbers for the docker user. This worked for me on Vultr's default Docker instance.

    USER_ID: 1000
    GROUP_ID: 998
restart: unless-stopped
user: "1000:998"

Yep, just like that. I have a similar solution in the README both here and here.

Seeing as there are several ways around this issue that have been highlighted, and none of them are actual issues with the image, I am going to go ahead and close this issue now.

It is pinned for reference though, because there is some good information here.

pawl commented

@Renegade-Master thanks for looking into it! Yeah closing sounds good.

Something weird is happening: I'm trying to run it with my default user (1000:1000) and from the first step, when updating ownership, it throws an error "operation not permitted".

Something weird is happening: I'm trying to run it with my default user (1000:1000) and from the first step, when updating ownership, it throws an error "operation not permitted".

Oh, sorry. I only just saw this, @CalvoUTN.
I take it that the other ticket you raised (#10) was after you resolved this issue?