FeralInteractive / gamemode

Optimise Linux system performance on demand
BSD 3-Clause "New" or "Revised" License
4.67k stars 183 forks source link

PlayOnLinux: wrong ELF class: ELFCLASS64 #92

Open fragsalat opened 5 years ago

fragsalat commented 5 years ago

Describe the bug My goal was to run League of Legends on Linux Mint 19.1 Cinnamon via PlayOnLinux + Wine 3.21-staging. The default install script of play on linux uses winxp + x86 arch as wine base but I also tried amd64 as the error (in my eyes) sais it needs x32 lib. During startup the following error happens

ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

To Reproduce

  1. Linux Mint 19.1 Cinnamon + PlayOnLinux 4.x
  2. Install gamemode from git (1.2 or master) (will be installed into /usr/lib/x86_64-linux-gnu)
  3. Run POL LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgamemodeauto.so.0 playonlinux
  4. The error mentioned above will appear

Expected behavior I would not see any error and game mode would work properly.

System Info (please complete the following information):

Additional context If using gimp instead of playonlinux it works.

fragsalat commented 5 years ago

I just tested it with a steam game from CLI and got the same error

LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/libgamemodeauto.so.0 '/home/tommy/.steam/steam/steamapps/common/rocketleague/Binaries/Linux/RocketLeague'
Vthyarilops commented 5 years ago

That's not how you are supposed to preload it, go to the game launcher in POL, click Configure, add

export LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so

to "Command to exec before running this program", close this, not an issue

fragsalat commented 5 years ago

@Vthyarilops First of all, thx for pointing out where to place it. Second thing is that the error is the same and as I wrote indipendent of playonlinux.

tommy@cracknutte:~$ playonlinux --run 'League of Legends'
Looking for python... 2.7.15rc1 - wxversion(s): 3.0-gtk3
selected
1
[main] Message: PlayOnLinux (4.3.4) is starting
[clean_tmp] Message: Cleaning temp directory
Script started /home/tommy/.PlayOnLinux/shortcuts/League of Legends
[POL_System_CheckFS] Message: Checking filesystem for LeagueClient.exe
[POL_Wine] Message: Running wine-3.21-staging LeagueClient.exe (Working directory : /home/tommy/.PlayOnLinux/wineprefix/LeagueOfLegends/drive_c/Riot Games/League of Legends)
[POL_Wine] Message: Notice: PlayOnLinux deliberately disables winemenubuilder. See http://www.playonlinux.com/fr/page-26-Winemenubuilder.html
ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libgamemodeauto.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libgamemodeauto.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libgamemodeauto.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
LeagueClient.exe(0000007E): ALWAYS| Application Version:8.24.256.9476 - CL:2569476 - Build Date:Dec 10 2018 - Build Time:12:01:22
[POL_Wine] Message: Wine return: 0

And third point is that $LIB doesn't exist on Linux Mint and I had to write the path directly, which is as I think not the problem.

Vthyarilops commented 5 years ago

Sorry I jumped on this to quickly, I just tested a 32 bit prefix on Mint 18.1 and it had the same error. I guess gamemode is 64 bit only, honestly not sure.

ikeyd commented 5 years ago

You'd need it built for 32-bit and 64-bit, and make use of the $LIB variable (ld.so) in LD_PRELOAD to ensure the correct build is preloaded

fragsalat commented 5 years ago

Ok I'll search how to do this and try it :) I'll come back with results :)

fragsalat commented 5 years ago

@ikeyd I successfully built the gamemode on my 64bit Linux Mint with 32bit but that result in almost the same error.

Using \$LIB env variable (which doesn't exist) results in this error

ERROR: ld.so: object '/usr/$LIB/libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

Using library built for 32bit with static path

ERROR: ld.so: object '/usr/i386-linux-gnu/libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.

Using library built for 64bit with static path

ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
carlinux commented 5 years ago

Same problem here. Did you got it working @fragsalat ? I tried everything and it still says Wrong ELF: Class no matter what

aejsmith commented 5 years ago

I'm unsure exactly how PlayOnLinux works, but it may be that it ends up running a mix of 32-bit and 64-bit processes. Setting LD_PRELOAD will attempt to load that library into any process, and it will only succeed for processes that match the bit-ness of the library set in LD_PRELOAD. Any others will error.

Using this (note the slash before $LIB is needed): LD_PRELOAD="/usr/\$LIB/libgamemodeauto.so.0" should make ld.so pick the appropriate 32- or 64-bit library path for each process.

If that doesn't work, as long as the library path you're using for preload is the right one for whether the game itself is 32- or 64-bit, things should still work. You can check that GameMode is active while you have the game running with: systemctl --user status gamemoded See the "Status" line, it should tell you whether or not it's active.

carlinux commented 5 years ago

That would explain the errors. So apparently is working as intended and the errors are from 32bit processes other than the main ones. It would be good to know what processes get gamemoded then

aejsmith commented 5 years ago

gamemoded logs when processes make requests and when they exit. You can use something like this to show the log and watch what happens when you run a game: journalctl --user --unit=gamemoded --follow

mauro-miatello commented 5 years ago

I'm trying to use with Lutris, same error journalctl give me this log:

ago 18 14:06:52 HOME-PC /usr/bin/gamemoded[27716]: Requesting update of governor policy to performance
ago 18 14:06:52 HOME-PC pkexec[4036]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
ago 18 14:06:52 HOME-PC /usr/bin/gamemoded[27716]: Setting ioprio value...
ago 18 14:06:52 HOME-PC /usr/bin/gamemoded[27716]: Skipping ioprio on client [4035,4035]: ioprio was (0) but we expected (4)
ago 18 14:06:52 HOME-PC /usr/bin/gamemoded[27716]: Removing game: 4035 [/usr/bin/ntlm_auth]
ago 18 14:06:52 HOME-PC /usr/bin/gamemoded[27716]: Leaving Game Mode...
ago 18 14:06:52 HOME-PC /usr/bin/gamemoded[27716]: Requesting update of governor policy to performance
ago 18 14:06:52 HOME-PC pkexec[4039]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
ago 18 14:06:52 HOME-PC /usr/bin/gamemoded[27716]: Setting ioprio value...
mdiluz commented 5 years ago

@mmiat that log appears to show things working, mostly. The error you're seeing is likely benign

kneekoo commented 1 year ago

Pretty much the same issue here, with Linux Mint 21.1 Cinnamon (based on Ubuntu 22.04). The games won't start because of the following:

Started initial process 3079658 from gamemoderun /home/mint/.local/share/lutris/runners/wine/lutris-7.2-2-x86_64/bin/wine /home/mint/Games/amazon/the-secret-of-monkey-island-special-edition/drive_c/game/MISE.exe
Start monitoring process.
ERROR: ld.so: object 'libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
esync: up and running.
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

ERROR: ld.so: object 'libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
Monitored process exited.
Initial process has exited (return code: 13568)
Exit with return code 13568
volodalexey commented 1 year ago

I am also on Linux Mint 21.1 Cinnamon. Can not start Magicka.

ERROR: ld.so: object '/home/lex/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.