Quick Troubleshooting: Game Launcher Segmentation Faults in Lutris

Bottom Line; Up Front

If a game won’t launch using Lutris, use the -b command line argument to generate a bash script to run the game without the client.

The Scenario

About a month ago I updated my laptop to Pop!_OS 22.04. With that came new quirks and rough edges to smooth out, as is always the case during major distribution upgrades. My day-to-day work wasn’t interrupted, so a problem lurking with a game I do not play frequently wasn’t caught immediately after the upgrade. One day recently I decided to play Tom Clancy’s Ghost Recon[1], an older military tactical shooter, and it would start to load, then suddenly crash. I wasn’t surprised, given that it’s a Windows game running on Linux through a compatibility layer, but I was mildly annoyed nonetheless. I spent a few minutes trying to figure out what was wrong, then moved on other more pressing tasks. Today I came back to it, motivated to find the root cause, and hopefully fix the problem.

Troubleshooting

First Steps

I started with a sticky post on the Lutris Forums aptly titled “Please read before asking for help”[2]. I didn’t find the information in the post all that useful, but it was enough to help me rule out Lutris as the likely cause. The debug output from the -d argument and the logs from the game didn’t shed very much light on the problem. I was able to make out there was a segmentation fault[3], but the logs I collected didn’t bring me any closer to identifying the problem.

The next step I took was to try starting the game from a terminal after setting WINEPREFIX[4]. That command looked something like the following:

WINEPREFIX=/home/e0D69NsW/Games/gog/tom-clancys-ghost-recon/ \
/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/bin/wine \
/home/e0D69NsW/Games/gog/tom-clancys-ghost-recon/drive_c/GOG\ Games/Tom\ Clancys\ Ghost\ Recon/GhostRecon.exe

The game ran and was playable when launching from the terminal. That told me there were other environment variables set by the Lutris client. The next step was figuring out where and how the variables were set.

Lutris Client

Each game has an icon in the client, and right-clicking on the icon brings up a menu with an option to configure the game. The resulting window has four tabs: Game info, Game options, Runner options, and System options. Each tab has a number of toggles and text entry boxes to change configuration variables for the game. Hovering the mouse over the various options displays contextual help, but I really just wanted to see the final command line executed by the client when launching the game. I ran lutris --help in a terminal to see what other command line arguments were available:

$ lutris --help
Usage:
  lutris [OPTION…] URI

Run a game directly by adding the parameter lutris:rungame/game-identifier.
If several games share the same identifier you can use the numerical ID (displayed when running lutris --list-games) and add lutris:rungameid/numerical-id.
To install a game, add lutris:install/game-identifier.

Help Options:
  -h, --help                 Show help options
  --help-all                 Show all help options
  --help-gapplication        Show GApplication options
  --help-gtk                 Show GTK+ Options

Application Options:
  -v, --version              Print the version of Lutris and exit
  -d, --debug                Show debug messages
  -i, --install              Install a game from a yml file
  -b, --output-script        Generate a bash script to run a game without the client
  -e, --exec                 Execute a program with the Lutris Runtime
  -l, --list-games           List all games in database
  -o, --installed            Only list installed games
  -s, --list-steam-games     List available Steam games
  --list-steam-folders       List all known Steam library folders
  --list-runners             List all known runners
  --list-wine-versions       List all known Wine versions
  -r, --install-runner       Install a Runner
  -u, --uninstall-runner     Uninstall a Runner
  --export                   Export a game
  --import                   Import a game
  --dest                     Destination path for export
  -j, --json                 Display the list of games in JSON format
  --reinstall                Reinstall game
  --submit-issue             Submit an issue
  --display=DISPLAY          X display to use

Two arguments stuck out to me: -l to list games and -b to generate a bash script to run a game without the client. lutris -l printed a list of installed games, then I ran lutris -b gr tom-clancys-ghost-recon to generate a bash script named gr.

The gr script contained the following:

#!/bin/bash


# Environment variables
export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1="1"
export __GL_SHADER_DISK_CACHE="1"
export __GL_SHADER_DISK_CACHE_PATH="/home/e0D69NsW/Games/gog/tom-clancys-ghost-recon"
export DRI_PRIME="1"
export __NV_PRIME_RENDER_OFFLOAD="1"
export __GLX_VENDOR_LIBRARY_NAME="nvidia"
export __VK_LAYER_NV_optimus="NVIDIA_only"
export PULSE_LATENCY_MSEC="60"
export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/nvidia_icd.json"
export LD_LIBRARY_PATH="/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/lib:/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/lib64:/lib/x86_64-linux-gnu:/lib/i386-linux-gnu:/lib:/usr/lib/x86_64-linux-gnu/pipewire-0.3/jack:/lib/i386-linux-gnu/sse2:/usr/lib/x86_64-linux-gnu/libfakeroot:/lib64:/lib32:/lib64:/usr/lib:/usr/lib64:/usr/lib32:/usr/lib64:/usr/lib/i386-linux-gnu:/usr/lib/x86_64-linux-gnu:/home/e0D69NsW/.local/share/lutris/runtime/Ubuntu-18.04-i686:/home/e0D69NsW/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:/home/e0D69NsW/.local/share/lutris/runtime/steam/i386/lib:/home/e0D69NsW/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:/home/e0D69NsW/.local/share/lutris/runtime/steam/i386/usr/lib:/home/e0D69NsW/.local/share/lutris/runtime/Ubuntu-18.04-x86_64:/home/e0D69NsW/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:/home/e0D69NsW/.local/share/lutris/runtime/steam/amd64/lib:/home/e0D69NsW/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:/home/e0D69NsW/.local/share/lutris/runtime/steam/amd64/usr/lib"
export WINEDEBUG=""
export WINEARCH="win32"
export WINE="/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/bin/wine"
export WINE_MONO_CACHE_DIR="/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/mono"
export WINE_GECKO_CACHE_DIR="/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/gecko"
export GST_PLUGIN_SYSTEM_PATH_1_0="/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/lib64/gstreamer-1.0/:/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/lib/gstreamer-1.0/"
export WINEPREFIX="/home/e0D69NsW/Games/gog/tom-clancys-ghost-recon"
export WINEESYNC="1"
export WINEFSYNC="1"
export DXVK_NVAPIHACK="0"
export DXVK_ENABLE_NVAPI="1"
export PROTON_BATTLEYE_RUNTIME="/home/e0D69NsW/.local/share/lutris/runtime/battleye_runtime"
export PROTON_EAC_RUNTIME="/home/e0D69NsW/.local/share/lutris/runtime/eac_runtime"
export WINEDLLOVERRIDES="winemenubuilder="
export WINE_LARGE_ADDRESS_AWARE="1"
export TERM="xterm"

# Command
/home/e0D69NsW/.local/share/lutris/runners/wine/lutris-GE-Proton7-1-x86_64/bin/wine '/home/e0D69NsW/Games/gog/tom-clancys-ghost-recon/drive_c/GOG Games/Tom Clancys Ghost Recon/GhostRecon.exe'%

From here it was a simple process of elimination. I commented out an environment variable, ran the script, and repeated the process until I isolated the variable that was causing the crashes. It took less than five minutes to isolate the variable once I had this shell script in hand.

The Solution

The fix was simple: disable NVIDIA Prime Render Offload[5]. The default is disabled, but for some reason I had it enabled. After disabling it for Ghost Recon, and making certain it worked, I also checked the defaults for the Wine runner in the Lutris preferences. It was enabled there as well, so I toggled it off. I suspect the reason for the game crashing with this option enabled was due to my having my laptop configured to use only the discrete video card. I think it would work if I used the hybrid graphics mode. Regardless, by disabling Prime Render Offload I achieved my desired outcome: the game launched using the Lutris client.

Wrapping Up

Despite an easy fix, arriving at the solution was less than obvious. I’ve been using Linux for over 20 years, so debugging graphical applications in the terminal isn’t new, or difficult, for me. A Linux newcomer would likely get frustrated, and maybe give up and go back to Windows, or vent online. One way to help newcomers is to put solutions like this out on the web publicly to be indexed by search engines, which is what inspired me to write this post. My hope is that someone else will find this post and save time troubleshooting so they can move on and enjoy their games.

External Links

  1. Tom Clancy’s Ghost Recon
  2. Please read before asking for help
  3. What is a segmentation fault on Linux?
  4. 6.5.2 Can I store the virtual Windows installation somewhere other than ~/.wine?
  5. Chapter 34. PRIME Render Offload