Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running as Root User - No such file or directory #8

Closed
pawl opened this issue Jan 30, 2022 · 10 comments
Closed

Running as Root User - No such file or directory #8

pawl opened this issue Jan 30, 2022 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@pawl
Copy link

pawl commented Jan 30, 2022

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
@Renegade-Master Renegade-Master self-assigned this Jan 31, 2022
@Renegade-Master Renegade-Master added the bug Something isn't working label Jan 31, 2022
@Renegade-Master
Copy link
Owner

Renegade-Master commented Jan 31, 2022

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
Copy link
Author

pawl commented Feb 1, 2022

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

@pawl
Copy link
Author

pawl commented Feb 1, 2022

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

Maybe the fix is in there?

@Renegade-Master
Copy link
Owner

Renegade-Master commented Feb 1, 2022

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 🙂

@Renegade-Master Renegade-Master pinned this issue Feb 1, 2022
@Renegade-Master Renegade-Master changed the title start-server.sh - No such file or directory Running as Root User - No such file or directory Feb 1, 2022
@Renegade-Master
Copy link
Owner

@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.

@ASBaumgarten
Copy link

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"

@Renegade-Master
Copy link
Owner

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
Copy link
Author

pawl commented Feb 8, 2022

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

@francocalvo
Copy link

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".

@Renegade-Master
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants