After doing some digging, I was able to figure out how to monitor processes in a way to debug what processes were sending inhibitor calls to my system. I’ll describe my process below so that anyone who finds themselves here will know how I am attempting to resolve the issue.
Detecting programs inhibiting screen lock
Following the commands and discussion in this thread, I created two scripts which I have told KDE to run on login. The first one below will simply output the results of dbus-monitor
to a file in the downloads folder, acting like a log file:
#!/bin/bash
dbus-monitor "interface='org.freedesktop.ScreenSaver'" > /home/jonathing/Downloads/dbus-monitor.txt
The second script takes each line from dbus-monitor
and uses some weird regex to extract the sender string so it can be parsed to find the sender information. From the sender information, I then find the command line used to spawn the process ID from the sender information. All lines generated from the script are then outputted to another text file acting like a log:
#!/bin/bash
dbus-monitor "interface='org.freedesktop.ScreenSaver'" | \
while read line ; do
sender_value=$(echo "$line" | grep -oP 'sender=\K[^ ]+')
if [ $? = 0 ]
then
echo $( cat /proc/$(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID string:"$sender_value" | grep -oP 'uint32 \K\d+')/cmdline | tr '\0' ' ' ) >> /home/jonathing/Downloads/dbus-processes.txt
fi
done
Here is the resulting “log” file of the second script:
/usr/bin/dbus-broker-launch --scope user
/usr/bin/dbus-broker-launch --scope user
/home/jonathing/.local/share/Steam/ubuntu12_32/../ubuntu12_64/gldriverquery
/usr/bin/xdg-dbus-proxy --args=43
/home/jonathing/.local/share/Steam/ubuntu12_32/../ubuntu12_64/gldriverquery
/home/jonathing/.local/share/Steam/ubuntu12_32/../ubuntu12_64/gldriverquery
/home/jonathing/.local/share/Steam/ubuntu12_32/../ubuntu12_32/gldriverquery
/home/jonathing/.local/share/Steam/ubuntu12_32/../ubuntu12_32/gldriverquery
/home/jonathing/.local/share/Steam/ubuntu12_32/../ubuntu12_32/gldriverquery
Problem
So yes, the problem was Steam. Keep in mind, I did my tests with both Steam opened and closed, but the root cause was Steam starting on startup. It appears that the gldriverquery
process that is started by steam makes, what I believe to be, a faulty call to the SDL_DBus_ScreensaverInhibit function within the SDL library. Since gldriverquery
does not have a friendly app name or reason, SDL simply supplies the default values of “My SDL application” and “Playing a game”.
The reason why my attempts, earlier in this thread, to run the commands that I ran in the first script failed was because the gldriverquery
process was already terminated after the fact. So, there was no longer a connection established to the DBus. The scripts circumvent this because they attempt to gather information on the sender as soon as information is retrieved.
Workarounds
My solution for now will simply be to find a way to prevent Steam from inhibiting the screensaver at all from any of its spawned processes and to report the issue to Steam for Linux’s issue tracker. With regards to the former, I have since found is an Arch package that adds a Desktop entry that attempts to prevent steam from calling that specific function (see steam-screensaver-fix on AUR and patlefort/steam-screensaver-fix on GitLab).
Links
Since I am a new user, I am unable to directly include links in ths post. I’ll try to list the resources I mentioned here:
- The SDL_DBus_ScreensaverInhibit function GitHub - libsdl-org/SDL/blob/a2d3be904b219e4257fb11a8ecb51f5f9a9e60f7/src/core/linux/SDL_dbus.c#L359-L394
- steam-screensaver-fix - AUR
- patlefort/steam-screensaver-fix - GitLab