game-ci / steam-deploy

Github Action to deploy a game to Steam
MIT License
227 stars 63 forks source link

ssfn files for Mac and Linux #38

Closed nicmar closed 2 years ago

nicmar commented 2 years ago

Bug description I'm on Mac OS 12.1 (Monterey) and just downloaded the Steamworks SDK. First of all, the config/config.vdf according to the docs wasn't created. But another file "update_hosts_cached.vdf" was created, which seems to be the correct file.

However, no files starting with ssfn was created, and no hidden files. So I can't proceed in setting up the secrets STEAM_SSFN_FILE_NAME and STEAM_SSFN_FILE_CONTENTS needed for the deployment.

First time i ran ./steamcmd.sh i got a lot of errors like this, but I could login, enter the 2FA code and the update_hosts_cached.vdf was created:

src/common/enum_names.cpp (2271) : Assertion Failed: Missing String for EOSType (-76) src/common/enum_names.cpp (2271) : Assertion Failed: Missing String for EOSType (-77) src/common/enum_names.cpp (2271) : Assertion Failed: Missing String for EOSType (-77) src/common/enum_names.cpp (2271) : Assertion Failed: Missing String for EOSType (-78) src/common/enum_names.cpp (2271) : Assertion Failed: Missing String for EOSType (-78)

How to reproduce

Run this command on mac: cd /tools/ContentBuilder/builder_osx chmod 755 steamcmd.sh ./steamcmd.sh +login +quit

Expected behavior Two files named ssfn where one hidden, is generated.

nicmar commented 2 years ago

I realize this is not a bug in this code, but a problem with the builder_osx in the Steamcmd package. But it's still a problem for me as a mac user.

I ran the commands on a Windows machine, but there I couldn't do base64 on them, cause the command was missing, so I had to copy them to the mac, and do base64 there, and put them in the secrets, but it still doesn't work. I'm note sure what step goes wrong.

Also I find it curious that the config.vdf file doesn't seem to have base64 decode in the script on steam_deploy:87 even if the docs tell you to base64 encode both the config and the ssfn file.

Any ideas? Are most people here on linux?

echo "Copying $STEAM_HOME/config/config.vdf..."
echo "$configVdf" > "$STEAM_HOME/config/config.vdf"
chmod 777 "$STEAM_HOME/config/config.vdf"

echo "Copying /home/runner/Steam/config/config.vdf..."
echo "$configVdf" > "/home/runner/Steam/config/config.vdf"
chmod 777 "/home/runner/Steam/config/config.vdf"

echo "Copying $STEAM_HOME/ssfn..."
echo "$ssfnFileContents" | base64 -d > "$STEAM_HOME/$ssfnFileName"
chmod 777 "$STEAM_HOME/$ssfnFileName"

echo "Copying /home/runner/Steam/ssfn..."
echo "$ssfnFileContents" | base64 -d > "/home/runner/Steam/$ssfnFileName"
chmod 777 "/home/runner/Steam/$ssfnFileName"
nicmar commented 2 years ago

From my further tests on a local VM, the config.vdf doesn't seem to be neccesary, it's being recreated if i delete it, then run the login command.

This command launches a VM with steamcmd preinstalled: docker run -it --name=steamcmd cm2network/steamcmd bash

When I login on steam from here, then auth using the Steamguard code and then save the ssfn file and content, I can always restore the working Steamguard:

./steamcmd.sh +login username password +quit
cat /home/steam/Steam/ssfnNUMBER | base64 -w 0 > ssfnNUMBER_base64

The only command that seems to matter is this: echo "SSFN_BASE64_ENCODED" | base64 -d > /home/steam/Steam/ssfnNUMBER

When I do this, with the same data that I picked up after logging in, it always works, on the VM. But not on the VM that this action creates.

The folders seem to be different than in my local VM, and I don't understand why it's copying the files twice:

| Copying /opt/hostedtoolcache/steamcmd/latest/i386/ssfn... ***
| Copying /home/runner/Steam/ssfn...

During the steam-deploy action, this path is set as STEAM_HOME /opt/hostedtoolcache/steamcmd/latest/i386

I'll keep investigating..

webbertakken commented 2 years ago

Nice findings. Thank you for your research so far

Note that a Virtual Machine (VM) is not the same thing as a Docker container, these keywords aren't interchangeable. In short: a VM has it's own operating system with a kernel that talks to the hardware directly. A docker container only contains the minimum files necessary for a single process to run and can be executed on top of any OS on any computer, including on VMs.

We're open to PRs! If a different docker image is needed to simplify this action we're open to switch I'd say. As long as the changes work for everyone.

davidmfinol commented 2 years ago

Are most people here on linux?

From what I've seen, most people are on Windows. You can do base64 on Windows by using the git bash.

The folders seem to be different than in my local VM, and I don't understand why it's copying the files twice

It's probably not necessary to copy twice. I was just guessing at where the file needed to be, and it's likely that only one of those two directories is the correct one.

It also sounds like maybe the config.vdf file may not need to be copied at all. We may want to look into removing that from our API.

And thanks for your efforts here. It'd be great to find a solution that works across all three of Linux, Windows, and Mac.

webbertakken commented 2 years ago

It'd be great to find a solution that works across all three of Linux, Windows, and Mac.

Once we have a fully working version we might consider using an up-to-date docker image that already has steamCmd pre-installed. Conditional mounting on a per platform basis, like we do here, ultimately might be the way to go to make this fully cross-platform compatible.

timothymalcham commented 2 years ago

Just in case anybody comes here for a solution, I found that these vdf and ssfn files can be found in ~/Library/Application\ Support/Steam/ instead of in the directory you run steamcmd.sh.

However, there is only a visible ssfn file, no hidden one in that path that I mentioned above. I'm going to try to configure the action with this visible file and will report back here on the results. Does the hidden one not get created on MacOS?

timothymalcham commented 2 years ago

Following up on my previous comment, I never got this to work on my Mac. I used a Windows PC and was able to get both the vdf and ssfn files (including the hidden ssfn file). The hidden ssfn file just never appeared on my Mac no matter what I did.

wilg commented 2 years ago

Steam suggests backing up the config here:

https://partner.steamgames.com/doc/sdk/uploading?l=finnish&language=english

If you are using steamcmd from a machine or VM that gets re-imaged frequently, you should include the sentry and config file in your image so you won't be prompted for a Steam Guard every time. The sentry file is located in \ssfn, and the config file is located in \config\config.vdf.

wilg commented 2 years ago

I believe it does work with just the single, visible, ssfn file on Mac. What a strange system they've got!

davidmfinol commented 2 years ago

We should add to our documentation the paths to the ssfn files on Mac and Linux.

davidmfinol commented 2 years ago

Fixed by https://github.com/game-ci/steam-deploy/pull/45

Benbentwo commented 1 year ago

I'm running into this issue on MacOs, with the files generated on a windows. I'm assuming that the files are cross OS. Meaning I can generate on a windows then run a build on a mac (and windows), is that a safe assumption?

davidmfinol commented 1 year ago

@Benbentwo Yes, the files should be cross os. What issue are you having?