Introduction: an immutable OS The Steam Deck runs SteamOS, a single-user operating system based on Arch Linux. Although derived from a standard package-based distro, the OS in the Steam Deck is immutable and system updates replace the contents of the root filesystem atomically instead of using the package manager. An immutable OS makes the system more stable and its updates less error-prone, but users cannot install additional packages to add more software. This is not a problem for most users since they are only going to run Steam and its games (which are stored in the home partition). Nevertheless, the OS also has a desktop mode which provides a standard Linux desktop experience, and here it makes sense to be able to install more software. How to do that though? It is possible for the user to become root, make the root filesytem read-write and install additional software there, but any changes will be gone after the next OS update. Modifying the rootfs can also be dangerous if the user is not careful. Ways to add additional software The simplest and safest way to install additional software is with Flatpak, and that s the method recommended in the Steam Deck Desktop FAQ. Flatpak is already installed and integrated in the system via the Discover app so I won t go into more details here. However, while Flatpak works great for desktop applications not every piece of software is currently available, and Flatpak is also not designed for other types of programs like system services or command-line tools. Fortunately there are several ways to add software to the Steam Deck without touching the root filesystem, each one with different pros and cons. I will probably talk about some of them in the future, but in this post I m going to focus on one that is already available in the system:
systemd-sysext. About systemd-sysext This is a tool included in recent versions of systemd and it is designed to add additional files (in the form of system extensions) to an otherwise immutable root filesystem. Each one of these extensions contains a set of files. When extensions are enabled (aka merged ) those files will appear on the root filesystem using overlayfs. From then on the user can open and run them normally as if they had been installed with a package manager. Merged extensions are seamlessly integrated with the rest of the OS. Since extensions are just collections of files they can be used to add new applications but also other things like system services, development tools, language packs, etc. Creating an extension: yakuake I m using yakuake as an example for this tutorial since the extension is very easy to create, it is an application that some users are demanding and is not easy to distribute with Flatpak. So let s create a
yakuakeextension. Here are the steps: 1) Create a directory and unpack the files there:
2) Create a file called
$ mkdir yakuake $ wget https://steamdeck-packages.steamos.cloud/archlinux-mirror/extra/os/x86_64/yakuake-21.12.1-1-x86_64.pkg.tar.zst $ tar -C yakuake -xaf yakuake-*.tar.zst usr
usr/lib/extension-release.dwith the fields
VERSION_IDtaken from the Steam Deck s
3) Create an image file with the contents of the extension:
$ mkdir -p yakuake/usr/lib/extension-release.d/ $ echo ID=steamos > yakuake/usr/lib/extension-release.d/extension-release.yakuake $ echo VERSION_ID=3.3.1 >> yakuake/usr/lib/extension-release.d/extension-release.yakuake
That s it! The extension is ready. A couple of important things: image files must have the
$ mksquashfs yakuake yakuake.raw
.rawsuffix and, despite the name, they can contain any filesystem that the OS can mount. In this example I used SquashFS but other alternatives like EroFS or ext4 are equally valid. NOTE: systemd-sysext can also use extensions from plain directories (i.e skipping the
mksquashfspart). Unfortunately we cannot use them in our case because overlayfs does not work with the casefold feature that is enabled on the Steam Deck. Using the extension Once the extension is created you simply need to copy it to a place where systemd-systext can find it. There are several places where they can be installed (see the manual for a list) but due to the Deck s partition layout and the potentially large size of some extensions it probably makes more sense to store them in the home partition and create a link from one of the supported locations (
/var/lib/extensionsin this example):
Once the extension is installed in that directory you only need to enable and start systemd-sysext:
(deck@steamdeck ~)$ mkdir extensions (deck@steamdeck ~)$ scp user@host:/path/to/yakuake.raw extensions/ (deck@steamdeck ~)$ sudo ln -s $PWD/extensions /var/lib/extensions
After this, if everything went fine you should be able to see (and run)
(deck@steamdeck ~)$ sudo systemctl enable systemd-sysext (deck@steamdeck ~)$ sudo systemctl start systemd-sysext
/usr/bin/yakuake. The files should remain there from now on, also if you reboot the device. You can see what extensions are enabled with this command:
If you add or remove extensions from the directory then a simple
$ systemd-sysext status HIERARCHY EXTENSIONS SINCE /opt none - /usr yakuake Tue 2022-09-13 18:21:53 CEST
systemd-sysext refreshis enough to apply the changes. Unfortunately, and unlike distro packages, extensions don t have any kind of post-installation hooks or triggers, so in the case of Yakuake you probably won t see an entry in the KDE application menu immediately after enabling the extension. You can solve that by running
kbuildsycoca5once from the command line. Limitations and caveats Using systemd extensions is generally very easy but there are some things that you need to take into account:
- Using extensions is easy (you put them in the directory and voil !). However, creating extensions is not necessarily always easy. To begin with, any libraries, files, etc., that your extensions may need should be either present in the root filesystem or provided by the extension itself. You may need to combine files from different sources or packages into a single extension, or compile them yourself.
- In particular, if the extension contains binaries they should probably come from the Steam Deck repository or they should be built to work with those packages. If you need to build your own binaries then having a SteamOS virtual machine can be handy. There you can install all development files and also test that everything works as expected. One could also create a Steam Deck SDK extension with all the necessary files to develop directly on the Deck
- Extensions are not distribution packages, they don t have dependency information and therefore they should be self-contained. They also lack triggers and other features available in packages. For desktop applications I still recommend using a system like Flatpak when possible.
- Extensions are tied to a particular version of the OS and, as explained above, the
VERSION_IDof each extension must match the values from
/etc/os-release. If the fields don t match then the extension will be ignored. This is to be expected because there s no guarantee that a particular extension is going to work with a different version of the OS. This can happen after a system update. In the best case one simply needs to update the extension s
VERSION_ID, but in some cases it might be necessary to create the extension again with different/updated files.
- Extensions only install files in
/opt. Any other file in the image will be ignored. This can be a problem if a particular piece of software needs files in other directories.
- When extensions are enabled the
/optdirectories become read-only because they are now part of an overlayfs. They will remain read-only even if you run
steamos-readonly disable!!. If you really want to make the rootfs read-write you need to disable the extensions (
systemd-sysext unmerge) first.
- Unlike Flatpak or Podman (including toolbox / distrobox), this is (by design) not meant to isolate the contents of the extension from the rest of the system, so you should be careful with what you re installing. On the other hand, this lack of isolation makes systemd-sysext better suited to some use cases than those container-based systems.