flatpak / flatpak

Linux application sandboxing and distribution framework
https://flatpak.org
GNU Lesser General Public License v2.1
4.22k stars 400 forks source link

Flatpak app/game does not work with Steam's Overlay or Steam Streaming #1756

Open magicmyth opened 6 years ago

magicmyth commented 6 years ago

Linux distribution and version

Kde Neon (Ubuntu 16.04), Solus OS

Flatpak version

0.11.7, 0.10.4

Description of the problem

Normally if you add a non-Steam Game to Steam its overlay and streaming feature will function correctly. However if you add a game that has been packaged as a Flatpak to Steam as a non-Steam Game then the mentioned features will not work except with the exception that the Steam Link will display the video content successfully but will still not work with the overlay. For streaming I tested Ubuntu to Ubuntu, Ubuntu to Solus, Solus to Ubuntu and all show no video output. The game will otherwise work fine within Steam.

Note this is not about the flatpak version of Steam but the native distro package version working with games that run within a flatpak enviroment.

Steps to reproduce

  1. Install a flatpaked game: flatpak install flathub net.supertuxkart.SuperTuxKart
  2. Add /var/lib/flatpak/exports/bin/net.supertuxkart.SuperTuxKart as a Non-Steam Game
  3. Launch the game and try to activate the steam overlay or try to stream the game to a Linux box. When Streaming the audio will output to the client but the screen is blank when the client is a Linux machine. The Steam Link shows the video content correctly though.

I've tried overriding various permissions to no avail. My guess is Steam is failing to inject its libraries (e.g gameoverlayrenderer2.so) into the sandboxed app. I tried to manually inject the overlay library with --env=LD_PRELOAD="/SOMEPATH/.local/share/Steam/ubuntu12_64/gameoverlayrenderer2.so:$LD_PRELOAD" but that had no affect.

magicmyth commented 6 years ago

I discovered that the video streaming does work with a Steam Link which I find very strange. I was experimenting with two machines next to each other before (didn't want to run up and down the stairs 😅) and I figured the Link would have the same behavior but turns out nope.

Overlay never works though.

Forgot to mention earlier I tested the exact same games both as Flatpaked, native package, and non-packaged versions. Only with flatpak variants does overlay break and streaming have issues with Linux clients.

I'm hoping to get some understanding of the issue before making one on Valve's issue tracker.

I edited the op to mention the working streams to Steam Link.

omichalek commented 6 years ago

I just tried streaming to the Steam Link yesterday but it did not work - I was able to pair the Link with the flatpaked Steam client, but it only showed static graphical artifacts and fragments from the steam window. Pressing the logo button should switch the client into the "big picture mode" but it did nothing and the image did not change in any way. I am on Wayland (openSuse Tumbleweed). I suppose you use X server or Mir?

magicmyth commented 6 years ago

@omichalek Just to clear my bug is not about the flatpak version of Steam on Flathub but about running flatpaked games within non-sandboxed Steam (the native Steam package). Yes my tests were using X11 (should have mentioned that). I'm not surprised Streaming does not work for you. I am surprised you got something though. As far as I know Steam would have to use a different protocol to capture windows on Wayland.

omichalek commented 6 years ago

@magicmyth non-flatpak Steam, I missed that, but thank you for the info

smcv commented 6 years ago

I tried to manually inject the overlay library with --env=LD_PRELOAD="/SOMEPATH/.local/share/Steam/ubuntu12_64/gameoverlayrenderer2.so:$LD_PRELOAD" but that had no affect.

To make this work, it would be necessary to make the overlay renderer LD_PRELOAD object available at some path inside Flatpak's container, and set LD_PRELOAD inside the container to the path at which it was made available.

--filesystem=~/.local/share/Steam might help?

magicmyth commented 6 years ago

I already tried overriding permissions (including specifically granting access to the Steam lib folder) but that made no difference.

ananace commented 6 years ago

Steam sets quite a few environment parameters when launching a game, I've personally had issues with that before.

I'd suggest adding a env > ~/.last-steam-env line - or something like that - to one of your Linux game launch scripts, see if adding any more of the other environment values helps.

magicmyth commented 6 years ago

@ananace Thanks for the suggestion. I forgot about using env to collect that data.

I made a simple modification to one of my flatpaks (Yamagi Quake II to be specific) so it called a simple shell script wrapper that dumped the environment values and surprisingly (at least to me) most of it gets passed through correctly. I think Steam is managing to inject the gameoverlayrenderer.so library because I still get the usual: ERROR: ld.so: object '/PATH/TO/STEAM/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. That message would be different if the executable was not able to find the file and non-existant if LD_PRELOAD was not being passed. I've even added to LD_PRELOAD libraries that don't exist to view the behaviour and the console does indeed output warnings about the missing fake libraries. So it does seem the flatpak environment is at least attempting to load the steam overlay libraries in some way.

Can anyone tell me how to check the libraries a running process is using?

One thing to note is the GALLIUM_HUD feature of Mesa Radeon works so flatpak definitely does not completely block injecting overlays.

I'm attaching the environment information for the running game. One is the system version the other is the flatpak. Maybe someone else can sport an important difference? last-steam-env.txt last-steam-env-flatpak.txt

magicmyth commented 6 years ago

Just noticed something that Steam outputs. When using the system version of the app Steam will show:

 Installation
                           Installing breakpad exception handler for appid(gameoverlayui)/version(20180626000013)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)

But with the flatpak version it simply shows

 Installation

None of the breakpads handlers seem to get installed in the flatpak environment.

tmcd35 commented 2 years ago

Bumping this one.

Was any solution/fix ever found? I've been playing with Steam on Manjaro KDE and running in to this issue setting up Bottles and RetroArch as Flatpaks. A nieve attempt at mimicing SteamOS 3 on the Steam Deck. Appears Steams Overlays are not running when a Flatpak has been launched from the Steam Client. This breaks controller support and forces controller configuration though Desktop Configuration's Keyboard/Mouse emulation - which is less than ideal.

Either Valve or Flatpak need to find a fix for this for Steam + Flatpaks to be a viable solution outside of SteamOS.

Jaynator495 commented 2 years ago

Also bumping this one as I'm running into this issue on Steam Deck

ethan021021 commented 2 years ago

Bump on this as well. Seeing the same issue

lapastillaroja commented 4 months ago

I'm having this exact same problem on Fedora 40, GNome 46