kobrient / valheim_dedicated

Valheim dedicated server in a docker container
1 stars 1 forks source link

docker-compose does not work after pull #2

Closed philx02 closed 3 years ago

philx02 commented 3 years ago

I was running this dedicated server fine until I did a pull from the recent changes and when I try to start the server interactively with

docker-compose -f docker-compose.scratch.yml run --service-ports valheim-dedicated-scratch

and then run runserver.sh, it works fine, but when I try to run it with

docker-compose up

I got this output (near the end):

Successfully built 243e5f9b54df
Successfully tagged valheim_dedicated_valheim-dedicated:latest
WARNING: Image for service valheim-dedicated was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating valheim_dedicated_valheim-dedicated_1 ... done
Attaching to valheim_dedicated_valheim-dedicated_1
valheim-dedicated_1  | WARN: Skipping dependencies because you're not root
valheim-dedicated_1  | WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'. International characters may not work.
valheim-dedicated_1  | Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
valheim-dedicated_1  | [  0%] Checking for available updates...
valheim-dedicated_1  | [----] Downloading update (0 of 16258 KB)...
valheim-dedicated_1  | [  0%] Downloading update (1504 of 16258 KB)...
valheim-dedicated_1  | [  9%] Downloading update (3228 of 16258 KB)...
valheim-dedicated_1  | [ 19%] Downloading update (4937 of 16258 KB)...
valheim-dedicated_1  | [ 30%] Downloading update (6659 of 16258 KB)...
valheim-dedicated_1  | [ 40%] Downloading update (8530 of 16258 KB)...
valheim-dedicated_1  | [ 52%] Downloading update (10185 of 16258 KB)...
valheim-dedicated_1  | [ 62%] Downloading update (11895 of 16258 KB)...
valheim-dedicated_1  | [ 73%] Downloading update (13593 of 16258 KB)...
valheim-dedicated_1  | [ 83%] Downloading update (15321 of 16258 KB)...
valheim-dedicated_1  | [ 94%] Downloading update (16258 of 16258 KB)...
valheim-dedicated_1  | [100%] Download complete.
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Extracting package...
valheim-dedicated_1  | [----] Extracting package...
valheim-dedicated_1  | [----] Extracting package...
valheim-dedicated_1  | [----] Extracting package...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Installing update...
valheim-dedicated_1  | [----] Cleaning up...
valheim-dedicated_1  | [----] Update complete, launching Steamcmd...
valheim-dedicated_1  | WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'. International characters may not work.
valheim-dedicated_1  | Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
valheim-dedicated_1  | [  0%] Checking for available updates...
valheim-dedicated_1  | [----] Verifying installation...
valheim-dedicated_1  | Steam Console Client (c) Valve Corporation
valheim-dedicated_1  | -- type 'quit' to exit --
valheim-dedicated_1  | Loading Steam API...OK.
valheim-dedicated_1  |
valheim-dedicated_1  | Connecting anonymously to Steam Public...Logged in OK
valheim-dedicated_1  | Waiting for user info...OK
valheim-dedicated_1  | Success! App '896660' already up to date.
valheim-dedicated_1  | Starting server PRESS CTRL-C to exit
valheim-dedicated_1  | /home/steam/valheim-scripts/runserver.sh: line 75: valheim_server.pid: Permission denied
valheim-dedicated_1  | /home/steam/valheim-scripts/runserver.sh: line 72: valheim_stdout.log: Permission denied
valheim_dedicated_valheim-dedicated_1 exited with code 1

Apparently we need to be root in the container and we are not?

kobrient commented 3 years ago

If, at any point, you run the server as root (docker-compose.scratch.yml / valheim-dedicated-scratch) the container will write out the logfiles as the root user. Since these are in a shared & volumed directory and they don't get automatically cleaned up, when you later run the service normally (docker compose up) then the less privileged steam user can't write over the logfiles that root created earlier, hence the permissions error you ran into.

I would suggest just cleaning up the files in valheim-data/ that were written as root before switching back to using the service in a non-root mode.