SMAPI launcher doesn't work for some Linux users
Pathoschild opened this issue · 5 comments
#183 fixed the launcher so the SMAPI console is opened alongside the game. This apparently breaks Steam launch for some Linux users (but not all). If the launch script launches a terminal (even just x-terminal-emulator
with no arguments), nothing seems to happen when it's launched through Steam. When it's launched directly, it works fine.
Test cases (mostly collected from error reports):
distro | SMAPI | results |
---|---|---|
Kali 2016.3.2 (@EnderHDMC) |
1.3 | ✘ Nothing happens when launched through Steam; works correctly (including opening a second terminal) when launched through terminal. After removing the terminal code from the launcher (so it runs the game directly like it used to), launching through Steam works. |
Manjaro 16.10 (@tstaples) |
1.3 | ✓ Launches correctly through Steam or terminal. Correctly opens SMAPI console. |
Mint 18 KDE (Octojay on Discord) |
1.3 | ✘ Nothing happens when launched through Steam. |
Ubuntu 16.04 (@Pathoschild) |
1.3 | ✓ Launches correctly through Steam or terminal. Correctly opens SMAPI console. |
@EnderHDMC put together a modified version of the launcher that adds support for a --disable-terminal
argument. When present, this falls back to the old behaviour of launching the game without a terminal.
Investigated with @EnderHDMC. Here's a recap of what we found.
SMAPI 1.3–1.5 doesn't launch through Steam (no Steam launch options). There's no error log created, so it fails in the launch script before SMAPI itself is invoked. The $PWD
is correctly set to the game directory. Launching ./StardewValley
or the command Steam uses (/bin/sh -c '/home/DarkEnder/.local/share/Steam/steamapps/common/Stardew Valley/StardewValley' STEAM_RUNTIME=0
) directly from the terminal works fine.
We isolated the issue to this block:
# open SMAPI in terminal
if $COMMAND x-terminal-emulator 2>/dev/null; then
x-terminal-emulator -e "$LAUNCHER"
elif $COMMAND gnome-terminal 2>/dev/null; then
gnome-terminal -e "$LAUNCHER"
elif $COMMAND xterm 2>/dev/null; then
xterm -e "$LAUNCHER"
elif $COMMAND konsole 2>/dev/null; then
konsole -e "$LAUNCHER"
elif $COMMAND terminal 2>/dev/null; then
terminal -e "$LAUNCHER"
else
$LAUNCHER
fi
Some logging determined that:
$COMMAND
iscommand -v
and$LAUNCHER
is./StardewModdingAPI.bin.x86_64 STEAM_RUNTIME=0
, which are the expected values.$COMMAND x-terminal-emulator
returns/usr/bin/x-terminal-emulator
, so the terminal is available when launched through Steam.- Nonetheless,
x-terminal-emulator
and/usr/bin/x-terminal-emulator
both fail with exit code 127, which means 'command not found'.
As a workaround, we can check for exit code 127 after the terminal launch, and fallback to /bin/sh -c "$LAUNCHER"
or $LAUNCHER
which works fine but doesn't show a terminal.
It's not clear why /usr/bin/x-terminal-emulator
fails with command-not-found when launched through Steam, even though command -v x-terminal-emulator
shows that the command is valid. It's also not clear whether it's the same cause for other affected Linux users.
The workaround seems to fix it for most players, but it's still failing for @nirasa1957 on the forums.
I created a custom launcher which logs more information about the launch process.
- ✓ Log for a GOG user (no issue):
invoked as ./StardewValley detected Linux (uname=Linux, arch=x86_64) selected launcher: ./StardewModdingAPI.bin.x86_64 selected command: command -v launching terminal: x-terminal-emulator terminal launch exit code: 0
- ✓ Log for a Steam user affected by the command-not-found issue (see previous workaround):
invoked as /home/ledah/.local/share/Steam/steamapps/common/Stardew Valley/StardewValley STEAM_RUNTIME=0 detected Linux (uname=Linux, arch=x86_64) selected launcher: ./StardewModdingAPI.bin.x86_64 STEAM_RUNTIME=0 selected command: command -v launching terminal: x-terminal-emulator terminal launch exit code: 127
- ✘ Log from @nirasa1957 on the forums, who can't launch the game through Steam (but it works fine if launched directly):
invoked as /home/irenas/.local/share/Steam/steamapps/common/Stardew Valley/StardewValley STEAM_RUNTIME=0 detected Linux (uname=Linux, arch=x86_64) selected launcher: ./StardewModdingAPI.bin.x86_64 STEAM_RUNTIME=0 selected command: command -v launching terminal: x-terminal-emulator terminal launch exit code: 1
Split the remaining launch issue to #219, closed as fixed.