ValveSoftware / steam-runtime

A runtime environment for Steam applications
Other
1.19k stars 86 forks source link

MangoHud not working on Ubuntu with soldier beta 0.20201124.0 #303

Closed Corben78 closed 3 years ago

Corben78 commented 3 years ago

Your system information

Please describe your issue in as much detail as possible:

MangoHud doesn't work. Its config file is located at ~/.config/MangoHud/MangoHud.conf. Steam Client, as well as Steam Linux Runtime - Soldier are both on the beta branch.

When starting a game with this launch parameter: mangohud PRESSURE_VESSEL_FILESYSTEMS_RO="$MANGOHUD_CONFIGFILE" %command% I see the following line occurring again and again:

ERROR: ld.so: object 'libMangoHud.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored

When I omit mangohud that error doesn't occur, but MangoHud also still doesn't show up. I've set this in my .profile:

export MANGOHUD=1
export PRESSURE_VESSEL_FILESYSTEMS_RO="$MANGOHUD_CONFIGFILE"

I'm wondering if $MANGOHUD_CONFIGFILE is a literal, or if it's getting expanded and should have the path to the config file to be used?

I've installed MangoHud via the github instructions, which installes MangoHud below /usr/lib/mangohud/lib/libMangoHud.so and /usr/lib/mangohud/lib32/libMangoHud.so, which is also reflected in /usr/share/vulkan/implicit_layer.d/MangoHud.json:

"library_path": "/usr/lib/mangohud/\$LIB/libMangoHud.so"

I tried to copy the files directly to /usr/lib/libMangoHud.so and /usr/lib32/libMangoHud.so along with setting "library_path"to /usr/\$LIB/libMangoHud.so, but still no luck

pressure-vessel.log

Steps for reproducing this issue:

  1. Install MangoHud from flightlessmango/MangoHud
  2. Configure MangoHud via ~/.config/MangoHud/MangoHud.conf
  3. Install Steam Client beta, Steam Linux Runtime - Soldier beta (as of 2020-11-29)
  4. Set a game to use Proton 5.13-2
  5. Play game, with MangoHud not showing (though showing with games using Proton 5.0-10).
smcv commented 3 years ago

Getting Vulkan layers into the container is a work in progress. They will sometimes work, depending on exactly where they're installed, the word size of the process (for Proton this means it depends whether you're running a 32-bit or 64-bit Windows executable), and luck.

export PRESSURE_VESSEL_FILESYSTEMS_RO="$MANGOHUD_CONFIGFILE"

This is unnecessary (but harmless) if the configuration file is in your home directory, because we share that with the container anyway. It would be necessary if the configuration file was in /opt or something.

It's also unecessary and pointless (but harmless) if you didn't already set the environment variable $MANGOHUD_CONFIGFILE yourself.

I'm wondering if $MANGOHUD_CONFIGFILE is a literal, or if it's getting expanded and should have the path to the config file to be used?

Because you put it inside double quotes, it gets expanded.

smcv commented 3 years ago

Distribution: Ubuntu 18.04 ... I've installed MangoHud via the github instructions, which installes MangoHud below /usr/lib/mangohud/lib/libMangoHud.so and /usr/lib/mangohud/lib32/libMangoHud.so, which is also reflected in /usr/share/vulkan/implicit_layer.d/MangoHud.json:

"library_path": "/usr/lib/mangohud/\$LIB/libMangoHud.so"

This might be the problem. On Debian derivatives like Ubuntu, $LIB means something like lib/x86_64-linux-gnu or lib/i386-linux-gnu, so your JSON file is trying to load /usr/lib/mangohud/lib/x86_64-linux-gnu/libMangoHud.so and /usr/lib/mangohud/lib/i386-linux-gnu/libMangoHud.so. Try putting it in those locations.

Installing into lib for 64-bit and lib32 for 32-bit is only correct for distributions like Arch Linux that use those paths for their own libraries.

The third major category (other than "Debian-like" and "Arch-like"), and perhaps the most common, is to install into lib64 for 64-bit and lib for 32-bit, which is correct for Red-Hat-derived distributions like Fedora and CentOS, among others; and then there's an assortment of less common arrangements like Exherbo.

As I'm sure you can imagine, this is something that contributes to it being difficult to make pressure-vessel work everywhere :-)

Corben78 commented 3 years ago

Thanks for your detailed answer @smcv!

This might be the problem. On Debian derivatives like Ubuntu, $LIB means something like lib/x86_64-linux-gnu or lib/i386-linux-gnu, so your JSON file is trying to load /usr/lib/mangohud/lib/x86_64-linux-gnu/libMangoHud.so and /usr/lib/mangohud/lib/i386-linux-gnu/libMangoHud.so. Try putting it in those locations.

Looks like they've been smart enough, and created symlinks for all situations:

/usr/lib/mangohud$ ls -lR
.:
insgesamt 12
lrwxrwxrwx 1 root root    5 Nov 29 02:06 i386-linux-gnu -> lib32
lrwxrwxrwx 1 root root    5 Nov 29 02:06 i686 -> lib32
lrwxrwxrwx 1 root root    5 Nov 29 02:06 i686-linux-gnu -> lib32
drwxr-xr-x 2 root root 4096 Nov 29 02:06 lib
drwxr-xr-x 2 root root 4096 Nov 29 02:06 lib32
lrwxrwxrwx 1 root root    3 Nov 29 02:06 lib64 -> lib
drwxr-xr-x 2 root root 4096 Nov 29 02:06 tls
lrwxrwxrwx 1 root root    3 Nov 29 02:06 x86_64 -> lib
lrwxrwxrwx 1 root root    3 Nov 29 02:06 x86_64-linux-gnu -> lib

./lib:
insgesamt 1668
lrwxrwxrwx 1 root root       8 Nov 29 02:06 i386-linux-gnu -> ../lib32
lrwxrwxrwx 1 root root       1 Nov 29 02:06 i686-linux-gnu -> .
lrwxrwxrwx 1 root root       8 Nov 29 02:06 lib32 -> ../lib32
-rw-r--r-- 1 root root   22240 Nov 29 02:06 libMangoHud_dlsym.so
-rw-r--r-- 1 root root 1682640 Nov 29 02:06 libMangoHud.so
lrwxrwxrwx 1 root root       6 Nov 29 02:06 tls -> ../tls
lrwxrwxrwx 1 root root       1 Nov 29 02:06 x86_64 -> .
lrwxrwxrwx 1 root root       1 Nov 29 02:06 x86_64-linux-gnu -> .

./lib32:
insgesamt 1760
-rw-r--r-- 1 root root   20904 Nov 29 02:06 libMangoHud_dlsym.so
-rw-r--r-- 1 root root 1776104 Nov 29 02:06 libMangoHud.so

./tls:
insgesamt 0
lrwxrwxrwx 1 root root 8 Nov 29 02:06 i686 -> ../lib32
lrwxrwxrwx 1 root root 6 Nov 29 02:06 x86_64 -> ../lib

When looking into my pressure-vessel.log file from above, it seems that it's correctly found and mapped? Any other idea, I could try to make it work?

As I'm sure you can imagine, this is something that contributes to it being difficult to make pressure-vessel work everywhere :-)

Yep, I see. Standards, hm? :) Thanks for your effort!

Corben78 commented 3 years ago

Interesting. MangoHud works with Bioshock Remastered and Proton 5.13-4 (which made me think, 5.13-4 fixed it), but it's still not working with Droneswarm (the game I created the pressure-vessel.log report with).

edit: Bioshock Remastered it is a 32bit binary, while Droneswarm is a 64bit binary.

smcv commented 3 years ago

Bioshock Remastered it is a 32bit binary, while Droneswarm is a 64bit binary.

That's the key thing here. For Vulkan layers that use $LIB (or more rarely $PLATFORM) in the library_path in their JSON file, we can either make it work for 32-bit or for 64-bit, but not both, and I think it might even be random which one works.

We're hoping to fix this via https://github.com/KhronosGroup/Vulkan-Loader/pull/525 (and then backporting the fixed version into soldier for people who don't have it on their host system yet).

Looks like they've been smart enough, and created symlinks for all situations

Unfortunately that's impossible to achieve, because Arch Linux (and similar distros) expands $LIB to lib for 64-bit, but Fedora (and similar) expands $LIB to lib for 32-bit. So Arch wants a 64-bit library in lib/, but Fedora wants a 32-bit library with the same name in lib/, and only one of them can get what they want.

Debian-style multiarch can coexist with either of those setups. It looks as though you have the necessary symlinks for the Debian- and Arch-style layouts, but not for the Fedora-style layout. Having Debian- and Fedora-style layouts, but not Arch, would also be possible.

DistantThunder commented 3 years ago

Prefixing directly with the "mangohud" command, I was able to have the game start while loading Mangohud but couldn't get it to actually display:

cp /usr/lib/libMangoHud* /home/_USER_/.local/share/Steam/steamapps/common/SteamLinuxRuntime_soldier/soldier_0.20201124.0/files/lib/.


Steam_SetMinidumpSteamID:  Caching Steam ID:  76561197990390547 [API loaded no]
*******************************************************************************
* WARNING: Unknown option RADV_PERFTEST='aco'. ACO is enabled by default now. *
*******************************************************************************
ERROR: ld.so: object '/home/_USER_/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libMangoHud.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
2020-12-14 19:58:07.532 [Information][ (0)] [TID 236][red-prelauncher]: Log started. Application version: 2.0.6.1 (2020-12-04 15:29).
2020-12-14 19:58:07.533 [Information][ (0)] [TID 236][red-prelauncher]: Operating system: Windows 8 6.2 (Build 9200) (IA32)
2020-12-14 19:58:07.533 [Information][ (0)] [TID 236][red-prelauncher]: Platform identification: win8 64-bit, WINE 5.13
2020-12-14 19:58:07.535 [Information][ (0)] [TID 236][red-prelauncher]: Current working directory: 'S:/common/Cyberpunk 2077', filesystem: 'NTFS'.
2020-12-14 19:58:07.535 [Information][ (0)] [TID 236][red-prelauncher]: Skipping REDlauncher due to commandline options.
2020-12-14 19:58:07.536 [Information][ (0)] [TID 236][red-prelauncher]: Reading Launcher configuration file 'S:\common\Cyberpunk 2077\launcher-configuration.json'.
2020-12-14 19:58:07.537 [Information][ (0)] [TID 236][red-prelauncher]: Read executable path 'bin\x64\Cyberpunk2077.exe' from Launcher configuration file.
2020-12-14 19:58:07.537 [Information][ (0)] [TID 236][red-prelauncher]: Read game ID 'cyberpunk2077' from Launcher configuration file.
2020-12-14 19:58:07.538 [Information][ (0)] [TID 236][red-prelauncher]: Read platform 'steam' from Launcher configuration file.
2020-12-14 19:58:07.538 [Information][ (0)] [TID 236][red-prelauncher]: Reading Launcher language configuration file 'S:\common\Cyberpunk 2077\launcher-language.json'.
2020-12-14 19:58:07.539 [Information][ (0)] [TID 236][red-prelauncher]: Launcher language configuration file doesn't exist.
2020-12-14 19:58:07.539 [Information][ (0)] [TID 236][red-prelauncher]: Requested to launch the game.
ERROR: ld.so: object '/home/_USER_/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
2020-12-14 19:58:07.571 [Information][ (0)] [TID 236][red-prelauncher]: The game was launched under PID 240.
ERROR: ld.so: object '/home/_USER_/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/_USER_/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
skipping config: /home/_USER_/.config/MangoHud/wine-Cyberpunk2077.conf [ not found ]
skipping config: /home/_USER_/.local/share/Steam/steamapps/common/Proton 5.13/dist/bin/MangoHud.conf [ not found ]
skipping config: /home/_USER_/.config/MangoHud/wine64-preloader.conf [ not found ]
parsing config: /home/_USER_/.config/MangoHud/MangoHud.conf [ ok ]
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
*******************************************************************************
* WARNING: Unknown option RADV_PERFTEST='aco'. ACO is enabled by default now. *
*******************************************************************************
*******************************************************************************
* WARNING: Unknown option RADV_PERFTEST='aco'. ACO is enabled by default now. *
*******************************************************************************
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
324:err:vkd3d_dxil_log_callback: dxil-spirv: Raw 16-bit load-store was used, which must be implemented with SSBO or BDA.
324:err:vkd3d_dxil_log_callback: dxil-spirv: Failed to convert function.
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
MANGOHUD: Uploading is disabled (permit_upload = 0)
Version: 4.6 
Corben78 commented 3 years ago

On Ubuntu my current workaround is a script, which copies the mangohud.json config file to a new file for 32 bit, where the name of the layer is different from the one using the 64 bit library. It also replaces $LIB with the absolute path in both files. That makes MangoHud work for 32 bit and 64 bit games for me.

smcv commented 3 years ago

A new beta released today contains Vulkan-Loader version 1.2.169, which should resolve at least part of this, and maybe all of it. For details of how to try the beta, please see https://github.com/ValveSoftware/steam-runtime/blob/master/doc/reporting-steamlinuxruntime-bugs.md#using-a-beta-or-an-older-version.

To have this change, SteamLinuxRuntime_soldier/VERSIONS.txt should say you have soldier version 0.20210217.0 or later.

Please revert any workarounds you have applied before re-testing.

With this new version, I have been able to get MangoHUD to display in both 32- and 64-bit Proton/Wine/DXVK games. Here are some example free-to-play games to try:

The two 32-bit games have native Linux versions, so to make Steam run the Windows binaries under Proton/Wine/DXVK, you have to use right-click -> Properties... -> Compatibility -> Force the use of a specific Steam Play compatibility tool and select Proton 5.13-6.

smcv commented 3 years ago

Please note that because this version is better at enabling Vulkan layers, it might trigger new bugs involving a combination of multiple Vulkan layers, which were previously hidden by not all of the layers getting enabled. This might be specific to particular Mesa versions, it isn't entirely clear yet.

In particular, there seems to be a problematic interaction between MangoHUD and the Mesa device selection layer that would not always have been visible before this beta because MangoHUD was not reliably enabled, but becomes visible in this beta. Workaround: either disable MangoHUD with DISABLE_MANGOHUD=1, or disable the Mesa device selection layer with NODEVICE_SELECT=1. See #363 and #365 for more details.

Corben78 commented 3 years ago

Works for me, Proton 5.13-6 with Steam Linux Runtime soldier 0.20210217.0. Tested with the following games:

A combination of DXVK, VK3D3 and Vulkan games. I'm not aware of any Mesa device selection layer on this machine, so I had no new issues.

kisak-valve commented 3 years ago

The lack of mesa's device select layer is expected for stock mesa from Ubuntu bionic: https://packages.ubuntu.com/bionic-updates/amd64/mesa-vulkan-drivers/filelist (compared to https://packages.ubuntu.com/focal-updates/amd64/mesa-vulkan-drivers/filelist)

Corben78 commented 3 years ago

As I am using Ubuntu 20.04 (focal) the files from https://packages.ubuntu.com/focal-updates/amd64/mesa-vulkan-drivers/filelist are all present. Seems not to cause problems for me so far.

smcv commented 3 years ago

A new beta released today contains Vulkan-Loader version 1.2.169, which should resolve at least part of this, and maybe all of it.

This change is now in production releases of soldier.

Please note that there is a known issue with some versions of Mesa, documented here: https://github.com/ValveSoftware/steam-runtime/blob/master/doc/steamlinuxruntime-known-issues.md#mangohud-with-mesa-2034-and-2100rc5. Mesa 21.0.0 should be unaffected.

kisak-valve commented 3 years ago

Closing as the initially reported issue is resolved.