protonscr

steamwebhelper crash loop on startup under flatpak: Could not find requesting pid

steamopen Web ComponentFlathub-provided steam package
ValveSoftware/steam-for-linux#10645 · opened 2024-03-20 by jjl · updated 2024-03-24 · 5 comments · github
Jjjl 2024-03-20 github

Your system information

  • Steam client version (build number or date): latest flatpak
  • Distribution (e.g. Ubuntu): alpine (but flatpak)
  • Opted into Steam client beta?: no
  • Have you checked for system updates?: yes
  • Steam Logs: steam-logs.tar.gz
  • GPU: AMD

Please describe your issue in as much detail as possible:

running through flatpak, i am greeted with some errors about steamwebhelper and eventually a troubleshooting dialog offering me some options like disable browser sandboxing, none of which work

gist

Steps for reproducing this issue:

  1. update flatpak to latest
  2. launch.
Ssmcv 2024-03-21 github

I think the key error message here is:

steam-runtime-launch-client[2083]: E: Could not find requesting pid

which is a problem with the communication between steam-runtime-launch-client and flatpak-portal.

@kisak-valve, please retitle to something like "steamwebhelper crash loop on startup under flatpak: Could not find requesting pid" to distinguish this from other similar issues?

Ssmcv 2024-03-21 github

In this context, steam-runtime-launch-client is basically a reimplementation/fork of flatpak-spawn.

The error message Could not find requesting pid means that flatpak-portal, which is a D-Bus-activated service, cannot identify the steam-runtime-launch-client as part of Steam, which it does like this:

  • read /proc/$pid/root/.flatpak-info to find the [Instance] instance-id; let's say it's 12345
  • read $XDG_RUNTIME_DIR/.flatpak/12345/bwrapinfo.json to find the child-pid

One way this could go wrong is if the way you launched the Steam Flatpak app, and the environment that the flatpak-portal inherited from the D-Bus session bus, don't have a matching XDG_RUNTIME_DIR?

Flatpak relies on the D-Bus activation environment inherited by the flatpak-portal, and the environment in which you run Flatpak apps, being sufficiently similar.

A simpler reproducer for this might be:

$ flatpak run --command=bash com.valvesoftware.Steam
[📦 com.valvesoftware.Steam ~]$ flatpak-spawn -v -v true
[📦 com.valvesoftware.Steam ~]$ flatpak-spawn -v -v --share-pids --app-path="" true

For Steam as a Flatpak app to work, both of those flatpak-spawn commands need to succeed. The first one is simpler and more likely to succeed; the second one is a closer equivalent of what Steam actually needs.

Jjjl 2024-03-22 github

i'm not entirely sure what flatpak-portal is, but i checked what XDG_RUNTIME_DIR was via bash under flatpak and i can confirm that it didn't match for distribution-related reasons. i've changed some things to make it look a bit more like the systemd-based environment it's expecting, but this doesn't completely resolve the issue (though i'm unable to detect what you suggested was the key error previously this time).

steam-logs.tar.gz

here's output of the flatpak-spawn:

[📦 com.valvesoftware.Steam ~]$ flatpak-spawn -v -v true
F: child_pid: 4544
F: child exited 4544: 0
F: child exit code 4544: 0

and here's the log of the console:

INFO:root:https://github.com/flathub/com.valvesoftware.Steam/wiki
INFO:root:Will set XDG dirs prefix to /home/james/.var/app/com.valvesoftware.Steam
DEBUG:root:Checking input devices permissions
INFO:root:Overriding TZ to Europe/Amsterdam
steam.sh[2]: Running Steam on org.freedesktop.platform 23.08 64-bit
steam.sh[2]: STEAM_RUNTIME is enabled automatically
setup.sh[75]: Steam runtime environment up-to-date!
steam.sh[2]: Steam client's requirements are satisfied
tid(109) burning pthread_key_t == 0 so we never use it
[2024-03-22 21:42:01] Startup - updater built Mar  6 2024 20:27:25
[2024-03-22 21:42:01] Startup - Steam Client launched with: '/home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_32/steam' '-no-cef-sandbox'
minidumps folder is set to /tmp/dumps
03/22 21:42:01 Init: Installing breakpad exception handler for appid(steam)/version(1709846872)/tid(109)
[2024-03-22 21:42:02] Loading cached metrics from disk (/home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/package/steam_client_metrics.bin)
[2024-03-22 21:42:02] Using the following download hosts for Public, Realm steamglobal
[2024-03-22 21:42:02] 1. https://client-update.akamai.steamstatic.com, /, Realm 'steamglobal', weight was 1000, source = 'update_hosts_cached.vdf'
[2024-03-22 21:42:02] 2. https://cdn.cloudflare.steamstatic.com, /client/, Realm 'steamglobal', weight was 1, source = 'update_hosts_cached.vdf'
[2024-03-22 21:42:02] 3. https://cdn.steamstatic.com, /client/, Realm 'steamglobal', weight was 1, source = 'baked in'
[2024-03-22 21:42:02] Verifying installation...
[2024-03-22 21:42:02] Verification complete
UpdateUI: skip show logo
Steam logging initialized: directory: /home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/logs

XRRGetOutputInfo Workaround: initialized with override: 0 real: 0xecf4e8f0
XRRGetCrtcInfo Workaround: initialized with override: 0 real: 0xecf4d1c0
steamwebhelper.sh[139]: === Fri Mar 22 21:42:02 CET 2024 ===
steamwebhelper.sh[139]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
CAppInfoCacheReadFromDiskThread took 179 milliseconds to initialize
mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
Steam Runtime Launch Service: starting steam-runtime-launcher-service
Steam Runtime Launch Service: steam-runtime-launcher-service is running pid 271
bus_name=com.steampowered.PressureVessel.LaunchAlongsideSteam
steamwebhelper.sh[334]: === Fri Mar 22 21:42:12 CET 2024 ===
steamwebhelper.sh[334]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
steamwebhelper.sh[407]: === Fri Mar 22 21:42:22 CET 2024 ===
steamwebhelper.sh[407]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
src/steamUI/steamuisharedjscontroller.cpp (546) : Failed creating offscreen shared JS context
src/steamUI/steamuisharedjscontroller.cpp (546) : Failed creating offscreen shared JS context
03/22 21:42:24 Init: Installing breakpad exception handler for appid(steam)/version(1709846872)/tid(109)
assert_20240322214224_26.dmp[482]: Uploading dump (out-of-process)
/tmp/dumps/assert_20240322214224_26.dmp
assert_20240322214224_26.dmp[482]: Finished uploading minidump (out-of-process): success = yes
assert_20240322214224_26.dmp[482]: response: CrashID=bp-53639c72-6537-4744-b2c7-e7d142240322
assert_20240322214224_26.dmp[482]: file ''/tmp/dumps/assert_20240322214224_26.dmp'', upload yes: ''CrashID=bp-53639c72-6537-4744-b2c7-e7d142240322''
steamwebhelper.sh[494]: === Fri Mar 22 21:42:33 CET 2024 ===
steamwebhelper.sh[494]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
[2024-03-22 21:42:39] Shutdown
Ssmcv 2024-03-24 github

i checked what XDG_RUNTIME_DIR was via bash under flatpak and i can confirm that it didn't match for distribution-related reasons

For your reference, XDG_RUNTIME_DIR is defined in the XDG basedir spec. There are some quite specific properties defined for it, and some or all of those properties might be functionally required by frameworks like Flatpak or by applications.

Flatpak uses GLib. If XDG_RUNTIME_DIR is unset, then the GLib functions that use it will fall back to using an on-disk directory (~/.cache I think) with a warning, and that should be adequate for Flatpak's needs. But if XDG_RUNTIME_DIR is set, but to a directory that does not meet the requirements of the basedir spec (for example having different values for D-Bus-activated services and for your interactive shell), then Flatpak will probably not work as intended.

This is more likely to be an integration issue with how your distribution has packaged your GUI environment, dbus and/or Flatpak, rather than a Steam issue.

(Or, if you built and installed your GUI environment, dbus and/or Flatpak yourself, then you are the system integrator, and it's you rather than your distribution that is responsible for setting this up to work as intended. I don't know how "batteries included" Alpine is.)

via bash under flatpak

To simplify things for Flatpak apps, the value of XDG_RUNTIME_DIR inside the Flatpak sandbox is always the conventional path /run/user/$(id -u), even if the path outside the sandbox is different. That isn't what I meant, though.

What I meant is that these two, outside the Flatpak sandbox, need to match:

  1. the value of XDG_RUNTIME_DIR that flatpak run will inherit from the shell or GUI session where you started it;
  2. the value of XDG_RUNTIME_DIR that flatpak-portal will inherit from dbus-daemon --session

If they do not, then flatpak-portal is not going to work as intended, because information saved by (1.) will not be available to (2.).

The "activation environment" that determines (2.) is inherited from whatever piece of session infrastructure was responsible for starting your dbus-daemon --session, unless overridden by dbus-update-activation-environment(1).

Again, this is a system integration thing about how dbus, Flatpak and your GUI session fit together, rather than a Steam thing.

On typical desktop Linux distributions, normally a PAM module provided by a component like systemd-logind or elogind will set XDG_RUNTIME_DIR to /run/user/$(id -u) during login. There are various alternative implementations of this that can be used on less-typical distributions, like pam_runtime and turnstile. I don't know how Alpine fits together or whether it uses PAM, but for Flatpak to work as intended, something is going to need to set this up. The XDG basedir spec does not require any specific path, but I would recommend using /run/user/$(id -u) - there's no real reason to make a different choice there.

i'm not entirely sure what flatpak-portal is

It's a service that is shipped as part of Flatpak, and is necessary for some Flatpak features. The one that matters here is that it's required by any Flatpak app that wants to create what Flatpak calls a "sub-sandbox": either a container that has tighter sandboxing (for example most apps based on Chromium need this), or a container that selects a different runtime as its /usr (for example Steam needs this).

If flatpak-portal doesn't work correctly, then neither will Steam packaged as a Flatpak app.

[📦 com.valvesoftware.Steam ~]$ flatpak-spawn -v -v true
F: child_pid: 4544
F: child exited 4544: 0
F: child exit code 4544: 0

Good, basic use of flatpak-spawn is working on your system. What about flatpak-spawn -v -v --share-pids --app-path="" true? That's closer to what Steam actually needs, and it is the --share-pids part that will not work if flatpak run and flatpak-portal don't inherit the same XDG_RUNTIME_DIR.

Jjjl 2024-03-24 github

thank you for the explanations, this is really handy stuff that i wish were easier to find writing about.

For your reference, XDG_RUNTIME_DIR is defined in the XDG basedir spec. There are some quite specific properties defined for it, and some or all of those properties might be functionally required by frameworks like Flatpak or by applications.

yes, i found this when setting up XDG_RUNTIME_DIR previously to enable some other apps to work, but it doesn't say it has to be in a particular place AFAICT.

(Or, if you built and installed your GUI environment, dbus and/or Flatpak yourself, then you are the system integrator, and it's you rather than your distribution that is responsible for setting this up to work as intended. I don't know how "batteries included" Alpine is.)

alpine is a choose your own adventure distribution. i do not like the desktop environments which are well supported by the alpine maintainers so i accept there will be some friction with some software. it's just a bit difficult to get together a list of things that i'm doing wrong without running into them and steam had been working perfectly fine until recently. :shrug:

Good, basic use of flatpak-spawn is working on your system. What about flatpak-spawn -v -v --share-pids --app-path="" true? That's closer to what Steam actually needs, and it is the --share-pids part that will not work if flatpak run and flatpak-portal don't inherit the same XDG_RUNTIME_DIR.

Oh, I interpreted that as a failure. i guess true was a command. Here's the second command's output:

F: Using "" as /app instead of runtime
Portal call failed: Could not find requesting pid

I tried updating the activation environment as you suggested:

dbus-update-activation-environment XDG_RUNTIME_DIR=/var/run/1000

but no joy.

Steam Runtime Launch Service: starting steam-runtime-launcher-service
Steam Runtime Launch Service: steam-runtime-launcher-service is running pid 271
bus_name=com.steampowered.PressureVessel.LaunchAlongsideSteam
steamwebhelper.sh[334]: === Sun Mar 24 14:22:54 CET 2024 ===
steamwebhelper.sh[334]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
steamwebhelper.sh[407]: === Sun Mar 24 14:23:05 CET 2024 ===
steamwebhelper.sh[407]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/james/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
src/steamUI/steamuisharedjscontroller.cpp (546) : Failed creating offscreen shared JS context
src/steamUI/steamuisharedjscontroller.cpp (546) : Failed creating offscreen shared JS context
03/24 14:23:06 Init: Installing breakpad exception handler for appid(steam)/version(1709846872)/tid(109)
assert_20240324142306_26.dmp[482]: Uploading dump (out-of-process)
/tmp/dumps/assert_20240324142306_26.dmp
assert_20240324142306_26.dmp[482]: Finished uploading minidump (out-of-process): success = yes
assert_20240324142306_26.dmp[482]: response: CrashID=bp-7e2265af-f24a-450b-869c-c5fda2240324
assert_20240324142306_26.dmp[482]: file ''/tmp/dumps/assert_20240324142306_26.dmp'', upload yes: ''CrashID=bp-7e2265af-f24a-450b-869c-c5fda2240324''
^C
                                                                                
(steam-runtime-launcher-service:271): GLib-GIO-WARNING **: Error releasing name com.steampowered.PressureVessel.LaunchAlongsideSteam: The connection is closed

(steam-runtime-launcher-service:271): GLib-GIO-WARNING **: Error releasing name com.steampowered.PressureVessel.LaunchAlongsideSteam.Instance271: The connection is closed

Nothing extracted yet.