Difference between revisions of "Steam"

From Funtoo
Jump to navigation Jump to search
(48 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{PageNeedsUpdates}}
Steam is a content delivery system and ecosystem for gaming, developed by Valve Software. It offers hundreds of games, from popular ones such as DOTA 2 to many other less popular and even obscure community games. Steam runs on Microsoft Windows, MacOS, and also Linux.


Steam is a content delivery system available for GNU/Linux gaming.
=== History on Funtoo ===


=== Install ===
Through Funtoo Linux 1.2, it was possible to play Steam directly under Funtoo. However, with the move to Funtoo Linux 1.3, 32-bit support was dropped from Funtoo, and Steam is currently dependent on a host of 32-bit libraries. Thus, Steam no longer worked under Funtoo directly. Howevever, it is still possible to run Steam under Funtoo via use of containerization technology, but much of the setup was left to users to figure out.  
In order to install Steam, we must first install {{package|app-portage/layman}}.


Once layman is installed and synced, we must add the {{c|gamerlay}} repository:
Now, not only is Steam supported, but we now have officially-tested Docker images to allow you to do this easily. Currently we have just an NVIDIA docker image, but this is actually the more challenging one to build and one for Open Source graphics will be appearing shortly.
 
Funtoo's official Steam container for use with NVIDIA graphics is based on Ubuntu 18, since Steam and Ubuntu have an unholy alliance and this is the officially-supported platform for Steam. That's fine -- we can still run Steam on Ubuntu -- on Funtoo!
 
The base Ubuntu container image upon which our container is an official Ubuntu container from NVIDIA Corporation and has been configured to work perfectly with container GPU acceleration and libglvnd.
 
=== Steam in Docker: Requirements ===
 
{{Note|This page will currently document the setup of Steam running on NVIDIA hardware, with documentation for non-NVIDIA hardware to follow shortly.}}
 
To run Steam on NVIDIA GPUs, you must meet the following prerequisites:
 
* You must be using Funtoo Linux 1.4 or later, x86-64bit.
* You must have an NVIDIA graphics card.
* Already have NVIDIA drivers ({{c|x11-drivers/nvidia-drivers}}) installed and a desktop environment running that uses them.
* A regular, non-root user created from which you will be launching Steam.
* PulseAudio working.
 
If you are using the [https://forums.funtoo.org/topic/3125-gnome-stages-and-lxd-images-now-available/ Funtoo Linux GNOME stage3] as a starting point, you should be in good shape regarding all these requirements.
 
=== Host Setup ===
 
To get your host ready to run Steam, emerge the following package:
 
{{console|body=
# ##i##emerge -av --jobs=3 steam-nvidia-launcher
}}
 
You will also want to ensure that you have NVIDIA proprietary graphics running in a graphical environment on your host. Please ensure that you have {{c|x11-drivers/nvidia-kernel-modules-435.21-r1}} or later installed on your host, and that you don't have any special permissions settings in {{f|/etc/modprobe.d}} (See the [[#Device Node Permissions|Device Node Permissions]] section below for details.)
 
Next, you will want to add {{c|docker}} and {{c|nvidia-container}} to your default runlevel, and start them:
 
{{console|body=
# ##i##rc-update add docker default
##g##*##!g## service docker added to runlevel default
# ##i##rc-update add nvidia-container default
##g##*##!g## nvidia-container added to runlevel default.
# ##i##rc
}}
 
=== Check Device Node Permissions ===
 
If you are using {{c|x11-drivers/nvidia-kernel-modules-435.21-r1}} or later, and have run {{c|etc-update}}, then your device nodes should have correct permissions for GPU acceleration to work:
 
{{console|body=
$ ##i##ls /dev/nvidia* -l
crw-rw-rw- 1 root root 195, 254 Oct 23 10:09 ##y##/dev/nvidia-modeset
crw-rw-rw- 1 root root 239,  0 Oct 23 10:09 ##y##/dev/nvidia-uvm
crw-rw-rw- 1 root root 239,  1 Oct 23 10:09 ##y##/dev/nvidia-uvm-tools
crw-rw-rw- 1 root root 195,  0 Oct 23 10:08 ##y##/dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Oct 23 10:08 ##y##/dev/nvidiactl
}}
 
Otherwise, you will need to follow these steps. To allow all local users to access your GPU, not just the {{c|video}} user, by setting {{c|1=NVreg_DeviceFileMode=0666}} in {{f|/etc/modprobe.d/nvidia.conf}} and rebooting.
 
=== Host Validation ===
 
With the host and device node permissions set up properly, you should be able to run {{c|nvidia-container-cli info}} as your regular user and see details about your GPU and not receive any error messages:
 
{{console|body=
$ ##i##nvidia-container-cli info
NVRM version:  435.21
CUDA version:  10.1
 
Device Index:  0
Device Minor:  0
Model:          Quadro P400
Brand:          Quadro
GPU UUID:      GPU-9bb98f5f-7d9d-ee0a-64a1-154c46934f45
Bus Location:  00000000:01:00.0
Architecture:  6.1
}}
 
If you receive an error message, this indicates that your {{c|/dev/nvidia*}} device node permissions are too restrictive or that {{c|/etc/init.d/nvidia-container}} has not been started properly. Try rebooting or restarting Docker to resolve the issue.
 
=== User Setup ===
 
When using docker, you will be starting the Steam container as a regular user account so the container can inherit the connection to
your X server. You will want to make sure your user account is in the {{c|docker}} group:
 
{{console|body=
# ##i##gpasswd -a drobbins docker
Adding user drobbins to group docker
}}
 
You will need to log out and log back in for this group change to take effect.
 
=== PulseAudio Setup ===
 
In order to allow the container to connect to PulseAudio, you will of course need to be using PulseAudio, and then you will also need to enable support for UNIX socket connectivity in PulseAudio. This can be done by modifying the {{c|module-native-protocol-unix}} line in {{f|/etc/pulse/default.pa}} to have the {{c|1=auth-anonymous=1}} suffix:
 
{{file|name=/etc/pulse/default.pa|body=
load-module module-native-protocol-unix auth-anonymous=1
}}
 
You should restart your user's pulseaudio daemon for this to take immediate effect:


{{console|body=
{{console|body=
###i## layman -a gamerlay
$ ##i##killall pulseaudio
###i## layman -S
}}
}}


Ok, now we can install steam by running:
Once this has been done, you should be able to see a {{c|native}} UNIX socket in the PulseAudio run directory. This socket will get mapped into the container:


{{console|body=
{{console|body=
###i## emerge steam-launcher
$ ##i##ls $XDG_RUNTIME_DIR/pulse/
native  pid
}}
}}


== install part 2 ==
=== Docker Container Setup ===
Make sure your user is in the 'games' group by typing:
<console>###i## groups youruser</console>


If not add your user to the 'games' group by typing:
To start the Steam container, run {{c|steam-nvidia-launcher}} as a regular user:
<console>###i## usermod -a -G games youruser</console>


Your groups will not update until you log out and log back in again. You can check this by just entering in a terminal
{{console|body=
<console>###i## groups</console>
$ ##i##steam-nvidia-launcher
and if you just added yourself to the group games it will not appear there. However, if you would type "groups ouruser" like before, then you could see that you already added yourself to that group. Steam will not start properly until you have logged in as a member of the games group.
}}


Steam has its own internal package management system. Portage will not track its files, or games installed. the ebuild simply pulls in the steam installer, to run the steam installer:
The {{c|steam-nvidia-launcher}} takes care of the full Steam container lifecycle. You simply run it as your local user, and it will download the official Funtoo Steam docker image and launch it. The launcher will stay running until you hit Control-C, at which point it will stop Steam and also stop the container.


<console>$##i## /usr/games/bin/steam</console>
The next time you want to start Steam, you'll run the launcher, and it will find the existing container, start it, and start Steam. Just like before, when you want to stop Steam and the container, hit Control-C and Steam and the container will be stopped.


The installer will prompt you with several questions, once done running the installer command will load the latest version of steam.
Since it is the initial run of the launcher, it will download the Docker image first, which is about 1.5GB in size, and then it will launch a new container image. You should see Steam start to update itself, and then when this is done it will prompt you to log in to Steam. Congratulations! Steam is now running!


This will also create a desktop entry under ~/Desktop/steam.desktop
=== Container Validation ===


== Troubleshooting ==
It is possible to open a bash shell within an already launched container by running the following command in another X terminal:
=== Text is corrupt or missing ===
Steam makes heavy usage of the Arial font. A decent Arial font to use is ttf-liberation.
<console>
# ##i##emerge liberation-fonts
# ##i##eselect fontconfig enable 60-liberation.conf
</console>


=== Steam segfaults after 2nd start! ===
I do not know much about this behaviour, but I found a workaround.
If you saved your password, you need to backup all your games and reset Steam.
{{console|body=
{{console|body=
$ ##i##mkdir -p ~/backup
$ ##i##steam-nvidia-launcher attach
$ ##i##mv ~/.local/share/Steam/steamapps ~/backup
%steam-container%
$ ##i##steam --reset
$ ##i##mv ~/backup ~/.local/share/Steam/steamapps
}}
}}
Start Steam again, enter username and password, but do not check "Remember my password", it is the thing that causes all the troubles. You will need to enter password every time you start Steam.


===Missing textures (Screen in Dota 2 and other Source games is all red/black!) ===
From this point, you can inspect the state of the running container interactively and test out various parts of its operation.
Many steam games heavily rely on S3TC compressed textures, which require the libxtc_dxtn library
When you are done, you can exit the container by pressing Control-D or typing {{c|exit}}.
to be compiled with 32bit support:
 
==== Test PulseAudio ====
 
To ensure that PulseAudio is functioning properly from within the container, the following command can be run to play back white noise via PulseAudio:
 
{{console|body=
{{console|body=
# ##i##echo 'media-libs/libtxc_dxtn abi_x86_32' >> /etc/portage/package.use
%steam-container% ##i##pacat -vvvv /dev/urandom
# ##i##emerge media-libs/libtxc_dxtn
}}
}}


=== OpenGL GLX context is not using direct rendering ===
==== Test OpenGL ====
This can happen when the latest version of mesa drivers conflict with steam's bundled libstdc++ libraries[1], especially when open source video card drivers are installed.


So that steam does not use its bundled libstdc++ libraries, they may be removed[2]:
To ensure that OpenGL is working properly from within the container, and that the container is properly connecting to your X server, you can run {{c|glxgears}}:
<console>
# ##i##rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_amd64 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_amd64.md5 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_amd64 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_amd64.md5 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++_pic.a && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++_pic.map && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/share/doc/libstdc++6 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/share/doc/libstdc++6-4.6-pic && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_i386 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_i386.md5 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_i386 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_i386.md5 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/gcc/i686-linux-gnu/4.6/libstdc++_pic.a && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/gcc/i686-linux-gnu/4.6/libstdc++_pic.map && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6.0.18 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/share/doc/libstdc++6 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/share/doc/libstdc++6-4.6-pic && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/share/doc/libstdc++6
</console>
and
<console>
# ##i##rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libgcc_s.so.1 && rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu/libgcc_s.so.1
</console>


=== Removal ===
To remove steam, and content in case of corruption:
{{console|body=
{{console|body=
$##i## rm -rf .local/share/Steam
%steam-container% ##i##glxgears
$##i## rm -rf .Steam
}}
}}


== References ==
You should see glxgears running in a window on your desktop.
[1]: higuita, Ev1l0rd. [http://askubuntu.com/questions/614422/problem-with-installing-steam-on-ubuntu-15-04/614458#614458 Problem with installing Steam on Ubuntu 15.04 - Ask Ubuntu], [http://askubuntu.com/ Ask Ubuntu], April 26th, 2015. Retrieved December 29th, 2015.
 
=== Future Work ===
 
The work on Steam on Funtoo is ongoing with the following efforts planned:
 
* Support for Steam on Open Source drivers, not just NVIDIA.
* Storage of Steam Library and configuration outside of the container, so that wiping the container image will not wipe your downloaded games. (DONE: Supported in version 1.4)
* Support for integration of Desktop shortcuts with your native DE.


[2]: altiris. [https://bbs.archlinux.org/viewtopic.php?id=193802 [SOLVED<nowiki>]</nowiki> Steam won't open, libGL errors], [https://bbs.archlinux.org/ Arch Linux Forums], February 18, 2015. Retrieved July 14th, 2015.
[[Category:Official Documentation]]
[[Category:Containers]]
[[Category:Docker]]
[[Category:Games]]

Revision as of 04:58, December 11, 2019

Steam is a content delivery system and ecosystem for gaming, developed by Valve Software. It offers hundreds of games, from popular ones such as DOTA 2 to many other less popular and even obscure community games. Steam runs on Microsoft Windows, MacOS, and also Linux.

History on Funtoo

Through Funtoo Linux 1.2, it was possible to play Steam directly under Funtoo. However, with the move to Funtoo Linux 1.3, 32-bit support was dropped from Funtoo, and Steam is currently dependent on a host of 32-bit libraries. Thus, Steam no longer worked under Funtoo directly. Howevever, it is still possible to run Steam under Funtoo via use of containerization technology, but much of the setup was left to users to figure out.

Now, not only is Steam supported, but we now have officially-tested Docker images to allow you to do this easily. Currently we have just an NVIDIA docker image, but this is actually the more challenging one to build and one for Open Source graphics will be appearing shortly.

Funtoo's official Steam container for use with NVIDIA graphics is based on Ubuntu 18, since Steam and Ubuntu have an unholy alliance and this is the officially-supported platform for Steam. That's fine -- we can still run Steam on Ubuntu -- on Funtoo!

The base Ubuntu container image upon which our container is an official Ubuntu container from NVIDIA Corporation and has been configured to work perfectly with container GPU acceleration and libglvnd.

Steam in Docker: Requirements

   Note

This page will currently document the setup of Steam running on NVIDIA hardware, with documentation for non-NVIDIA hardware to follow shortly.

To run Steam on NVIDIA GPUs, you must meet the following prerequisites:

  • You must be using Funtoo Linux 1.4 or later, x86-64bit.
  • You must have an NVIDIA graphics card.
  • Already have NVIDIA drivers (x11-drivers/nvidia-drivers) installed and a desktop environment running that uses them.
  • A regular, non-root user created from which you will be launching Steam.
  • PulseAudio working.

If you are using the Funtoo Linux GNOME stage3 as a starting point, you should be in good shape regarding all these requirements.

Host Setup

To get your host ready to run Steam, emerge the following package:

root # emerge -av --jobs=3 steam-nvidia-launcher

You will also want to ensure that you have NVIDIA proprietary graphics running in a graphical environment on your host. Please ensure that you have x11-drivers/nvidia-kernel-modules-435.21-r1 or later installed on your host, and that you don't have any special permissions settings in /etc/modprobe.d (See the Device Node Permissions section below for details.)

Next, you will want to add docker and nvidia-container to your default runlevel, and start them:

root # rc-update add docker default
 * service docker added to runlevel default
root # rc-update add nvidia-container default
 * nvidia-container added to runlevel default.
root # rc

Check Device Node Permissions

If you are using x11-drivers/nvidia-kernel-modules-435.21-r1 or later, and have run etc-update, then your device nodes should have correct permissions for GPU acceleration to work:

user $ ls /dev/nvidia* -l
crw-rw-rw- 1 root root 195, 254 Oct 23 10:09 /dev/nvidia-modeset
crw-rw-rw- 1 root root 239,   0 Oct 23 10:09 /dev/nvidia-uvm
crw-rw-rw- 1 root root 239,   1 Oct 23 10:09 /dev/nvidia-uvm-tools
crw-rw-rw- 1 root root 195,   0 Oct 23 10:08 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Oct 23 10:08 /dev/nvidiactl

Otherwise, you will need to follow these steps. To allow all local users to access your GPU, not just the video user, by setting NVreg_DeviceFileMode=0666 in /etc/modprobe.d/nvidia.conf and rebooting.

Host Validation

With the host and device node permissions set up properly, you should be able to run nvidia-container-cli info as your regular user and see details about your GPU and not receive any error messages:

user $ nvidia-container-cli info
NVRM version:   435.21
CUDA version:   10.1

Device Index:   0
Device Minor:   0
Model:          Quadro P400
Brand:          Quadro
GPU UUID:       GPU-9bb98f5f-7d9d-ee0a-64a1-154c46934f45
Bus Location:   00000000:01:00.0
Architecture:   6.1

If you receive an error message, this indicates that your /dev/nvidia* device node permissions are too restrictive or that /etc/init.d/nvidia-container has not been started properly. Try rebooting or restarting Docker to resolve the issue.

User Setup

When using docker, you will be starting the Steam container as a regular user account so the container can inherit the connection to your X server. You will want to make sure your user account is in the docker group:

root # gpasswd -a drobbins docker
Adding user drobbins to group docker

You will need to log out and log back in for this group change to take effect.

PulseAudio Setup

In order to allow the container to connect to PulseAudio, you will of course need to be using PulseAudio, and then you will also need to enable support for UNIX socket connectivity in PulseAudio. This can be done by modifying the module-native-protocol-unix line in /etc/pulse/default.pa to have the auth-anonymous=1 suffix:

   /etc/pulse/default.pa
load-module module-native-protocol-unix auth-anonymous=1

You should restart your user's pulseaudio daemon for this to take immediate effect:

user $ killall pulseaudio

Once this has been done, you should be able to see a native UNIX socket in the PulseAudio run directory. This socket will get mapped into the container:

user $ ls $XDG_RUNTIME_DIR/pulse/
native  pid

Docker Container Setup

To start the Steam container, run steam-nvidia-launcher as a regular user:

user $ steam-nvidia-launcher

The steam-nvidia-launcher takes care of the full Steam container lifecycle. You simply run it as your local user, and it will download the official Funtoo Steam docker image and launch it. The launcher will stay running until you hit Control-C, at which point it will stop Steam and also stop the container.

The next time you want to start Steam, you'll run the launcher, and it will find the existing container, start it, and start Steam. Just like before, when you want to stop Steam and the container, hit Control-C and Steam and the container will be stopped.

Since it is the initial run of the launcher, it will download the Docker image first, which is about 1.5GB in size, and then it will launch a new container image. You should see Steam start to update itself, and then when this is done it will prompt you to log in to Steam. Congratulations! Steam is now running!

Container Validation

It is possible to open a bash shell within an already launched container by running the following command in another X terminal:

user $ steam-nvidia-launcher attach
steam-container #

From this point, you can inspect the state of the running container interactively and test out various parts of its operation. When you are done, you can exit the container by pressing Control-D or typing exit.

Test PulseAudio

To ensure that PulseAudio is functioning properly from within the container, the following command can be run to play back white noise via PulseAudio:

steam-container # pacat -vvvv /dev/urandom

Test OpenGL

To ensure that OpenGL is working properly from within the container, and that the container is properly connecting to your X server, you can run glxgears:

steam-container # glxgears

You should see glxgears running in a window on your desktop.

Future Work

The work on Steam on Funtoo is ongoing with the following efforts planned:

  • Support for Steam on Open Source drivers, not just NVIDIA.
  • Storage of Steam Library and configuration outside of the container, so that wiping the container image will not wipe your downloaded games. (DONE: Supported in version 1.4)
  • Support for integration of Desktop shortcuts with your native DE.