protonscr

Some games freeze on mouse/keyboard input when using libdbus-1.so.3 from the Steam Runtime, in the absence of a session dbus daemon

steamopen reviewed
ValveSoftware/steam-for-linux#4444 · opened 2016-05-09 by major-gnuisance · updated 2017-07-25 · 11 comments · github
Mmajor-gnuisance 2016-05-09 github

OS: Debian GNU/Linux testing, amd64

Some games "freeze" temporarily upon receiving any mouse or keyboard input, but only if using the Steam Runtime.

The following games are affected:

  • Shadow Warrior
  • Human Resource Machine
  • The Average Everyday Adventures of Samantha Browne
  • Xenonauts
  • A Boy and His Blob

Removing the Steam Runtime paths from LD_LIBRARY_PATH fixes the issue.
More specifically, the problem is libdbus-1.so.3, located in steam-runtime/amd64/lib/x86_64-linux-gnu/
If I make affected games use the system's version of that library, the problem disappears.
(libgpg-error.so.0 also needs to be replaced with the system's version, or else games will crash with the new libdbus.)

Below is a script to give precedence of those SO files over the Steam Runtime's.
Use it as a wrapper in the Steam launch options of the games affected, e.g.: "my-rt-fix %command%"

#!/bin/bash

# Exit on errors
set -e

# Create temporary directory
tmpdir="$(mktemp --directory)"

# Cleanup function
function cleanup {
    if [ -d "$tmpdir" ]; then
        rm "$tmpdir"/*
        rmdir "$tmpdir"
    fi
}
# Execute cleanup on exit
trap cleanup EXIT

# Create symlinks to SO files in temporary directory
for file in libdbus-1.so.3 libgpg-error.so.0; do
    ln -s "/lib/x86_64-linux-gnu/$file" "$tmpdir"
done

# Add temporary directory to beginning of LD_LIBRARY_PATH, so that it has precedence over the Steam Runtime
export LD_LIBRARY_PATH="$tmpdir${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"

# Run program given in arguments
"$@"

# trap takes care of cleanup upon exit

A couple more notes:

  • Human Resource Machine doesn't experience this problem if I remove the overlay's SO from LD_PRELOAD before launching the game. Merely disabling the overlay in the game's properties does not suffice.
  • Games don't freeze when the overlay is open and receiving input.

I can record a video if necessary.

Mmajor-gnuisance 2016-05-09 github

This problem has existed for a while, by the way.
I think it has affected Shadow Warrior for as long as I've had it in my library, but it already had a "no steam runtime" launch option.

I think there were other games affected, but I can't remember which.

Mmajor-gnuisance 2016-05-09 github

Another affected game:

  • Skullgirls

Note: Shadow Warrior and Skullgirls already have a "No Steam Runtime" launch option.

Mmajor-gnuisance 2016-05-10 github

Other affected games:

  • SOMA
  • Super Splatters
  • Braid
  • La-Mulana

Braid only freezes after about half a second of holding down a key, and seems to ignore mouse input.

La-Mulana doesn't actually slow down, but seems to accumulate input over time in a way that makes it unplayable, e.g., I hold "right" for three seconds and movement continues for an additional second after release.

Mmajor-gnuisance 2016-05-10 github

Turns out the trigger for this issue was the absence of a session dbus.

I forgot to mention that I was running Steam with a separate user with just access to the X and pulseaudio servers, gamepad devices and the video and bumblebee system groups.
This meant that Steam (and its children) didn't have a session dbus they could connect to, which triggered this problem.

I managed to fix it while still maintaining the semi-isolation of Steam by starting a session dbus daemon for the steam user.
A naive solution:

# warning: this launches a new dbus daemon with every invocation
export DBUS_SESSION_BUS_ADDRESS="$(dbus-daemon --session --print-address --fork)"
steam

I'm not sure if it's reasonable to require a session dbus to run Steam games, so I'll leave the issue open for now.

Jjoaormatos 2016-08-07 github

The solution above spawns a dbus daemon each time it's run.
If you don't want to leave lingering daemon processes, use the following instead:

dbus-run-session steam

Ggvlasov 2016-08-30 github

Painkiller: Hell & Damnation is affected by this as well

Jjoaormatos 2016-09-10 github

As I pointed out in the Dota2 issue thread, you should be able to work around this problem without running any dbus daemon at all.

Just set DBUS_SESSION_BUS_ADDRESS to some random gibberish, such as "foo"

Ccybik 2016-12-06 github

I can confirm that both gibberish-ing DBUS_SESSION_BUS_ADDRESS and using dbus-run-session steam fix the slowdown with Skullgirls.

Tthigger 2016-12-22 github

Steam in-home streaming is affected by this (hence I saw it on all games!)
In ubuntu 16.04 there is a "dbus-user-session" package which I think is what fixed it for me.

Ttaxilly 2017-05-05 github

Using dbus-run-session steam also fixes mouse lag on Reassembly

AAntidemons 2017-07-25 github

script from major-gnuisance is great. Thanks. Shadow Warrior now run excellent.

Nothing extracted yet.