gamemode: gamemodeauto: dlopen failed
Describe the bug
I am using gamemoderun %command%
to initiate gamemode when launching a steam game. However according to Proton Log, gamemode isn’t functioning properly. The log has several lines of gamemodeauto: dlopen failed - libgamemode.so: cannot open shared object file: No such file or directory
To Reproduce
Launch a game on steam using startup command gamemoderun %command%
Expected behavior
Log should tell that gamemode was initiated successfully.
System Info
- OS and version: Arch
- GameMode Version: 1.6.1-1
Additional context
I have tried building gamemode myself from source as well as using pamac with both resulting in the same outcome.
gamemoded -s
suggests that gamemode is active when the game is running.
gamemoded -t
gets stuck on “Supervisor tests” and spams ...Waiting for child to quit...
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 19 (1 by maintainers)
sigh
TL;DR: this isn’t an issue. You have nothing to worry about, gamemode functions as you expect it to, despite these errors. You don’t need the
LD_PRELOAD
trick either, unless gamemode doesn’t work. Check withgamemoded -s
while the game is running, it should say “gamemode is active”It is running:
https://user-images.githubusercontent.com/6643565/147821858-4097857a-c6db-48b9-80bd-ef4c56b25ea4.mp4
From the dlopen manpage:
There are two calls to
dlopen
in the source code:and
Neither pass NULL or a filename with a slash, therefore the dynamic linker has to search for the object. Going through these locations one by one:
libgamemodeauto
doesn’t have a DT_RPATH. You can verify withobjdump -x /usr/lib64/libgamemodeauto.so.0.0.0|grep RPATH
/usr/lib64/
(the location wherelibgamemode
is) is not inLD_LIBRARY_PATH
.libgamemodeauto
doesn’t have a DT_RUNPATH. You can verify withobjdump -x /usr/lib64/libgamemodeauto.so.0.0.0|grep RUNPATH
/lib
nor/usr/lib
have alibgamemode
in them.So, there is only one way for the dynamic linker to find
libgamemode
, and that is by using/etc/ld.so.cache
:For whatever reason Valve, in their infinite wisdom, made it so Proton startup process ignores
/etc/ld.so.cache
. I don’t know how or why they did, but that’s how things are. If you’re interested, you can ping one of the Valve employees handling the GitHub issues, I bet they’d love that 😃And now about the so-called “fix” of
LD_PRELOAD="$LD_PRELOAD:/usr/\$LIB/libgamemode.so.0"
!It doesn’t accomplish much.
All that does is make gamemode active for every process that Steam starts when you click “PLAY”, which is not something you necessarily want, because not every process that Steam runs is a game. Some things are better off with a priority that is lower than the game’s, such as, oddly enough, the wineserver.
In this particular case the only difference are a few short-lived processes that during Proton’s startup. They are the source of the errors. By using
LD_PRELOAD
you make sure these have gamemode applied to them, which doesn’t cause any issues right now, but may (though it’s extremely unlikely) in the future.Anyway, if you were to check which processes gamemode affects with and without that “fix”, you’d see the exact same list of:
plus the game process.
The
LD_PRELOAD
error is not logged by Gamemode or even Steam , it is Linux’s dynamic linker logging the error. It’s simply a quirk of Steam’s usage ofLD_PRELOAD
that it puts both 32 and 64 bit libraries in there, meaning that regardless of the executable there will always be at least one harmless error log, for every single game launch on steam.The amount of headspace taken up by the confusion is immeasurable though, I’ve probably had to explain this more than a few hundred times.
Could the error be somehow like hidden? It has been confused with gamemode “not working” on some thread on reddit and Lutris forums? Like at least add an FAQ or something about when troubleshooting saying “this is not an issue” and link to this issue??