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

Unable to start server because it's unable to open the log file. #36

Closed ZenJakey closed 3 years ago

ZenJakey commented 4 years ago

I'm not really sure how to diagnose this issue, I'm using the default startup arguments. This is the only output on the commandline. I'm running ubuntu. image

ZenJakey commented 4 years ago

Changing the PUID and PGID both to 0 fixed this issue, thought I feel I shouldn't need to do that.

Dids commented 4 years ago

This is a permission issue then. The mounted bind volume (or Docker volume) should have 1000:1000 as the user/group, which should happen by default when you allow Docker to create the volumes, but if you're reusing existing ones, you may need to run chown -R 1000:1000 <volume path> to fix it.

ZenJakey commented 4 years ago

I have done that before. When the image creates the directories and chown's them, only serverConfig gets the chown operation done. Here's my current process. For context, here is my 7dtd.env and here is my docker-compose.yml.

So, from a clean directory I do the following: image

and here is the output from that run:

╔═════════════════════════════════════════════════╗
║    _____  _     _     _              _          ║
║   |  __ \(_)   | |   | |            (_)         ║
║   | |  | |_  __| |___| |_ ___  _ __  _  __ _    ║
║   | |  | | |/ _| / __| __/ _ \| |_ \| |/ _| |   ║
║   | |__| | | (_| \__ \ || (_) | |_) | | (_| |   ║
║   |_____/|_|\__|_|___/\__\___/| |__/|_|\__|_|   ║
║                               | |               ║
║                               |_|               ║
╠═════════════════════════════════════════════════╣
║ You are using an image that is based on         ║
║ a base image maintained by Didstopia.           ║
║                                                 ║
║ For more information:                           ║
║ https://github.com/Didstopia/docker-base-images ║
╚═════════════════════════════════════════════════╝

Running as user: docker
Using branch arguments: public
chown: changing ownership of '/steamcmd/7dtd': Operation not permitted
Installing/updating steamcmd..
x linux32/
x linux32/libstdc++.so.6
x linux32/steamcmd
x steamcmd.sh
x steam.sh
Installing/updating 7 Days to Die.. (this might take a while, be patient)
Redirecting stderr to '/app/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[  0%] Downloading update (0 of 77,197 KB)...
...
[100%] Download complete.
[----] Installing update...
[----] Extracting package...
...
[----] Extracting package...
[----] Installing update...
...
[----] Installing update...
[----] Cleaning up...
[----] Update complete, launching %appname%...
Redirecting stderr to '/app/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Downloading update (178 of 51,441 KB)...
[  0%] Downloading update (3,981 of 51,441 KB)...
...
[100%] Download complete.
[----] Installing update...
[----] Extracting package...
...
[----] Extracting package...
[----] Installing update...
...
[----] Installing update...
[----] Cleaning up...
[----] Update complete, launching Steamcmd...
Redirecting stderr to '/app/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.
@sSteamCmdForcePlatformType linux
"@sSteamCmdForcePlatformType" = "linux"

Connecting anonymously to Steam Public...Logged in OK
Waiting for user info...OK
force_install_dir /steamcmd/7dtd
app_update 294420 public validate
ERROR! Failed to install app '294420' (Disk write failure)
quit
Starting scheduled task manager..
ERROR: Default server configuration file not found, are you sure the server is up to date?

So, from here I did a ls -li to see ownership because of the disk write failure and the operation not permitted and re-did the chown -R 1000:1000 serverFiles/ to fix the error (customer is PUID and PGID 1000): image

And then restarted the server using docker start example7dtd_server_1. Here is the output from that second run.

╔═════════════════════════════════════════════════╗
║    _____  _     _     _              _          ║
║   |  __ \(_)   | |   | |            (_)         ║
║   | |  | |_  __| |___| |_ ___  _ __  _  __ _    ║
║   | |  | | |/ _| / __| __/ _ \| |_ \| |/ _| |   ║
║   | |__| | | (_| \__ \ || (_) | |_) | | (_| |   ║
║   |_____/|_|\__|_|___/\__\___/| |__/|_|\__|_|   ║
║                               | |               ║
║                               |_|               ║
╠═════════════════════════════════════════════════╣
║ You are using an image that is based on         ║
║ a base image maintained by Didstopia.           ║
║                                                 ║
║ For more information:                           ║
║ https://github.com/Didstopia/docker-base-images ║
╚═════════════════════════════════════════════════╝

Running as user: docker
Using branch arguments: public
Installing/updating steamcmd..
x linux32/
x linux32/libstdc++.so.6
x linux32/steamcmd
x steamcmd.sh
x steam.sh
Installing/updating 7 Days to Die.. (this might take a while, be patient)
Redirecting stderr to '/app/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[  0%] Downloading update (0 of 77,197 KB)...
...
[ 97%] Downloading update (77,197 of 77,197 KB)...
[100%] Download complete.
[----] Installing update...
[----] Extracting package...
...
[----] Extracting package...
[----] Installing update...
...
[----] Installing update...
[----] Cleaning up...
[----] Update complete, launching %appname%...
Redirecting stderr to '/app/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Downloading update (176 of 51,441 KB)...
[  0%] Downloading update (3,573 of 51,441 KB)...
...
[ 99%] Downloading update (51,441 of 51,441 KB)...
[100%] Download complete.
[----] Installing update...
[----] Extracting package...
[----] Extracting package...
[----] Extracting package...
[----] Extracting package...
[----] Installing update...
[----] Installing update...
...
[----] Installing update...
[----] Cleaning up...
[----] Update complete, launching Steamcmd...
Redirecting stderr to '/app/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.
@sSteamCmdForcePlatformType linux
"@sSteamCmdForcePlatformType" = "linux"

Connecting anonymously to Steam Public...Logged in OK
Waiting for user info...OK
force_install_dir /steamcmd/7dtd
app_update 294420 public validate
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
 Update state (0x11) preallocating, progress: 82.14 (7959995717 / 9690528152)
 Update state (0x11) preallocating, progress: 83.69 (8109985190 / 9690528152)
Warning: failed to init SDL thread priority manager: SDL not found
 Update state (0x61) downloading, progress: 0.02 (2097152 / 9690528152)
.....
 Update state (0x101) committing, progress: 86.29 (8362048565 / 9690528152)
Success! App '294420' fully installed.
quit
Starting scheduled task manager..
Config file not found, creating a new one..
Found path: /steamcmd/7dtd/7DaysToDieServer.x86_64
Unable to open log file, exiting.
Exiting..

And from there you're able to see the game was able to download from the chown, but the log file was still inaccessible, thus causing the game to not launch. So by "default" it only chown'd the serverConfig directory, not the serverFiles. And then it was unable to open the log file.

ZenJakey commented 4 years ago

In addition, inside of the serverFiles directory, everything was owned by PUID 1000: image

Dids commented 4 years ago

Hmm, everything should be owned by 1000:1000 by default, but I have only tested this on macOS and Docker Swarm (Ubuntu and CoreOS as the host OS). Which OS are you running these on?

I'll try to see if I can reproduce this, but it should definitely be working with the default PGID/PUID in multiple environments.

EDIT: The actual base image runs as root first, but fixes the permissions to match PGID/PUID, ultimately running the rest of the image as the specified user.

EDIT 2: Also, the base image ensures that both /app and /steamcmd are chown -R'd on startup.

ZenJakey commented 4 years ago

I'm on Ubuntu 18.04.3 LTS

ZenJakey commented 4 years ago

Aha! I figured it out. In my docker-compose I had image: didstopia/7dtd-server. So the first time I ran the docker image it fetched the latest release then (~7 months ago this happened, because in docker image ls it had a image created 7 months ago). So, it was using an archived image I guess. I updated that line to image: didstopia/7dtd-server:latest and rebuilt the container via docker-compose up -d, and it updated the image and worked flawlessly. So I must've been using a version that still had the default -logfile parameter. I truly appreciate the help.

Dids commented 4 years ago

Ahh, that would certainly explain it! At least this will serve as a good reference for others in the future. 😄

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.