Skip to content

Shadowrun Returns (234650) not launching after recent Steam runtime update #317

Closed

Description

@joshas

Your system information

Please describe your issue in as much detail as possible:

After recent Steam runtime update Shadowrun Returns fails to launch. Game window opens and immediately closes. Log file has errors about library files failing to load: libsteamwrap.so. gist with full error log
Could this be related to LD_LIBRARY_PATH improvements made in new version of Steam runtime?

Activity

  1. kisak-valve commented on Dec 9, 2020

    @kisak-valve
    Member

    /home/REDACTED/.local/share/Steam/steamapps/common/Shadowrun Returns/Shadowrun_Data/Plugins/x86/libsteamwrap.so : Could not load a dll file. Make sure that the steam_api.dll/libsteam_api.dylib file is placed at the correct location. See the documentation for more info. looks like a line of interest from the log. Looks like the game has multiple steam_api.so files in various folders.

  2. joshas commented on Dec 9, 2020

    @joshas
    Author

    There are three libsteam_api.so files in game directory:

    ./Shadowrun_Data/Plugins/x86/libsteam_api.so
    ./Shadowrun_Data/Plugins/libsteam_api.so
    ./libsteam_api.so
    

    All three of them have identical contents.

  3. smcv commented on Dec 9, 2020

    @smcv
    Contributor

    I suspect this might be a regression in run.sh in 914de96 (#274), caused by making the code arguably more correct...

    Previously, we set LD_LIBRARY_PATH inside the Steam Runtime environment like this:

    export LD_LIBRARY_PATH="$steam_runtime_library_paths:${LD_LIBRARY_PATH-}"
    

    If your LD_LIBRARY_PATH outside Steam happens to be completely empty or unset (which is the most common situation), then this results in something like

    LD_LIBRARY_PATH="/home/me/.../steam-runtime/...:/home/me/.../steam-runtime/...:"
    

    with an extra : at the end. ld.so interprets this as equivalent to

    LD_LIBRARY_PATH="/home/me/.../steam-runtime/...:/home/me/.../steam-runtime/...:."
    

    so Steam and games will load libraries from whatever their current working directory happens to be at the time.

    This was probably not meant to happen, but it looks as though Shadowrun Returns might be relying on the fact that it does happen. When Steam launches a game, the current working directory is usually set to the game's top-level directory, so dlopening libsteam_api.so will find ./libsteam_api.so. This also explains how Mount & Blade Warband (#301) can ever have worked, and explains why it doesn't work in the container environment, which never had this bug.

    However, I don't think we want to go back to precisely the old behaviour, because in rare circumstances it can be a security vulnerability: if a game changes directory to an untrusted directory where other users have write access, most commonly /tmp or /var/tmp, then we definitely don't want to load libraries from that directory.

    Now we have two changes:

    • if LD_LIBRARY_PATH is set at the system level, we put it first, rather than last;
    • if it's empty or unset, we correctly don't add an extra :

    If games were relying on this, then we should probably put the game's working directory at the end of the LD_LIBRARY_PATH, like it (effectively) was before, so that libraries get loaded from the game's directory but only if there is no version from the Steam Runtime or the OS. That would bring back more or less the old behaviour. But we should probably use the absolute path to the game, instead of . or the empty string, to avoid the /tmp attack - and we can't do that from run.sh, because run.sh is only run once for the entire Steam session, not once per game.

    As a workaround, you could try that approach by setting the Launch Options to something like this:

    LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+"${LD_LIBRARY_PATH}:"}$(pwd)" %command%
    

    @TTimo, would it be feasible to make the Steam client do the equivalent of that every time it launches a Steam Runtime game? It's probably best if we don't do it for non-Steam games, or for games that run via a compat tool.

  4. joshas commented on Dec 9, 2020

    @joshas
    Author

    LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+"${LD_LIBRARY_PATH}:"}$(pwd)" %command%

    Using this Launch Options command game starts correctly. Thank you.

  5. TTimo commented on Dec 9, 2020

    @TTimo
    Collaborator

    Yes we can do this. I think we would make it a "legacy" property to be phased out for new releases.

  6. Roboron3042 commented on Dec 10, 2020

    @Roboron3042

    Being the current maintainer of Simutrans, I can say this also affected the game. Previous maintainer assumed that Steam Runtime simply picked up the libraries from the game root directory. Some users reported this same issue a month ago when using the beta version, so I was aware that this could happen, but I was also expecting either a "fix" or an announcement before this important change :-/

    I've already updated the game to correctly set LD_LIBRARY_PATH, but probably more games assumed this, and I wouldn't expect all of them to update to address this change, so a solution is indeed necessary.

  7. kisak-valve commented on Dec 11, 2020

    @kisak-valve
    Member

    Hello, per "Fix a regression of support for some native titles (steam-runtime#317)" in the 2020-12-10 Steam client beta update, please opt into Steam's beta client and retest this issue.

  8. joshas commented on Dec 11, 2020

    @joshas
    Author

    Can confirm that Shadowrun Returns is working without additional launch options using latest Steam client Beta update.

  9. thaewrapt commented on Dec 11, 2020

    @thaewrapt

    Works for me also (actually, all three of Shadowrun titles started working).

    Confusing though, I noticed some strange behaviour with scaling for fullscreen resolutions (in my case, it's "desktop" resolution of 1920x1080) and can't remember anything like this before. Could this be connected to the update?

  10. smcv commented on Dec 11, 2020

    @smcv
    Contributor

    I noticed some strange behaviour with scaling for fullscreen resolutions (in my case, it's "desktop" resolution of 1920x1080) and can't remember anything like this before

    Please open a separate issue with full details: there isn't much we can do with "some strange behaviour".

  11. thaewrapt commented on Dec 11, 2020

    @thaewrapt

    Please open a separate issue with full details: there isn't much we can do with "some strange behaviour".

    Definitely, after some more testing and a minimal effort to bisect the issue, I'll do, thanks.

  12. smcv commented on Dec 15, 2020

    @smcv
    Contributor

    The changes in the beta client should be fixing this for games run without the SteamLinuxRuntime (but only those games, right now).

    Resolving https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/issues/46 and updating to a newer Steam client (not yet released) will fix this for games run with the SteamLinuxRuntime.

  13. kisak-valve commented on Jan 15, 2021

    @kisak-valve
    Member

    Closing because the issue in the opening post has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions