Skip to content
Snippets Groups Projects
README.md 26.37 KiB

pressure-vessel — tools to put Steam in containers

pressure-vessel is a bit like a simplified version of Flatpak for Steam games.

Use cases

Using an alternative runtime

We can get a more predictable library stack than the LD_LIBRARY_PATH-based Steam Runtime by making an alternative runtime available over /usr, /lib*, /bin, /sbin, analogous to Flatpak runtimes, using some or all of the host system's graphics stack.

In particular, this would avoid or mitigate the following problems with the LD_LIBRARY_PATH-based Steam Runtime:

  • The Steam Runtime cannot contain glibc, because the path to ld.so(8) is hard-coded into all executables (it is the ELF interpreter, part of the platform ABI), the version of ld.so is coupled to libdl.so.2, and the version of libdl.so.2 is coupled to the rest of glibc; so everything in the Steam Runtime must be built for a glibc at least as old as the oldest system that Steam supports. This makes it difficult to advance beyond the Ubuntu 12.04-based 'scout' runtime: everything that is updated effectively has to be backported to Ubuntu 12.04.

  • The Steam Runtime was originally designed to prefer its own version of each library even if the version in the host system was newer, but this broke any graphics driver that relied on a newer version of a host library, notably libstdc++.

  • More recent versions of the Steam Runtime prefer the "pinned" host system version of most libraries that appear to be at least as new as the Runtime's own version, but this can also break things if libraries claim to be compatible (by having the same ELF DT_SONAME) but are in fact not compatible, for example:

    • libcurl.so.4 linked to libssl 1.0 is not completely compatible with libcurl.so.4 linked to libssl 1.1

    • The history of libcurl.so.4 in Debian/Ubuntu has involved two incompatible sets of versioned symbols, due to some decisions made in 2005 and 2007 that, with hindsight, were less wise than they appeared at the time

    • Various libraries can be compiled with or without particular features and dependencies; if the version in the Steam Runtime has a feature, and the host system version is newer but does not have that feature, then games cannot rely on the feature

    • In the worst-case, compiling a library without a particular feature or dependency can result in symbols disappearing from its ABI, resulting in games that reference those symbols crashing

    • There is a fairly subtle interaction between libdbus, libdbusmenu-gtk, libdbusmenu-glib and Ubuntu's patched GTK 2 that has resulted in these libraries being forced to be taken from the Steam Runtime, to avoid breaking the Unity dock

  • Preferring the "pinned" host system libraries makes it very easy for a game developer to make their game depend on a newer host-system library without realising that they have done so, resulting in their game not running correctly on older host systems, or on host systems that do not have a library with a matching DT_SONAME.

A future goal is to use libcapsule to avoid the library dependencies of the host system's graphics stack influencing the libraries loaded by games at all, and in particular allow game logic to use the Runtime's libstdc++ while the host system graphics driver uses a different, newer libstdc++. This is not yet implemented.

Protecting $HOME

(This feature is not being actively developed right now.)

If we change the meaning of /home for a game to be a fake app-specific directory, then the game can't write random files in unknown subdirectories of $HOME, and we can be reasonably sure that uninstalling a game removes all of its files. As a side benefit, this could make it easier to be sure that all the necessary files have been selected for Steam Cloud Sync, because we could prevent the game writing anywhere that won't be synchronised, other than /tmp or similar.

Building a local test version of pressure-vessel

pressure-vessel is a reasonably ordinary Meson project. It depends on GLib and libXau.

If you are using it with the under-development Steam Linux Runtime, you will probably want to compile it with an unusual ${prefix}:

prefix="${XDG_DATA_HOME:-"$HOME/.local/share"}/Steam/steamapps/common/SteamLinuxRuntime/pressure-vessel"
libdir="lib/x86_64-linux-gnu"
meson --prefix="$prefix" --libdir="$libdir" _build
ninja -C _build
meson test -v -C _build             # optional
ninja -C _build install

Note that this will give you a non-production version of pressure-vessel that is likely to depend on libraries from your host system, which is good for quick turnaround and debugging, but not suitable for deployment to the public. For that, you'll want a relocatable installation: see below.

If you are developing pressure-vessel, you might well want to alter the bundled libcapsule tools. You can do this by building your own copy of libcapsule. This requires 32- and 64-bit copies of libelf (the version from elfutils) and its development files.

git clone https://gitlab.collabora.com/vivek/libcapsule.git
cd libcapsule
prefix="${XDG_DATA_HOME:-"$HOME/.local/share"}/Steam/steamapps/common/SteamLinuxRuntime/pressure-vessel"
libdir="lib/x86_64-linux-gnu"
NOCONFIGURE=1 ./autogen.sh
mkdir _build _build/i386 _build/x86_64
( cd _build/x86_64; ../../configure
--host=x86_64-linux-gnu --enable-host-prefix=x86_64-linux-gnu- \
--prefix="$prefix" --libdir="\${prefix}/$libdir" \
--disable-gtk-doc --disable-shared --without-glib )
( cd _build/i386; ../../configure
--host=i686-linux-gnu --enable-host-prefix=i386-linux-gnu- \
--prefix="$prefix" --libdir="\${prefix}/$libdir" \
--disable-gtk-doc --disable-shared --without-glib )
make -C _build/x86_64
make -C _build/i386
make -C _build/x86_64 install
make -C _build/i386 install

Use --host=i586-linux-gnu instead of --host=i686-linux-gnu if your distribution uses that tuple for its 32-bit compiler. For the i386 build, if you don't have an i?86-linux-gnu-gcc you might have to add CC="gcc -m32" to the i386 configure command line.

Again, this will give you a non-production version of libcapsule that is likely to depend on libraries from your host system.