Steam

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources

Steam is a video game digital distribution service by Valve. Steam offers digital rights management (DRM), matchmaking servers, video streaming, and social networking services. It also provides the user with installation and automatic updating of games, and community features such as friends lists and groups, cloud saving, and in-game voice and chat functionality.

The Steam client is not open source software, therefore each user must accept the Steam Subscriber Agreement before using the software, then typically accept EULAs or Terms of Use agreements for each particular title accessed through the Steam client.

Valve Corporation has collaborated with open source software organizations such as CodeWeavers (Wine)[1] in order to make closed source games possible to run on open source operating systems.

Game Compatibility

With the popularization of the Steam Deck, playing Steam games on Linux has grown considerably in recent years[2]. Game developers are increasingly incentivized to support Linux. Native Linux games can be identified with the SteamOS icon in the Store. For games without native support, Valve maintains Proton, built on Wine, which integrates with the client and provides an easy-to-use compatibility layer for Windows-only games on a recent Linux OS. Users who prefer bleeding-edge versions over stability may consider an actively community-maintained fork of Proton called GE-Proton.

Important
Proton is open source and thus can be built from source, but it is highly recommended to use versions of Proton provided by the Steam client[3]. Proton can be enabled for each game through its properties under the Compatibility tab.
Tip
Community-maintained ProtonDB (similar to Wine AppDB) monitors game compatibility with Steam Deck / Proton and similar emulation tools based on feedback from its users.

Prerequisites

Steam provides 32-bit environment for most of supported games, so client itself requires a multilib profile on amd64. That is, during Gentoo installation, when choosing profiles the no-multilib option was not selected. This prerequisite can be ignored if installing Steam in a chroot.

The Steam browser is no longer supported on 32-bit Linux distributions, and is disabled when viewing the Store, Community, or User Profile tabs in the Steam client[4], so only available architecture is amd64.

Kernel

Steam expects that /dev/shm, which requires kernel tmpfs support, is mounted prior to being started. /dev/shm should be mounted automatically by OpenRC and systemd during boot, but can also be mounted explicitly via /etc/fstab.

FILE /etc/fstab
# To limit the size add e.g. size=1G to opts (recommended at least 2G, default is 50%)
# Please note that lower setting may randomly crash Steam and/or games.
 
#<fs>      <mountpoint>    <type>	<opts>		     <dump/pass>
shm        /dev/shm        tmpfs        nodev,nosuid,noexec  0 0

The following kernel option has to be set, otherwise Steam may fail to start with the error message: "The futex facility returned an unexpected error code."

KERNEL Allow 32-bit time_t for Steam's 32-bit compatibility
General architecture-dependent options  --->
  [*] Provide system calls for 32-bit time_t Search for <code>CONFIG_COMPAT_32BIT_TIME</code> to find this item.

Enable user level driver support if controller support is desired.

KERNEL Enable user level drivers for input
Device Drivers  --->
  Input device support  --->
    -*- Generic input layer (needed for keyboard, mouse, ...) Search for <code>CONFIG_INPUT</code> to find this item.
      [*] Miscellaneous devices Search for <code>CONFIG_INPUT_MISC</code> to find this item.  --->
        <*> User level driver support Search for <code>CONFIG_INPUT_UINPUT</code> to find this item.

Enable user namespace support in order to support launching games in Compatibility mode (i.e. with Proton):

KERNEL Enable User namespace
General setup --->
    [*] Namespaces support Search for <code>CONFIG_NAMESPACES</code> to find this item. --->
        [*] User namespace Search for <code>CONFIG_USER_NS</code> to find this item.

Enable NTSYNC when using GE-Proton or Proton 11 or newer:

KERNEL Enable NTSYNC
Device Drivers --->
    Misc devices --->
        [*] NT synchronization primitive emulation Search for <code>CONFIG_NTSYNC</code> to find this item.

File Descriptors Limit

On non-systemd configurations the default PAM hard file descriptors limit of 4096 generates the following warning in the Proton debug log:

WARNING: Low file descriptor limit: 4096 (see https://github.com/ValveSoftware/Proton/wiki/File-Descriptors)

The limit on the number of file descriptors that can be opened by a user logged on via PAM is controlled by the pam_limits.so module and the hard limit can be checked by a user at runtime with the ulimit -Hn command.

Proton will not produce the warning if the hard limit is increased to 524288 or higher.

Higher limit can be specified in the /etc/security/limits.conf file or in a configuration file in the /etc/security/limits.d/ directory, for example:

FILE /etc/security/limits.d/26-steam-nofile.conf
*               hard    nofile             524288

This config will allow all users and groups to use the new limit. To set the new limit to a particular user only, the * in the beginning can be replaced with a specific username.

max_map_count

In Linux kernel the default max_map_count limit of 65530 on the maximum number of memory map areas a process may have, generates the following warning in the Proton debug log:

WARNING: Low /proc/sys/vm/max_map_count: 65530 will prevent some games from working

Proton will not produce the warning if the limit is increased to 1048576 or higher.

At runtime the limit can be changed with the following command:

root #sysctl --write vm.max_map_count=1048576

A configuration file in the /etc/sysctl.d/ directory can be used to set the limit during boot time, for example:

FILE /etc/sysctl.d/steam.conf
vm.max_map_count = 1048576

Installation

The Steam installer downloads and installs the Steam client to the user's home directory. This prevents Portage from managing the Steam client updates or the software installed by it. The Steam client is solely responsible for managing software installation and updates.

Important
The instructions throughout this page use the typical Steam installation directory ~/.local/share/Steam.

Emerge (recommended)

The steam-launcher ebuild is available from the steam-overlay repository, which is Gentoo's primary repository for the Steam client and Steam-based games. The steam-overlay repository can be added manually or with repository management tools like eselect-repository.

Install app-eselect/eselect-repository and dev-vcs/git:

root #emerge --ask --noreplace app-eselect/eselect-repository dev-vcs/git

Add the Steam repository:

root #eselect repository enable steam-overlay

Then sync with emaint:

root #emaint sync -r steam-overlay

Due to the Proton runtime built into Steam, 32-bit binaries of most dependencies are included within the Steam installation. Some system dependencies remain however, but Portage should prompt for them. These packages should be added to /etc/portage/package.use/steam with their abi_x86_32 USE flag enabled. Some required changes include:

FILE /etc/portage/package.use/steam
app-accessibility/at-spi2-core    abi_x86_32
app-arch/bzip2                    abi_x86_32
app-arch/lz4                      abi_x86_32
app-arch/xz-utils                 abi_x86_32
app-arch/zstd                     abi_x86_32
app-crypt/p11-kit                 abi_x86_32
dev-db/sqlite                     abi_x86_32
dev-lang/rust                     abi_x86_32
dev-lang/rust-bin                 abi_x86_32
dev-libs/dbus-glib                abi_x86_32
dev-libs/elfutils                 abi_x86_32
dev-libs/expat                    abi_x86_32
dev-libs/fribidi                  abi_x86_32
dev-libs/glib                     abi_x86_32
dev-libs/gmp                      abi_x86_32
dev-libs/icu                      abi_x86_32
dev-libs/json-glib                abi_x86_32
dev-libs/leancrypto               abi_x86_32
dev-libs/libevdev                 abi_x86_32
dev-libs/libffi                   abi_x86_32
dev-libs/libgcrypt                abi_x86_32
dev-libs/libgpg-error             abi_x86_32
dev-libs/libgudev                 abi_x86_32
dev-libs/libgusb                  abi_x86_32
dev-libs/libpcre2                 abi_x86_32
dev-libs/libtasn1                 abi_x86_32
dev-libs/libunistring             abi_x86_32
dev-libs/libusb                   abi_x86_32
dev-libs/libxml2                  abi_x86_32
dev-libs/lzo                      abi_x86_32
dev-libs/nettle                   abi_x86_32
dev-libs/nspr                     abi_x86_32
dev-libs/nss                      abi_x86_32
dev-libs/openssl                  abi_x86_32
dev-libs/wayland                  abi_x86_32
dev-util/glslang                  abi_x86_32
dev-util/spirv-tools              abi_x86_32
dev-util/sysprof-capture          abi_x86_32
dev-util/vulkan-utility-libraries abi_x86_32
gnome-base/librsvg                abi_x86_32
gui-libs/libdecor                 abi_x86_32
llvm-core/clang                   abi_x86_32
llvm-core/llvm                    abi_x86_32
media-gfx/graphite2               abi_x86_32
media-libs/alsa-lib               abi_x86_32
media-libs/flac                   abi_x86_32
media-libs/fontconfig             abi_x86_32
media-libs/freetype               abi_x86_32
media-libs/glu                    abi_x86_32
media-libs/harfbuzz               abi_x86_32
media-libs/lcms                   abi_x86_32
media-libs/libdisplay-info        abi_x86_32
media-libs/libepoxy               abi_x86_32
media-libs/libglvnd               abi_x86_32
media-libs/libjpeg-turbo          abi_x86_32
media-libs/libogg                 abi_x86_32
media-libs/libpng                 abi_x86_32
media-libs/libpulse               abi_x86_32
media-libs/libsdl2                abi_x86_32
media-libs/libsdl3                abi_x86_32
media-libs/libsndfile             abi_x86_32
media-libs/libva                  abi_x86_32
media-libs/libvorbis              abi_x86_32
media-libs/libwebp                abi_x86_32
media-libs/mesa                   abi_x86_32
media-libs/openal                 abi_x86_32
media-libs/opus                   abi_x86_32
media-libs/tiff                   abi_x86_32
media-libs/vulkan-layers          abi_x86_32
media-libs/vulkan-loader          abi_x86_32 layers
media-sound/lame                  abi_x86_32
media-sound/mpg123-base           abi_x86_32
media-video/pipewire              abi_x86_32
net-dns/c-ares                    abi_x86_32
net-dns/libidn2                   abi_x86_32
net-libs/gnutls                   abi_x86_32
net-libs/libasyncns               abi_x86_32
net-libs/libndp                   abi_x86_32
net-libs/libpsl                   abi_x86_32
net-libs/nghttp2                  abi_x86_32
net-libs/nghttp3                  abi_x86_32
net-libs/ngtcp2                   abi_x86_32
net-misc/curl                     abi_x86_32
net-misc/networkmanager           abi_x86_32
net-print/cups                    abi_x86_32
sys-apps/dbus                     abi_x86_32
sys-apps/lm-sensors               abi_x86_32
sys-apps/systemd                  abi_x86_32
sys-apps/systemd-utils            abi_x86_32
sys-apps/util-linux               abi_x86_32
sys-libs/gdbm                     abi_x86_32
sys-libs/gpm                      abi_x86_32
sys-libs/libcap                   abi_x86_32
sys-libs/libudev-compat           abi_x86_32
sys-libs/ncurses                  abi_x86_32
sys-libs/pam                      abi_x86_32
sys-libs/readline                 abi_x86_32
sys-libs/zlib                     abi_x86_32
virtual/glu                       abi_x86_32
virtual/libelf                    abi_x86_32
virtual/libiconv                  abi_x86_32
virtual/libintl                   abi_x86_32
virtual/libudev                   abi_x86_32
virtual/libusb                    abi_x86_32
virtual/opengl                    abi_x86_32
virtual/zlib                      abi_x86_32
x11-libs/cairo                    abi_x86_32
x11-libs/extest                   abi_x86_32
x11-libs/gdk-pixbuf               abi_x86_32
x11-libs/gtk+                     abi_x86_32
x11-libs/libdrm                   abi_x86_32
x11-libs/libICE                   abi_x86_32
x11-libs/libpciaccess             abi_x86_32
x11-libs/libSM                    abi_x86_32
x11-libs/libvdpau                 abi_x86_32
x11-libs/libX11                   abi_x86_32
x11-libs/libXau                   abi_x86_32
x11-libs/libxcb                   abi_x86_32
x11-libs/libXcomposite            abi_x86_32
x11-libs/libXcursor               abi_x86_32
x11-libs/libXdamage               abi_x86_32
x11-libs/libXdmcp                 abi_x86_32
x11-libs/libXext                  abi_x86_32
x11-libs/libXfixes                abi_x86_32
x11-libs/libXft                   abi_x86_32
x11-libs/libXi                    abi_x86_32
x11-libs/libXinerama              abi_x86_32
x11-libs/libxkbcommon             abi_x86_32
x11-libs/libXrandr                abi_x86_32
x11-libs/libXrender               abi_x86_32
x11-libs/libXScrnSaver            abi_x86_32
x11-libs/libxshmfence             abi_x86_32
x11-libs/libXtst                  abi_x86_32
x11-libs/libXxf86vm               abi_x86_32
x11-libs/pango                    abi_x86_32
x11-libs/pixman                   abi_x86_32
x11-libs/xcb-util-keysyms         abi_x86_32
x11-misc/colord                   abi_x86_32

For users with an Nvidia card using the proprietary drivers, these packages should be added to /etc/portage/package.use/steam with their abi_x86_32 USE flag enabled as well:

FILE /etc/portage/package.use/steam
gui-libs/egl-gbm            abi_x86_32
gui-libs/egl-wayland        abi_x86_32
gui-libs/egl-wayland2       abi_x86_32
gui-libs/egl-x11            abi_x86_32
x11-drivers/nvidia-drivers  abi_x86_32

Add the steam overlay to package.accept_keywords:

FILE /etc/portage/package.accept_keywords/steam
*/*::steam-overlay
games-util/game-device-udev-rules
sys-libs/libudev-compat

Now read Steam's license terms located on /var/db/repos/steam-overlay/licenses/ValveSteamLicense and if you agree with them, then add it to portage:

FILE /etc/portage/package.license/steam
games-util/steam-launcher ValveSteamLicense

The overlay enables the Steam runtime by default. If you'd like to rely solely on Gentoo packages, then disable the steamruntime USE flag. Use the esteam utility later to scan your installed native Linux games for additional Gentoo packages required by them. Note that Gentoo packages do not cover the entirety of the runtime, so a small number of games may not work.

Once the repository has been added, install the steam-launcher ebuild:

Important
Newer installed systems are likely to run into a circular dependencies due to Steam needing ABI_X86_32 being set. This is easily resolved by following the first item in the Steam troubleshooting section below.
root #emerge --ask games-util/steam-launcher

Troubleshooting

If Steam is failing to emerge due to circular dependencies with ncurses and gpm, try:

root #USE="-gpm" emerge --ask --oneshot sys-libs/ncurses
root #emerge --ask games-util/steam-launcher
root #emerge --ask --oneshot sys-libs/ncurses gpm

If Steam is failing to emerge due to circular dependencies with harfbuzz and freetype, try:

root #USE="-harfbuzz" emerge --ask --oneshot media-libs/freetype media-libs/sdl2-ttf
root #emerge --ask games-util/steam-launcher
root #emerge --ask --oneshot media-libs/freetype media-libs/sdl2-ttf media-libs/harfbuzz
Tip
More information on circular dependencies and the reason they can occur can be found at Portage/Help

On pure Wayland systems with a global -X use flag, installing steam-launcher may get blocked by x11-libs/cairo. In such a case, dev-cpp/cairomm will likely be installed without support for X as well, and an X use flag will need to be added to both.
Furthermore, if your Wayland compositor does not support XWayland natively, gui-apps/xwayland-satellite is needed to run Steam.

If SteamUpdateUI fails to launch with "An X error has occured" it may indicate the user is not in the video group.

root #gpasswd -a larry video
Migrate from flatpak to the emerge recommended install

In order to migrate from flatpak to the recommended emerge method. The instructions for the emerge install must be followed, then the flatpak-packaged steam files must be moved to the default Gentoo filesystem location:

user $mv ~/.var/app/com.valvesoftware.Steam/.local/share/Steam ~/.local/share/

Some games store user data in ~/.var/app/com.valvesoftware.Steam/.local/share/ for examples mods or screenshots. These directories also need to be moved for a complete migration. For example to move Euro Truck Simulator 2 user data :

user $mv ~/.var/app/com.valvesoftware.Steam/.local/share/Euro\ Truck\ Simulator\ 2 ~/.local/share/

Finally the flatpak can be uninstalled

user $flatpak uninstall com.valvesoftware.Steam

Flatpak

A quite simple, fast, and clean method (e.g. 32-bit dependencies do not need to be compiled) of installing Steam is to use the Flatpak package com.valvesoftware.Steam from Flathub (also installing necessary udev rules for game controllers):

root #USE="X" emerge --ask sys-apps/flatpak
root #emerge --ask games-util/game-device-udev-rules
Note
As explained at Flatpak, rebooting the system is required for application icons to show up in the GUI menu.

Beside, Flatpak's first command below can also return an error about these directories:

/var/lib/flatpak/exports/share

/home/user/.local/share/flatpak/exports/share

They are "not in the search path set by the XDG_DATA_DIRS environment variable, so applications installed by Flatpak may not appear on the desktop until the session is restarted".

Creating them and adding them to XDG_DATA_DIRS doesn't works either.
user $flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
user $flatpak install flathub com.valvesoftware.Steam
user $flatpak run com.valvesoftware.Steam

Steam will update itself and install its files in the ~/.var/app/com.valvesoftware.Steam directory.

Chroot

Steam can be run in a 64-bit multilib chroot on amd64. The major advantage of a chroot is that Steam and its dependencies will be isolated from the root filesystem. The Steam browser is no longer supported on 32-bit Linux distributions, so only 64-bit chroot environment is available.[4]

Create the chroot directory:

root #mkdir /usr/local/steam64
root #cd /usr/local/steam64

Fetch and extract the stage3 tarball.

root #wget https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/stage3-amd64-openrc-20250907T165007Z.tar.xz
root #tar xpvf stage3*.tar.xz --xattrs-include='*.*' --numeric-owner

Copy DNS information and ensure it's world-readable:

root #cp -L /etc/resolv.conf etc
root #chmod a+r etc/resolv.conf

Create the ebuild repository directory:

root #mkdir var/db/repos/gentoo

Mount the necessary filesystems:

root #mount -t proc /proc proc
root #mount -R /sys sys
root #mount -R /dev dev
root #mount -R /run run
root #mount -R /var/db/repos/gentoo var/db/repos/gentoo

Chroot with linux64 and update the environment. The use of linux64 is not required on amd64, and it is only used here for consistency.

root #linux64 chroot .
root #env-update && source /etc/profile
root #export PS1="(chroot) $PS1"

The chroot should now be updated and configured accordingly. It is recommended to at least configure the timezone and enable sound support by installing media-libs/alsa-lib.

Now create the Steam user with the same UID (usually 1000) as the local user. The local UID can be determined by running id -u as the local user, outside of the chroot. Using the same UID will simplify the process of granting access to the X server from inside the chroot.

(chroot) root #useradd -u <UID> -m -G audio,video steam

Install Steam from one of the above installation methods. When complete, exit the chroot:

(chroot) root #exit

Unmount the chroot directories:

root #umount -l proc
root #umount -l sys
root #umount -l dev
root #umount -l run
root #umount -l var/db/repos/gentoo

Install xhost to allow access to the X server from inside the chroot:

root #emerge --ask --noreplace x11-apps/xhost

Logout, and then login. This allows the display manager or xinit to process /etc/X11/xinit/xinitrc.d/00-xhost and automatically grant all local connections to the X server from the local UID. This will not work if the Steam UID is different to that of the local UID. Either set the same UID when creating the Steam user, as was mentioned earlier, or if the Steam user already exists change the Steam UID with usermod -u <UID> steam to match the local UID.

Alternatively, run xhost +local: to allow all local connections to the X server from any local UID. This is a potential security risk as any user could access the X server without authentication. To revoke access run xhost -local:

Next, create the following wrapper script to setup the chroot, substitute to the Steam user, and start Steam. The wrapper script has two user defined variables: chroot_bits and chroot_dir. The chroot_bits variable must be set to 64 for a 64-bit chroot. The chroot_dir variable should be set to the location of the chroot directory.

FILE /usr/local/bin/steam-chroot
#!/bin/sh
 
# steam chroot bits
chroot_bits="64"
 
# steam chroot directory
chroot_dir="/usr/local/steam64/"
 
# check if chroot bits is valid
if [ "${chroot_bits}" = "32" ] ; then
  chroot_arch="linux32"
elif [ "${chroot_bits}" = "64" ] ; then
  chroot_arch="linux64"
else
  printf "Invalid chroot bits value '%s'. Permitted values are '32' and '64'.\n" "${chroot_bits}"
  exit 1
fi
 
# check if the chroot directory exists
if [ ! -d "${chroot_dir}" ] ; then
  printf "The chroot directory '%s' does not exist!\n" "${chroot_dir}"
  exit 1
fi
 
# mount the chroot directories
mount -v -t proc /proc "${chroot_dir}proc"
mount -vR /sys "${chroot_dir}sys"
mount --make-rslave "${chroot_dir}sys"
mount -vR /dev "${chroot_dir}dev"
mount --make-rslave "${chroot_dir}dev"
mount -vR /run "${chroot_dir}run"
mount --make-rslave "${chroot_dir}run"
mount -vR /var/db/repos/gentoo "${chroot_dir}var/db/repos/gentoo"
# the --make-rslave flags are needed for systemd support
 
# chroot, substitute user, and start steam
if [[ -n $( grep systemd /proc/1/comm ) ]]; then
  "${chroot_arch}" unshare -m chroot "${chroot_dir}" su -c 'steam' steam
else
  "${chroot_arch}" chroot "${chroot_dir}" su -c 'steam' steam
fi
# unmount the chroot directories when steam exits
umount -vl "${chroot_dir}proc"
umount -vl "${chroot_dir}sys"
umount -vl "${chroot_dir}dev"
umount -vl "${chroot_dir}run"
umount -vl "${chroot_dir}var/db/repos/gentoo"
Note
The wrapper script bind mounts /run so Steam can connect to D-Bus if it is running on the host. Steam will work even if D-Bus is not installed, but there will be non-fatal errors relating to Steam's bundled dev-libs/libappindicator. Steam also needs D-Bus if the Remember my password option is selected at the Steam login dialog. Refer to client troubleshooting for further details.

Make the wrapper script executable:

root #chmod +x /usr/local/bin/steam-chroot

Run the wrapper script as root to start Steam:

root #steam-chroot

Systemd and chroot

When the host system is in systemd, raw chroot is not sufficient. Instead, unshare -m chroot has to be used. In fact the above wrapper script supports this case.

Explanation: With bare chroot, the Steam client does not run, complaining "Steam now requires user namespaces to be enabled." For this Steam tests if bwrap --bind / / true succeeds. (This requires bwrap is set setuid.) Internally bwrap calls pivot_root (2), of which conditions with "/" are not met under systemd. With unshare the namespace gets separated, and things work.

Easy Anti Cheat Support

Due to DT_HASH not being enabled by default since glibc 2.36 then the follow needs to be applied to allow EAC games to work

FILE /etc/portage/package.use/glibc
sys-libs/glibc hash-sysv-compat
root #emerge -1 sys-libs/glibc

Removal

Remove the steam-launcher package and depclean all dependencies:

root #emerge --ask --depclean --verbose games-util/steam-launcher
root #emerge --depclean

Remove the Steam directory from the user account (this will delete downloaded games files, user's settings and saves):

user $rm -rf ~/.local/share/Steam

Troubleshooting

The most common game related issues are solved by enabling the stack-realign USE flag on the sys-libs/glibc package and re-emerge the @world set. It is a good idea to perform this change as the first troubleshooting action item.

Some Steam and games specific troubleshooting available on Steam/Client troubleshooting and Steam/Games troubleshooting subpages.

If you want to play games through proton, don't forget to add the vulkan USE flag on the media-libs/mesa package.

The best place to ask for help is the Steam thread on the Gentoo Forums. If a solution to an issue is confirmed by others, add it to this page or the relevant troubleshooting subpage. Please do not remove content without discussion, unless it is obviously wrong.

See also

External resources

References