The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Steam"
Line 32: | Line 32: | ||
# rc | # rc | ||
}} | }} | ||
=== Host Validation === | |||
With the host 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= | |||
$ 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 === | === User Setup === |
Revision as of 01:30, October 24, 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.
Steam in Docker
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 graphics, with full PulseAudio sound, docker with NVIDIA support will be used. I have built up an official Steam container for use with NVIDIA graphics. It is based on Ubuntu 18, since Steam and Ubuntu have an unholy alliance and this is the official platform for Steam. That's fine -- we can still run Steam on Ubuntu -- in Funtoo!
The base Ubuntu container image upon which our container is built comes directly from NVIDIA and has been configured to work perfectly with container GPU acceleration.
Host Setup
To get your host ready to run Steam, emerge the following packages:
root # emerge -av --jobs docker nvidia-container-runtime nvidia-docker
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
.
Next, you will want to add docker
and nvidia-container
to your default runlevel:
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
Host Validation
With the host 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 adding the following to /etc/pulse/default.pa
:
/etc/pulse/default.pa
load-module module-native-protocol-unix auth-anonymous=1
Once this is done, 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 /run/user/$UID/pulse/ native pid
Docker Container Setup
As your regular user, create the following script:
create-steam.sh
(bash source code) #!/bin/bash
xhost +local:
exec nvidia-docker run \
-ti \
--name steam-nvidia-${USER} \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /dev/shm:/dev/shm \
--privileged \
-v /run/user/${UID}/pulse:/run/user/1000/pulse \
-e PULSE_SERVER=unix:/run/user/1000/pulse/native \
funtoolinux/steam-nvidia-ubuntu18:1.0 \
/bin/bash
Now, make the script executable and run it:
user $ chmod +x create-steam.sh user $ ./create-steam.sh
The container should begin to initialize and you should then be placed inside the container, at which point you can perform some quick tests to ensure that the container is functioning properly.
Container Validation
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
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.
At this point, you can exit the container by pressing Control-D or typing exit
. Make a mental note that the container name is steam-nvidia-yourusername
.
Container Operations
Your container is now running and ready to start Steam. But if you restart your computer in the future (and I know you will), the container will not be running. To start the container, we will create the following script:
start-steam.sh
(bash source code) #!/bin/bash
xhost +local:
running="$(docker inspect -f '[[:Template:.State.Running]]' steam-nvidia-$USER)"
if [ "$running" == "false" ]; then
nvidia-docker start steam-nvidia-$USER
sleep 8
fi
nvidia-docker exec -it steam-nvidia-$USER su steam /usr/games/steam
This script will check to see if the container is running. If not, it will start the container, and then attach the current shell to the container and run /usr/games/steam
as the steam
user in the container. Use it the typical way:
user $ chmod +x start-steam.sh user $ ./start-steam.sh
You should see a Steam window open almost immediately and start downloading updates, after which point Steam will restart and prompt you to log in.