Steam for Linux

Steam for Linux

96 ratings
Using Steam in a Flatpak
By >noderunner_
Steam in a Flatpak, demystified.
4
3
5
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Advantages and Disadvantages
You might be wondering, why would I want to use Steam in a Flatpak rather than natively from my package manager?
  • Almost certainly works on your Linux distribution.
  • Keeps proprietary Steam and games sandboxed from the rest of your system.
  • Fine grained permission control, down to what folders, devices and other resources the Steam access.
  • Steam and games are in their own folder and won't clutter your home directory with their own files.
  • Steam runs in a common environment shared by other users, creating less of a moving target for developers.
  • You can run multiple Steam clients at the same time.

There's also a few downsides to using Flatpak, let's talk about that:
  • If you use an Nvidia graphics card, you must update Flatpak after rebooting.
  • You may end up using more disk space overall, as the Flatpak may have duplicate libraries that are already locally on your system. In my experience I haven't really noticed the change.
  • Rarely, Linux native software distributed through Steam as AppImages don't work, you can't use an AppImage, or sandboxes in general, within a Flatpak.
  • There's learning to be done, that's what this guide is here for.
Getting Started
Install Flatpak and the Flathub repo. You can find a guide for your distro of choice here: https://flatpak.org/setup/

Your next step is to install Steam and a few optional addons, you can do this through your software center or via command line with:
$ flatpak install flathub com.valvesoftware.Steam com.valvesoftware.Steam.CompatibilityTool.Boxtron com.valvesoftware.Steam.Utility.protontricks com.valvesoftware.SteamLink org.freedesktop.Platform.VulkanLayer.MangoHud org.freedesktop.Platform.VulkanLayer.vkBasalt com.valvesoftware.Steam.Utility.gamescope

This will install Steam and the standalone Steamlink application.
It will also install several nice extras like Protontricks, MangoHud, vkBasalt, Boxtron, and Gamescope.

Then you can launch Steam with the icon, or via the command line with the command `flatpak run com.valvesoftware.Steam` or just shortened to `com.valvesoftware.Steam`.
Nvidia Users
Every time you upgrade your system remember to update Flatpak with `flatpak update`, this is because Flatpak distributes an Nvidia package which corrosponds to your Nvidia driver version.

Sometimes if your distribution updates the Nvidia package faster than the Flathub folks can roll out an update you could end up in a situation where you're unable to play games, but I haven't ran into this issue for a long time.
Where are my files?
You might noticed that Steam files are not located in the usual places in your home directory. Instead you'll find Flatpak apps have their own isolated folders like:
~/.var/app/com.valvesoftware.Steam
You can think of this folder as being the root of the home directory as Steam sees it.
Managing Permissions
You can customize your permissions via the command line, but we'll be taking the easier route and using the GUI application called Flatseal. You can install with the command:
flatpak install flathub com.github.tchx84.Flatseal

By default the permissions are pretty good, if you ever make a mistake you can click the reset button at the top to undo all your changes.

You may want to adjust filesystem permissions, by default Steam does not have access to all of your filesystem. You can change this by toggling "All user files" to provide your home, or manually specify folders with the "Other files" section.
Entering the Environment
If you wish to enter the Steam Flatpak environment for any reason you can run the command:
flatpak run --command="/bin/bash" com.valvesoftware.Steam
Then you can run applications and manage things. Keep in mind that this shell is a new isolated environment and can't see Flatpak Steam processes you might have started elsewhere.
How To: Install Proton-GE
Go to https://github.com/GloriousEggroll/proton-ge-custom/releases, download your preferred release, and install using the official instructions to:
~/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d

Note: The Flatpak community version of Proton-GE does not use the "Pressure Vessel" sandbox technology that the official Proton-GE does. This is because in the past Flatpak could not run the official versions of Proton. Do not ask the developer of Proton-GE for support with the Flatpak version.
How To: Manage Protontricks
Sometimes games need a little help to run. You can use Protontricks, which we installed earlier, in our Flatpak.

To enter the environment and start the graphical user interface:
$ flatpak run --command="/bin/bash" com.valvesoftware.Steam $ protontricks --gui
Select your game, select the default wine prefix, and make any changes you need.

Search ProtonDB.com for tips on getting your games working.
How To: Use vkBasalt
vkBasalt is a way to add post processing enhancements to your games, similar to Reshade and SweetFX on Windows. It only works on games running under Vulkan, which could be a native Linux game or a Windows game running DirectX with DXVK under Proton.

Per-Game
Right click your game and go to properties, set the launch options to
ENABLE_VKBASALT=1 %command%

All-Games
Run the command:
flatpak override --user --env=ENABLE_VKBASALT=1 com.valvesoftware.Steam
In Flatseal you can add `ENABLE_VKBASALT=1` to the environment variables, see the Managing Permissions section for more details.

Configuration
To manage your vkBasalt configuration visit
~/.var/app/com.valvesoftware.Steam/.config/vkBasalt/vkBasalt.conf
How To: Enable MangoHUD
MangoHUD is an overlay for stats like FPS and hardware utilization.

Per-Game
Right click your game and go to properties, set the launch options to
MANGOHUD=1 %command%

All-Games
Command:
flatpak override --user --env=MANGOHUD=1 com.valvesoftware.Steam
In Flatseal you can add `MANGOHUD=1` to the environment variables, see the Managing Permissions section for more details.

Configuration
To manage your MangoHUD configuration visit
~/.var/app/com.valvesoftware.Steam/.config/MangoHud/MangoHud.conf
19 Comments
shishimaru1000 19 Dec, 2024 @ 1:07am 
It would be honestly awesome if Flatpaks or something like this would, one day, add what it's needed to play games with Nvidia cards without actually using the video driver in the whole system, especially for hybrid hardware users like me for my laptop. Nouveau works just better, but hasn't the performance. If someone will be able to "containerize"(???) the Nvidia proprietary drivers under one app specifically, it'd be great. Years later, Nvidia still struggles to provide with the perfect driver.
Feng Lengshun 31 Jul, 2024 @ 9:38pm 
@BlackPraedicator assuming the trainer *does* work on Linux, then what you want is to run it with Protonfix > choose the Proton Prefix for your game > "Use default Wine Prefix" > Install/Uninstall Game > use the Install button there.

Why so complicated? Because trainers need access to the game process, and the game process is isolated per Proton prefix. This is the way that I know in order to run processes in the same Proton prefix. Otherwise? You're better off using Game Conqueror.
BlackPraedicator 7 Jul, 2024 @ 5:47am 
Can you add how to use trainer on flatpak?
Rage Soleil 18 Apr, 2024 @ 6:34pm 
Great guide.
Feng Lengshun 3 Dec, 2023 @ 12:25am 
Adding another comment: if you're using Flatpak Lutris, you'll need to do `ln -s ~/.var/app/com.valvesoftware.Steam/.steam ~/.steam` so that it can detect installed games on Steam Flatpak.

This should be the only thing you need to do, however, as Lutris now uses xdg-open to run Steam (tho that can be a hassle if you've changed Steam's .desktop app name or have multiple Steam installed - as it detects by name).
Feng Lengshun 27 Nov, 2023 @ 8:54pm 
Btw, for generating a mangohud conf quickly, I'd recommend something like this: `mkdir -p ~/.var/app/com.valvesoftware.Steam/.config/MangoHud/ && echo -e "horizontal\nlegacy_layout=0\nhud_no_margin\nfont_size=25\ntable_columns=28\nbackground_alpha=0.5\ntime=1\ntime_format=%I:%M %p\ngpu_stats\ngpu_temp\ncpu_stats\ncpu_temp\nram\nvram\nfps\nframe_timing\nframetime\ntoggle_hud=F8\nresolution\nwine\nvulkan_driver\n" | tee ~/.var/app/com.valvesoftware.Steam/.config/MangoHud/MangoHud.conf`

Config I base on Gaming-On-Linux [www.gamingonlinux.com] preset which is based on Steam Deck's Horizontal preset (which is incorporated as an official preset on MangoHud upstream now but I don't think they show the Wine version in that preset).
Feng Lengshun 27 Nov, 2023 @ 8:50pm 
As a note, I think for gamescope it'll eventually move to `org.freedesktop.platform.vulkanlayer.gamescope`, though looking at my flatpak warnings, Steam, Heroic, and Bottles still use `com.valvesoftware.Steam.Utility.gamescope`. I personally just install both, not gonna lie.

Also, would recommend adding a section on non-Steam games as well. People can now just Lutris, Heroic, and Bottles on Flatpak and have it add the library there to Steam as well (though they may need permission to flatpak Steam's `~/.var/app` directory. Especially useful since Lutris can now interface with Flatpak emulators as well. Also, would recommend using SGDBoop (it's on flathub, AUR, Nix, and otherwise easy to install) after that to edit the added games' arts on Steam.

For Proton-GE, I'd recommend most people to just use ProtonUp-Qt (or protonup-ng if they prefer CLI). Speaking of, AdwSteamGtk is really nice for getting Steam to look nicer on Linux, and it's on Flathub as well.
Dalaeance 8 Nov, 2023 @ 10:35am 
Agreed. It should be standard across the board, with the user having the ability to override it.
>noderunner_  [author] 7 Nov, 2023 @ 10:07pm 
To elaborate further, there's a standard called the XDG Base Directory specification and by default flatpak's environment sets XDG_DATA_HOME=~/.var/app/com.valvesoftware.Steam/data instead of ~/.var/app/com.valvesoftware.Steam/.local/share but not all applications respect XDG and can just place their files wherever they like.

I don't know the reasoning behind why Flatpak does this, in my opinion it just causes confusion.
Dalaeance 7 Nov, 2023 @ 10:01pm 
Awesome! Thanks for your quick response. ^_^