steamcmd / docker

Docker image containing SteamCMD
https://hub.docker.com/r/steamcmd/steamcmd
MIT License
148 stars 20 forks source link

Strange inconsistency with 'SteamApps' folder name between different host operating systems #59

Closed resuni closed 2 years ago

resuni commented 2 years ago

I'm experiencing a strange problem where on my Debian hosts, apps get installed to ~/.steam/SteamApps, but on my Arch hosts, apps get installed to ~/.steam/steamapps (note the case difference).

I can reproduce the problem with the following Dockerfile:

FROM steamcmd/steamcmd:ubuntu-20
RUN steamcmd +login anonymous +app_update 232250 +quit
ENTRYPOINT ["tail", "-f", "/dev/null"]

The app I'm installing in this example is TF2, but I've seen the same thing when installing Source SDK Base 2013 Dedicated Server, so I don't think this problem is dependent on the app.

Build: docker build -t steamcmd-test .

Run: docker run --name test steamcmd-test

Shell into the container in another terminal: docker exec -it test bash

Inside the container: ls -l .steam

The output on my Debian hosts:

total 32
drwxr-xr-x 1 root root 4096 Aug  9 21:16 appcache
drwxr-xr-x 1 root root 4096 Aug  9 21:21 config
drwxr-xr-x 2 root root 4096 Aug  9 21:15 depotcache
drwxr-xr-x 1 root root 4096 Aug  9 21:15 logs
-rwxr-xr-x 1 root root  224 Aug  9 21:21 registry.vdf
lrwxrwxrwx 1 root root   12 Aug  9 18:21 root -> /root/.steam
lrwxrwxrwx 1 root root   12 Aug  9 18:21 steam -> /root/.steam
drwxr-xr-x 1 root root 4096 Aug  9 21:21 SteamApps
drwxr-xr-x 1 root root 4096 Aug  9 21:15 steamcmd
drwxr-xr-x 3 root root 4096 Aug  9 21:15 userdata

The output on my Arch hosts:

total 36
drwxr-xr-x 1 root root 4096 Aug  9 21:58 appcache
drwxr-xr-x 1 root root 4096 Aug  9 22:03 config
drwxr-xr-x 2 root root 4096 Aug  9 21:58 depotcache
drwxr-xr-x 1 root root 4096 Aug  9 21:58 logs
-rwxr-xr-x 1 root root  224 Aug  9 22:03 registry.vdf
lrwxrwxrwx 1 root root   12 Aug  9 18:21 root -> /root/.steam
lrwxrwxrwx 1 root root   12 Aug  9 18:21 steam -> /root/.steam
drwxr-xr-x 5 root root 4096 Aug  9 22:03 steamapps
drwxr-xr-x 1 root root 4096 Aug  9 21:58 steamcmd
drwxr-xr-x 3 root root 4096 Aug  9 21:58 userdata

For the sake of the test, I've made sure to re-download the steamcmd container. Both my test hosts are using the ubuntu-20 image with an Image ID of 1aa5e865e28c:

REPOSITORY          TAG         IMAGE ID       CREATED          SIZE
steamcmd/steamcmd   ubuntu-20   1aa5e865e28c   4 hours ago      406MB

What is the intended casing of this directory? What difference between the two host operating systems or host Docker configs could possibly be causing the discrepancy?

jonakoudijs commented 2 years ago

My guess is that this is because of a wrapper script that is added by default when installing from an Ubuntu/Debian package. For the other Linux containers I add this wrapper script at build time because they don't contain pre-build packages. See for example the Rocky container Dockerfile.

To make this is consistent I would recommend to (always) use the +force_install_dir parameter like this:

steamcmd +login anonymous +force_install_dir /data +app_update 232250 +quit
resuni commented 2 years ago

I don't understand your explanation regarding the wrapper script, but specifying +force_install_dir did make this a non-issue. Not only did it make the naming of the steamapps directory consistent, it also caused the app to not be installed there, so I no longer have to reference the directory at all.

While this is an acceptable solution for me, this is still a bizarre issue, so rather than close this issue myself, I'll let someone else decide if this is something that needs to be addressed further.

jonakoudijs commented 2 years ago

Good to hear the force_install_dir option fixed your issue. The wrapper script I referred to is a script that is placed when installing steamcmd from a Ubuntu repository package, like:

apt-get install steamcmd

Installing steamcmd through the Ubuntu repository package will create this wrapper script around existing steamcmd scripts:

$ cat /usr/games/steamcmd

#!/bin/sh
# Copyright (C) 2015 Alexandre Detiste <alexandre@detiste.be>
# License: MIT

# create a fake Steam installation to avoid
# that steamcmd uses "/home/$user/Steam" instead
if [ ! -e ~/.steam ]
then
    mkdir -p ~/.steam/appcache/
    mkdir -p ~/.steam/config/
    mkdir -p ~/.steam/logs/
    mkdir -p ~/.steam/SteamApps/common/
    ln -s ~/.steam ~/.steam/root
    ln -s ~/.steam ~/.steam/steam
fi

if [ ! -e ~/.steam/steamcmd ]
then
    mkdir -p ~/.steam/steamcmd/linux32
    # steamcmd will replace these files with newer ones itself on first run
    cp /usr/lib/games/steam/steamcmd.sh ~/.steam/steamcmd/
    cp /usr/lib/games/steam/steamcmd    ~/.steam/steamcmd/linux32/
fi
exec ~/.steam/steamcmd/steamcmd.sh $@

Other distributions like Rocky Linux or Alpine don't contain steamcmd packages so you would have to download the steamcmd files manually, like:

$ curl http://media.steampowered.com/installer/steamcmd_linux.tar.gz \
    --output steamcmd.tar.gz --silent
$ tar -xvzf steamcmd.tar.gz && rm steamcmd.tar.gz

This .tar.gz file contain the steamcmd binaries and scripts but not the wrapper script I mentioned earlier. Therefor I add them during build time in every non-Ubuntu Docker image. My guess is that this wrapper script causes a difference in install locations.

Seeing this should be the same for every different image (because of this wrapper script) I will close the issue for now. Let me know if you have any questions or like to know more about it :)