Fixing BeamNG.drive on Flatpak Steam
I run BeamNG.drive’s native Linux build through the Flatpak version of Steam (on Arch, btw). It used to be stable, but after a system update it started crashing on launch more often than not.
Whenever the game fell over, systemd-coredump would show me something like this:
Stack trace of thread 12147:
#0 0x00007fc6975cdfb5 n/a (libcef.so + 0x7fcdfb5)
#1 0x00007fc6975ce380 n/a (libcef.so + 0x7fce380)
#2 0x00007fc697f4eae7 n/a (libcef.so + 0x894eae7)
#3 0x00007fc697f4c160 n/a (libcef.so + 0x894c160)
#4 0x00007fc68cece332 n/a (/usr/lib/x86_64-linux-gnu/libdbus-1.so.3.19.17 + 0x30332)
The game was stable when I launched BinLinux/BeamNG.drive.x64 directly. Disabling the Steam Overlay did not help, so I started comparing environment variables. The important difference turned out to be one set by Flatpak Steam:
LD_AUDIT=/app/links/$LIB/libshared-library-guard.so
Fortunately, the workaround is simple. Set the following launch option for BeamNG.drive in Steam:
LD_AUDIT= %command%
Flatpak Steam uses the dynamic linker’s LD_AUDIT mechanism to load libshared-library-guard.so. Its job is to stop games from loading bundled libraries that are known to conflict with newer versions provided by Steam or the system. Clearing LD_AUDIT keeps the guard from loading, which stopped the crashes for me.
The exact cause remains unknown. It could involve an interaction with the dynamic linker or simply the timing of Chromium Embedded Framework initialization. Since the workaround is narrow in scope, I will leave further investigation as an exercise for the reader.