Steam Deck: The Linux User's Dream
When I received my Steam Deck about -checks Steam account- 3 months ago, I was already aware of what it was capable of, considering that I had been browsing r/SteamDeck while waiting for it. What I did not know was its capabilities as a Linux desktop or even server.
You may ask “what is so special about another Switch clone?” if you don’t know what it is, and if you do you may ask “what is so special about a handheld pc?”
The truth is, Valve got the hardware and the software aspects right;
the latter being an Arch-based OS with full root access (I’m talking
#
shells and being able to sudo rm -rf /
😈), which is the main reason I
was able to do so many things with it.
The hardware
If you have been out of the loop, it’s a normal Arch Linux machine,
and by normal I mean the cpu is x86_64
instead of Aarch64
(ARM). While
this might not lead to a great battery life like the Nintendo
Switch1, it does make it possible to run PC games, but
more importantly you can even run things like Kubernetes, old PC games,
and pretty much most software that was made in the past few decades
for Linux and Windows.
The environment
Just like any typical Arch install, SteamOS comes with an OpenSSH server:
sudo systemctl statrt sshd
That’s it! You now have remote access. You can do whatever you would do with a typical linux laptop. It compiles code faster than my T580 thinkpad, and it’s half the price. 🙂.
The OS
If you haven’t been keeping up with the new wave of GNU/Linux OSs coming out, you might have missed a new theme: immutability2. Essentially, the idea is that if you can’t change it, you can’t break it. Some recent ones that I have used are:
- Fedora CoreOS
- Immutable server OS
- Fedora Silverblue
- similar to CoreOS, but with a Gnome desktop
- OpenSUSE MicroOS
- SUSE’s take on the same idea
The big question you might ask is “if every package is managed for me, how do I install things, or even modify things?” The answer is simple: containers. For desktop apps you would use Flatpaks, and for services you can use docker or podman (rootless and daemonless docker).
You can install stuff like
sudo pacman -S <some tool>
but the problem is that the package would be wiped after a system update. I will discuss ideas on how to get around this below.
Experiments
Now that you have a general idea of what type of system we’re dealing with, let me tell you about the things I’ve tried on it
Virtualization
The answer is a simple yes. This is not an m1 mac attempting to emulate another architecture; with a simple QEMU install, I was able to virtualize Terry Davis’ TempleOS just for fun, but you can virtualize Windows, or any other OS if you have the image for it. The cherry on top is that they can be added as a game to steam like any other game.
Linux Desktop software
Again, it’s a normal machine. I installed Doom Emacs, LibreWolf, and Discord with no issues. The only thing to keep in mind is that if you would like to set keybindings and use it in game-mode, you’d need to add it as a non-steam game as mentioned above or using BoilR.
Ansible
Just like with almost any other device that comes with SSH and Python, the steam deck works with ansible. The most useful module is the flatpak module for installing desktop apps. Check out my playbooks to get an idea on how to declaratively-ish set up your Deck.
Distrobox
Coming back to the point from the talk about the OS, you technically cannot install software globally, since the updates wipe your changes. An interesting way of getting around this is Distrobox, which I discovered from the community, and have since been using it on my other devices as well.
Distrobox lets you run docker images of most Linux distributions, but it also applies changes that make it look like a real environment, such as mounting your home directory, getting GUI apps to work, and etc3.
Remote directory mounting
Emulation on the Deck is great4, but newer consoles tend to have games that go beyond the usual 20-30G. Even on the model that I own with the 512G SSD, it is not enough for storing tens of AAA games5. My desktop is always running, and it has more than enough storage, but how do we get the files across if they’re stored remotely?6
The answer comes back to my all time favorite protocol: SSH. You can do more than use a remote shell and transfer files; SSHFS lets you mount directories over the network7.
Last piece of the puzzle is to get it to mount whenever there’s a connection. You guess it! SystemD!8
SystemD lets you write and manage services as a normal user, and it’s
great because logging and network dependency can be taken care of,
without any hassle. A simple service that I wrote to mount my ps3
games was this, which I put at .config/systemd/user/ps3.service
9:
[Unit]
Description=Mount remote SSH directories
After=network.target
[Service]
ExecStart=sshfs -f roms-server:roms/ps3 /home/deck/Emulation/roms/ps3
ExecStop=fusermount -u /home/deck/Emulation/roms/ps3
Restart=on-failure
[Install]
WantedBy=network.target
Now, enable the service with
systemctl --user enable ps3
And voila! Now all of the remote games become visible when you turn on the Deck, without taking up any of the local storage.
Final thoughts
There is so much more to be done like changing your boot video, set up 3ds with another display, or just use it as a gaming PC, but this post wasn’t meant to be a guide; these were simply things I did and learned. For an extensive guide hit up Steam Deck Guide.
https://screenrant.com/steam-deck-battery-life-nintendo-switch/ ↩︎
If you have done any pure functional programming (like Haskell), this should seem familiar. If this interests you, check out NixOS. ↩︎
Distrobox only needs docker or podman, and since you cannot install either permanently, there is a script on their repo to take care of that. Check this out for more information. ↩︎
You can manually install emulators, use the RetroDECK flatpak, or use EmuDeck, which is what I did. ↩︎
The reason games -at least in my experience- run so smoothly is because of the fact that the games are loaded into memory, rather than actively interacting with the storage. ↩︎
Just to clarify, we are not streaming the game, but rather the game roms. This would put the load on the Deck’s APU, but it also runs much better than cloud gaming services, if your internet is slow. ↩︎
This is very similar to NFS, but there is no need to open an extra port or install a new program, and obviously, SSH traffic is thoroughly encrypted. ↩︎
Another detail I’m omitting is the “What if I’m not home?” scenario. I personally have a WireGuard vpn running with an open port on my router, but if you do not want to open a port, there’s always Tailscale. I highly suggest this article by Xe, which goes significantly more in depth than other sources. ↩︎
roms-server
in this instance is a remote host that hosts my roms which I aliased in.config/ssh
. You could also putuser@yourhost
if you don’t want to create aconfig
file for SSH. ↩︎