Open itsvic-dev opened 8 months ago
This bug is not only affecting NixOS. You can work around the crash by adding pkgsi686Linux.gperftools to systemPackages and then use this launch option within Steam:
LD_PRELOAD=$LD_PRELOAD:/run/current-system/sw/lib/libtcmalloc_minimal.so %command%
This bug is not only affecting NixOS. You can work around the crash by adding pkgsi686Linux.gperftools to systemPackages and then use this launch option within Steam:
LD_PRELOAD=$LD_PRELOAD:/run/current-system/sw/lib/libtcmalloc_minimal.so %command%
The workaround seems to work, thank you!
If the bug is reproducible on other distros, it should probably be reported upstream it if wasn't yet.
If the bug is reproducible on other distros, it should probably be reported upstream it if wasn't yet.
Here's an alternative method which fixes all Source 1 games without modifying launch options.
(steam.override { extraLibraries = pkgs: [ pkgs.gperftools ]; })
Mostly unrelated, but I actually do quite a few whacky things with Steam's package in home-manager
so I'll share below what my actual steam package declaration looks like:
# This creates a wrapper forcing the binary to always run through nixGL, enabling hardware accel outside NixOS
# Not necessary on nixOS. Needs tweaking to work with NVIDIA, details here: https://github.com/nix-community/nixGL
let
nixVulkan = nixgl.packages.${pkgs.system}.nixVulkanIntel; # nixgl refers to the nixGL flake (see above link)
nixVulkanWrap = pkg: lib.meta.hiPrio (pkgs.symlinkJoin {
name = pkg.name;
paths = [
(pkgs.writeShellApplication {
name = pkg.meta.mainProgram;
runtimeInputs = [ nixVulkan ];
text = ''exec ${lib.getExe nixVulkan} ${lib.getExe pkg} "$@"'';
})
pkg
];
});
# The above wrapper is overkill for just Steam, but in my full config I use it with lots of packages
in (nixVulkanWrap (steam.override {
# Fixes Source 1 games like TF2, unlikely chance of breaking other Linux native games though?
extraLibraries = pkgs: [ pkgs.gperftools ];
# Here we do some linker tricks to achieve two different goals:
# - Automatically enable gamemode whenever Steam is running
# -- NOTE: Assumes that a working system install of gamemode already exists!
# - Fix invisible Steam Input cursors on Wayland using extest
# -- extest is not yet on nixpkgs, but will be soon (see https://github.com/NixOS/nixpkgs/pull/269881)
# -- For the time being I've been using my own flake to overlay it in: https://github.com/chaorace/extest-nix
extraProfile = let gmLib = "${lib.getLib(pkgs.gamemode)}/lib"; in ''
export LD_PRELOAD="${pkgs.extest}/lib/libextest.so:${gmLib}/libgamemodeauto.so:$LD_PRELOAD"
export LD_LIBRARY_PATH="${gmLib}:$LD_LIBRARY_PATH"
'';
}))
Here's an alternative method which fixes all Source 1 games without modifying launch options.
* Pros: Doesn't pollute system libraries, No LD_PRELOAD, Same solution on all Linux platforms * Cons: Might break other Linux native games if they don't like gperftools?
(steam.override { extraLibraries = pkgs: [ pkgs.gperftools ]; })
Sad, I tried this and I can't manage to make it work, I have checked with steam-run ldconfig -p
if the libraries got overridden and yeah, I can see libtcmalloc_minimal.so
exist but TF2 still crashes
Sad, I tried this and I can't manage to make it work, I have checked with
steam-run ldconfig -p
if the libraries got overridden and yeah, I can seelibtcmalloc_minimal.so
exist but TF2 still crashes
Hmm... are you using a Wayland environment? If so, try forcing x11 SDL with the following launch option in the Steam TF2 settings: SDL_VIDEODRIVER=x11 %command%
. TF2's vendored version of SDL at bin/libSDL2-2.0.so.0
is known to be fairly busted at the moment.
If you're still having issues after trying that, then perhaps it's a driver issue? Earlier this year, NVIDIA introduced a crash starting in driver version 525.60.11
(Nov. 2022) which was patched starting with driver 530.41.03
(April 2023).
If you've verified that's not the issue, are you sure if it's truly crashing every single time? In my experience, the client is super flakey during launch, but can be brute-forced if you retry enough times (5-10 times).
It's the same src/tcmalloc.cc:278] Attempt to free invalid pointer 0x9e37af0
crash, and I do use wayland but I use AMD.
This bug is not only affecting NixOS. You can work around the crash by adding pkgsi686Linux.gperftools to systemPackages and then use this launch option within Steam:
LD_PRELOAD=$LD_PRELOAD:/run/current-system/sw/lib/libtcmalloc_minimal.so %command%
this works perfectly tho!
I can confirm the systemPackages
fix works for me. Adding the following module:
({ pkgs, ... }: {
environment.systemPackages = [ pkgs.pkgsi686Linux.gperftools ];
})
and launch option:
LD_PRELOAD=$LD_PRELOAD:/run/current-system/sw/lib/libtcmalloc_minimal.so %command%
fixed the core dump crash.
I tried the override, thinking that maybe it didn't work for @ImUrX as written because it wasn't picking out the i686 version specifically:
nixpkgs.overlays = [
(final: prev: {
steam = prev.steam.override {
extraLibraries = pkgs: [ pkgs.pkgsi686Linux.gperftools ];
};
})
];
but this didn't work when I tried it. I don't know if the override is wrong, or if it needs to be somewhere else.
I switched to the override method in the meantime. Just make sure to restart Steam after the nixos-rebuild or it won't pick up the changed environment. I guess this is why a few people are not able to play TF2 still without doing my own hacky workaround.
This bug is not only affecting NixOS. You can work around the crash by adding pkgsi686Linux.gperftools to systemPackages and then use this launch option within Steam: LD_PRELOAD=$LD_PRELOAD:/run/current-system/sw/lib/libtcmalloc_minimal.so %command%
Works! I can confirm I got Portal Stories Mel working with this
Here's an alternative method which fixes all Source 1 games without modifying launch options.
* Pros: Doesn't pollute system libraries, No LD_PRELOAD, Same solution on all Linux platforms * Cons: Might break other Linux native games if they don't like gperftools?
(steam.override { extraLibraries = pkgs: [ pkgs.gperftools ]; })
Mostly unrelated, but I actually do quite a few whacky things with Steam's package in
home-manager
so I'll share below what my actual steam package declaration looks like:# This creates a wrapper forcing the binary to always run through nixGL, enabling hardware accel outside NixOS # Not necessary on nixOS. Needs tweaking to work with NVIDIA, details here: https://github.com/nix-community/nixGL let nixVulkan = nixgl.packages.${pkgs.system}.nixVulkanIntel; # nixgl refers to the nixGL flake (see above link) nixVulkanWrap = pkg: lib.meta.hiPrio (pkgs.symlinkJoin { name = pkg.name; paths = [ (pkgs.writeShellApplication { name = pkg.meta.mainProgram; runtimeInputs = [ nixVulkan ]; text = ''exec ${lib.getExe nixVulkan} ${lib.getExe pkg} "$@"''; }) pkg ]; }); # The above wrapper is overkill for just Steam, but in my full config I use it with lots of packages in (nixVulkanWrap (steam.override { # Fixes Source 1 games like TF2, unlikely chance of breaking other Linux native games though? extraLibraries = pkgs: [ pkgs.gperftools ]; # Here we do some linker tricks to achieve two different goals: # - Automatically enable gamemode whenever Steam is running # -- NOTE: Assumes that a working system install of gamemode already exists! # - Fix invisible Steam Input cursors on Wayland using extest # -- extest is not yet on nixpkgs, but will be soon (see https://github.com/NixOS/nixpkgs/pull/269881) # -- For the time being I've been using my own flake to overlay it in: https://github.com/chaorace/extest-nix extraProfile = let gmLib = "${lib.getLib(pkgs.gamemode)}/lib"; in '' export LD_PRELOAD="${pkgs.extest}/lib/libextest.so:${gmLib}/libgamemodeauto.so:$LD_PRELOAD" export LD_LIBRARY_PATH="${gmLib}:$LD_LIBRARY_PATH" ''; }))
@chaorace You don't need libgamemodeauto unless you want to use it for all games? https://github.com/FeralInteractive/gamemode/issues/345
@jh-devv You are correct. As the config comments mention, it's something that I do so that gamemode is enabled whenever Steam is running without needing to fiddle with individual game launch options.
I specifically want the behavior you mention because I view it as a convenience. It is not necessary to do this to fix TF2 or use gamemode and I am sorry for having inadvertently implied otherwise.
@jh-devv You are correct. As the config comments mention, it's something that I do so that gamemode is enabled whenever Steam is running without needing to fiddle with individual game launch options.
I specifically want the behavior you mention because I view it as a convenience. It is not necessary to do this to fix TF2 or use gamemode and I am sorry for having inadvertently implied otherwise.
No problem! The help ya provided with TF2 is cool though, I got it working finally!!
FTR, I was having this issue with Against the Storm after the game was updated (it used to run fine without), and fixed using @chaorace's steam.override
from https://github.com/NixOS/nixpkgs/issues/271483#issuecomment-1847417013.
As it turns out, there’s commits in GCC’s 14.x, 13.x and 12.x branches that prevent outdated versions of tcmalloc from causing this issue. Those commits are from 2024, but the most recent releases of GCC are all from 2023, so the fix isn’t in any stable release of GCC yet. Perhaps we could patch GCC in the meantime?
@chaorace's solution doesn't work for me. There's an issue with the nixos module calling override in the package option's apply
. I am guessing this is because I install steam through nixos and not home-manager. I tried to look for context how the snippet was used in their configuration but didn't find a public repo with it.
using environment.systemPackages = [ pkgs.pkgsi686Linux.gperftools ];
and setting launch options works though.
It's now fixed for TF2 due to the 64-bit update, but it's still broken with Counter-Strike: Source, and probably others.
changed the title to be slightly more accurate
Team Fortress 2 (downloaded via Steam) does not run in NixOS 23.11. It ran fine under NixOS 23.05.
Additional context
Notify maintainers
@mkg20001
Metadata