Like always, I prefer to install any app in a manageable way, i.e., layer on the base system without altering the base in any way or leaving a lot of residue upon uninstallation.
Moreover, you can choose to use any images you want regardless of your base system. For example, you can use the official CachyOS image that provides x86-64-v3 optimized packages, hence improving gaming performance.
1. Installing Distrobox and Podman
The command will differ based on your specific package manager. Refer to your distro's docs. For example, on Arch based distros:
sudo pacman -S distrobox podman
2. Configure Distrobox to use Podman
echo 'container_manager="podman"' > ~/.config/distrobox/distrobox.conf
3. Create a container
distrobox-create -i docker.io/cachyos/cachyos-v3:latest -n games-dbx -H ~/distrobox/games-dbx --additional-flags "--dns=none" --volume /run/dbus/system_bus_socket:/run/dbus/system_bus_socket
I use the
--dns=noneflag because I want to go as light as possible by not using aninitcontainer (a container with its ownsystemd). Without this flag, Steam will try to findsystemd-resolved, of which doesn't exist obviously, and won't be able to launch successfully.Without
systemdinside the container, Steam will always show UTC time instead of your local time in Big Picture Mode, see Steam issue #10057.
Note: For NVIDIA users, in order to use the GPU inside the container, you need to add --nvidia flag to the distrobox-create command. See more here.
4. Enable x86-64-v3 packages
Once the container is created, enter the container and enable x86-64-v3 packages:
sudo pacman -Syu
sudo pacman -Qqn | sudo pacman -S -
5. Generating the container's locales
First, install nano to be able to edit /etc/locale.gen:
sudo pacman -S nano
Then, editing /etc/locale.gen:
sudo nano /etc/locale.gen
Uncomment (removing #) from en_US.UTF-8 UTF-8 line. Also, if your local language is differ, uncomment your local language too. For example:
en_US.UTF-8 UTF-8
th_TH.UTF-8 UTF-8
Lastly, generating locales:
sudo locale-gen
6. Install Steam!
sudo pacman -S steam
If you're asked during the installation,...
About the font, I use Noto font.
About which Vulkan to use, use your vendor's Vulkan. It should be obvious enough, for example, vulkan-intel (or lib32-vulkan-intel).
Please use everything from CachyOS repository if being asked.
7. Export Steam inside the container to the host
Run this inside the container:
distrobox-export -a steam
With this, you will be able to launch Steam on the host, i.e., with Steam icon on the host.
8. Auto-update the container, zero maintenance time!
Create a systemd service file:
nano ~/.config/systemd/user/dbx-upgrade.service
Inside the service file:
[Unit]
Description=Upgrade all Distrobox containers
RequiresMountsFor=/run/user/1000/containers
StartLimitBurst=3
StartLimitIntervalSec=600
[Service]
Type=exec
ExecStart=sh -c "distrobox-upgrade --all"
Restart=on-failure
RestartSec=60
Create a systemd timer file:
nano ~/.config/systemd/user/dbx-upgrade.timer
Inside the timer file:
[Unit]
Description=Start Distrobox containers upgrade service with some delay.
[Timer]
OnStartupSec=30
RandomizedDelaySec=15
Persistent=true
[Install]
WantedBy=timers.target
Reload and enable the timer:
systemctl --user daemon-reload && systemctl --user enable dbx-upgrade.timer
BONUS: Increase vm.max_map_count
According to Arch Wiki, it's recommended to increase the vm.max_map_count.
This one has to be done on the host and the container will follow automatically. The procedure should be the same across all distros.
Create a sysctl rule:
sudo nano /etc/sysctl.d/99-gamecompatibility.conf
Add vm.max_map_count = 2147483642 in the file.
Then, apply the change immediately with:
sudo sysctl --system
With this, you should be able to run Steam inside a container. Enjoy!
Cover Photo by Igor Saikin on Unsplash
Top comments (0)