Team Fortress 2

Team Fortress 2

27 ratings
Linux TF2 not launching fix (libtcmalloc_minimal.so.4 Error) [October 2023]
By Über
How to fix TF2 not launching on Linux, from a bug that was introduced in early September of 2023. Seemingly unpatched as of October 27th.
6
   
Award
Favorite
Favorited
Unfavorite
Confirm the bug
This guide is to fix a not-launching bug caused by TF2's tcmalloc binary.

To find out if this is your problem, set your TF2 launch options as the following without quotation marks
"%command% &> ~/tf2log.txt"

Then check your home directory and look at the tf2log.txt file, if it ends in an error message like this, you've found your problem

    Path/SteamLibrary/steamapps/common/Team Fortress 2/hl2_linux: error while loading shared libraries: libtcmalloc_minimal.so.4: wrong ELF class: ELFCLASS64

Continue with the guide if you have this error.
If you don't, look at Misc Problems below, it may or may not help.
Change the Binary
The TF2 tcmalloc should be in ~/.local/share/Steam/steamapps/commom/Team Fortress 2/bin and be named libtcmalloc_minimal.so.4

Your system tcmalloc binary should be in either /usr/lib64 or /usr/lib, find one with the same name of libtcmalloc_minimal.so.4.

You want to replace the TF2 one with your system one. Here's a couple ways to do it:

1:
Put "LD_PRELOAD=/path/to/lib:$LD_PRELOAD %command%" into your TF2 launch options.

2:
Create a symlink to your system binary inside the TF2 folder.

3:
Copy and paste the system tcmalloc into the tf2 folder.






IF YOU'RE ON ARCH, and likely Arch-based distros
I don't think this will work. Arch only ships 64-bit tcmalloc binaries as far as I'm aware. And TF2 requires a 32-bit binary.
If this is the case, you can use the Half-Life 2 tcmalloc binary instead. It'll be in ~/.local/share/SteamLibrary/steamapps/common/Half-Life 2/bin and named libmimalloc.so. Just rename it to libtcmalloc_minimal.so.4.

If you don't have Half-Life 2...Emma in the comments said the lib32-gperftools package from the AUR solves this issue for Arch. Install the package and follow the steps above.
Misc problems
If you didn't have the error message, but you're still having problems with TF2, here's some fixes that might work:
Verify integrity of game files.
Uninstall and Reinstall the game.
Restart your computer.


Turn off Steam overlay.
Go to compatibility in properties and set it to Steam Linux runtime.
Addendum
If you have questions, ask.
If I said something wrong, please tell me.
If you know something I don't, please go ahead and post in the comments.

If you have trouble and want to ask for help, please specify what distro you're using and what you've tried.
52 Comments
trungus May 5, 2024 @ 5:27am 
hehe i knew how to fix this b4 u
Deron Mar 24, 2024 @ 3:46pm 
I have no idea why this even works, but it works
Über  [author] Mar 19, 2024 @ 11:33pm 
Done. Thanks.
werecat Mar 19, 2024 @ 10:36pm 
Just today after using this for a while it suddenly had problems connecting to VAC servers. It was fixed when I switched from the `LD_PRELOAD=/path/to/libtcmalloc_minimal.so %command%` to `LD_PRELOAD=/path/to/libtcmalloc_minimal.so:$LD_PRELOAD %command%`. It also fixed my steam overlay, so you should probably only list the version that includes the old LD_PRELOAD included
fia Feb 29, 2024 @ 10:11am 
it's insane this isn't patched even after 6 months, i know 64 bit support is gonna fix it but you'd figure they'd at least have something for the time before that releases
abbieoverflight Feb 15, 2024 @ 7:47am 
cheers, this worked great!
Emma Feb 11, 2024 @ 8:16am 
Hi, installing lib32-gperftools from AUR seems to solve the issue.
Don't forget to copy it over from /usr/lib or symlink or just use the LD_Preload command.
Über  [author] Jan 16, 2024 @ 8:21pm 
I understand that.
What package on the AUR?
Lutris Jan 16, 2024 @ 6:54pm 
Arch User Repository
Über  [author] Jan 16, 2024 @ 5:58pm 
AUR Steam?
What package is that exactly?