The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Steam/LXD
This page covers the process of installing Steam in a LXD container. The instructions assume that the container is Ubuntu, but it should be very similar for all other distributions.
Installing LXD
Please refer to the LXD page for instructions on setting up LXD.
Preparing the host
To be able to run graphical applications in the LXD container and to have audio, we need to allow connections to the host's X and PulseAudio sockets.
These commands only need to be run once to set up your host installation and not before creating a container in general. Running them multiple times may mess things up (especially the pulseaudio sed command)!
To allow X connections, run as your regular user:
user $ xhost +local:
To allow PulseAudio connections, run as root:
root # sed -i "s/load-module module-native-protocol-unix/& auth-anonymous=1/" /etc/pulse/default.pa
Then, restart PulseAudio for the changes to take immediate effect:
user $ killall pulseaudio
Creating and configuring the container
The first step we need to take here is to create a new container. Since version 7 of Proton, nested containerization is needed because Proton now sandboxes games' execution. In this example, we'll create an Ubuntu Hirsute Hippo container, which will be called 'steam-ubuntu'
Creating a privileged container
Privileged containers as the name suggests have more privileges than unprivileged ones. Because of this it's often discouraged to used them because the attack surface is wider. However, to set up nesting with them is as easy as running:
root # lxc launch images:ubuntu/hirsute steam-ubuntu -c security.nesting=true -c security.privileged=true
We recommend you use the setup below for unprivileged containers
Creating an unprivileged container
To create unprivileged containers with support for nesting, follow the following part of the LXD install guide, then just create a container like this:
root # lxc launch images:ubuntu/hirsute steam-ubuntu -c security.nesting=true
Configuring the container
Now, it's time to configure the container. First, we need to pass the necessary devices and sockets to the container. Pass the GPU to the container:
root # lxc config device add steam-ubuntu mygpu gpu
Pass the X socket (specifically display 0):
root # lxc config device add steam-ubuntu X0 proxy bind=container connect=unix:/tmp/.X11-unix/X0 listen=unix:/tmp/.X11-unix/X0 uid=1000 gid=1000 mode=0777 security.uid=1000 security.gid=1000
Pass the PulseAudio socket:
root # lxc config device add steam-ubuntu PASocket1 proxy bind=container connect=unix:/run/user/1000/pulse/native listen=unix:/home/ubuntu/pulse-native uid=1000 gid=1000 mode=0777 security.uid=1000 security.gid=1000
Also, we'll set some environment variables. Set the DISPLAY environment variable:
root # lxc config set steam-ubuntu environment.DISPLAY :0
Set the PULSE_SERVER environment variable:
root # lxc config set steam-ubuntu environment.PULSE_SERVER unix:/home/ubuntu/pulse-native
Disable Proton's esync, as it appears to cause crashes in certain games (workaround):
root # lxc config set steam-ubuntu environment.PROTON_NO_ESYNC 1
Prerequisites for installing Steam
We're ready to spawn a shell inside the container and install Steam:
root # lxc exec steam-ubuntu -- bash
We're now inside the container. Steam requires certain x86 libraries, so we need to add the i386 architecture repository:
steam-ubuntu # dpkg --add-architecture i386
Update and upgrade the system:
steam-ubuntu # apt update && apt upgrade
Install some prerequisites:
steam-ubuntu # apt install wget software-properties-common pciutils
We also need to install graphics drivers in the container. The following instructions are taken from Lutris, where you can find up-to-date instructions for different distributions as well.
Mesa drivers (AMD/Intel)
To get the latest Mesa drivers it is necessary to add the kisak-mesa PPA:
steam-ubuntu # add-apt-repository ppa:kisak/kisak-mesa
Upgrade the system again:
steam-ubuntu # apt update && apt upgrade
Install the drivers:
steam-ubuntu # apt install libgl1-mesa-dri:i386 mesa-vulkan-drivers mesa-vulkan-drivers:i386
Nvidia (proprietary) drivers
To get the latest Nvidia drivers it is necessary to add the Proprietary GPU Drivers PPA:
steam-ubuntu # add-apt-repository ppa:graphics-drivers/ppa
Upgrade the system again:
steam-ubuntu # apt update && apt upgrade
Install the correct Nvidia driver for your GPU, i.e. version 460. The version should match your host's driver version:
steam-ubuntu # apt install nvidia-driver-460 libvulkan1 libvulkan1:i386
Installing Steam
Finally, download the official Steam package and install it:
steam-ubuntu # wget -O ~/steam.deb http://media.steampowered.com/client/installer/steam.deb && apt install ~/steam.deb && rm ~/steam.deb
Before launching Steam, we need to disable the PulseAudio client's shared memory, so we force it to only use the socket:
steam-ubuntu # sed -i "s/; enable-shm = yes/enable-shm = no/g" /etc/pulse/client.conf
The installation is now done. Exit from the container:
steam-ubuntu # exit
Launching Steam
Before launching Steam for the first time, it's a good idea to restart the container to make sure all changes are applied properly:
root # lxc restart steam-ubuntu
Then, we can launch Steam with the following command:
root # lxc exec steam-ubuntu -- bash -c "su ubuntu -c steam"
You're now ready to log in and play!