Fixing TF2 Crashing on Linux with Vulkan
tl;dr
You will need to add these commands to your launch options:
DRI_PRIME=1 %command% -w (your desired width) -h (your desired height) -refresh (the refresh rate of your monitor) -nojoy
Of course. remove the () and just add your values.
If you'd like the game windowed add -windowed
If you'd like it fullscreened add -fullscreen
If you'd like it borderless fullscreen (recommended for Wayland users, if
you're on Fedora use this) add -borderless
force OpenGL by adding -gl to your launch options.
I highly recommend this branch, as the Vulkan branch tends to cause issues.
Though, some have the opposite problem.
Here's a great guide if you're running the OpenGL branch for any issues you may
encounter there: AspenJag's Team Fortress 2 Linux Guide.
If you're running the Vulkan branch, some of these commands can still be useful,
such as -threads and -nojoy. Add these if you encounter further issues with the Vulkan branch.
Explaining the Core Issue and Fixing It
Many such issues including:
-Crashing X
-Rendering incorrectly on Vulkan
-Crashing the entirety of my desktop environment
-Running extremely poorly, even on modern GPUs and CPUs
-Attempting to display on a disconnected monitor or secondary monitor
-Display options being broken in game
If you have encountered some, or all of these, I'm going to explain my thoughts on why it happens, but also on how to fix it. Please note I am NOT a *nix guru by any means lol.
From looking at crash reports, it seems that the Vulkan branch gives bogus
information to the X server. One of the biggest is the refresh rate.
It tends to default to 60hz, even on higher refresh rate displays. However,
I've encountered it also attempting to display at much higher refresh rates.
I'm not exactly sure why this is, my first thought is that 60hz is hard coded
into the game, and that's what it defaults to. My second, is that when it retrieves display information from X, it gets confused, and can accidentally latch onto a secondary monitor, leading to bogus data being used. This is what causes it to crash, or even crash X itself. I've had issues on Wayland, as well, but I do not remember if they were to the degree they were on X.
The most important is -refresh.
With -refresh we can give Team Fortress 2 the refresh rate of our monitor, rather than having it try and pull that information itself.
-refresh itself will fix most crashes, just put the refresh rate of your monitor at the end of the command:
-refresh 60
Rendering on the Wrong Monitor
It's actually very easy to fix! (Thankfully!) Though, quick explaination so we understand how to use this properly.
X sessions have a display, and that's not your monitor! It's rather where applications are rendering to for your X server. I know, I know, confusing. For simplicity sake, 0 is your main display and that's your desktop. Connected to this display is your monitors. So how do we change which monitor to use?
Easily! Assuming you're display 0, apply this command to the beginning of your launch options:
DISPLAY=:0.(your display number) %command%
Your main display will be 0 as well. So the full command would be:
DISPLAY=:0.0 %command%
If you wanted it on your second monitor, which would be 1, it would be:
DISPLAY=:0.1 %command%
The full format of this command is:
DISPLAY=:(display).(monitor) %command%
In computer-land, we start with 0, and add up from there.
Remember to type these exactly or otherwise Team Fortress 2 will not launch.
You must add %command% afterward, as any command after will be Source commands, not those intended for Linux.
Display Options Not Functioning In-Game
Adding to your launch options, you can include:
-windowed (the game will be windowed)
-fullscreen (the game will take over the entire screen, the default behaviour)
-borderless (uses a window with no frame or ui above or around it)
If you are on Wayland I would highly suggest using the -borderless option if you want a fullscreen experience, as fullscreen tends to render incorrectly. If you are unsure if you are on Wayland, it may be best to use borderless in case, or just experiment to see what works best for you.
The Game is Using Integrated Graphics
DRI_PRIME=1 %command%
If you're using an nVidia GPU on a laptop, you may want to use this instead:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only %command%
Now, if you've used the monitor command from earlier DO NOT add %command% twice.
Misc. Issues Related with the Vulkan Branch
These commands tell Team Fortress 2 to ignore all controller input.
However, I have noticed the Vulkan branch will still tend to only use a single thread. This is awful for modern CPUs! You can try this command (taken from AspenJag's Team Fortress 2 Linux Guide) to tell Team Fortress 2 how many threads it can utilize:
-threads (your cpu's thread count)
Though, I cannot attest to if it will fix the issue or not. If you are still experiencing issues with low framerate and low utilization, please change over to the Legacy branch.
I noticed several hundred FPS increase from switching over.
Conclusion and Example Options
If you're using the OpenGL branch (named Legacy in the launch menu), I would recommend AspenJag's Team Fortress 2 Linux Guide as she has some great and valuable information available. Many of the commands she mentions will also work on the Vulkan branch, and may be of great use to you.
For an idea of how your launch options could be, here you go:
DRI_PRIME=1 DISPLAY=:0.0 %command% -w 1600 -h 900 -refresh 75 -fullscreen -nojoy
Thank you for reading :3
This guide was created by its original author on the Steam Community. Are you the author and want it removed? Request removal.