cd ~{,/zhs/}

Containerize Steam with systemd-nspawn

Create Btrfs Subvolume

# su # switch to root user
# cd /var/lib/machines
# container_name=steam
# btrfs subvolume create $container_name

Then it will be easy to snapshot and migrate the container.

Install Minimal Ubuntu

Reference: systemd-nspawn - ArchWiki

Codename of current latest LTS version of Ubuntu is focal. Feel free to use your preferred repository.

# codename=focal
# repository_url=''
# debootstrap --include=systemd-container \
--components=main,universe,multiverse \
$codename $container_name $repository_url

After installation, run systemd-nspawn --machine=$container_name to boot into brand new container.


You may need to add --bind-ro=/etc/resolv.conf option to make DNS work in container.

To check network status, consider commands ping and ping if former works and latter doesn’t, it would be DNS problem.


Reference: Generating locales - ArchWiki

Without en_US.UTF-8 locale, steam will complain some errors.

Install Steam

Inside container, enable i386 architecture and install the package from Ubuntu official repository:

# dpkg --add-architecture i386
# apt-get update
# apt-get install steam

According to file list, its startup script is located at /usr/games/steam. Let’s create a symbol link to make it convenient to launch:

# file /usr/games/steam
# ln --verbose --symbolic /usr/games/steam /usr/local/bin/

Inside container, add a dedicated normal user named “steam” and create user base directories:

# useradd --create-home steam
# su --login steam --shell /bin/bash
# mkdir --parents ~/.config ~/.local/share

Later I also created ~/library to customize Steam default library folder location, and mounted a folder ~/screenshots to store screenshots on host.

Other Preparation

Command options become just too many, from this step we need start to actually write up a shell script to run Steam in GUI.

Passthrough Devices

Graphic Cards


Wrap Up

Game Issues

Don’t Starve Together

No Sound

This game uses FMOD engine and seems to explicitly depend on ALSA. It doesn’t play any audio and constantly resets volumes to 0.


Plants vs. Zombies GOTY Edition

(Run through Steam Play)

FPS Drop During Plant Selection

Source: [email protected]

Replace DRM version executable (5.1MiB) with non-DRM version (3.4MiB).

I uploaded my non-DRM version executable here along with its SHA-256 checksum: cdddfb30f50510afa389de4966089a1ac1a9a2bf09fb8d0aa0793178b0814cd1

Here’s complete steps to extract non-DRM version executable and replace then:

  1. Fresh installation;
  2. Startup game (for the very first time) and do not exit;
  3. Change to corresponding library folder, like mine: cd /home/steam/library;
  4. Copy steamapps/compatdata/3590/pfx/drive_c/ProgramData/PopCap Games/PlantsVsZombies/popcapgame1.exe to /tmp/;
  5. Exit game;
  6. Copy /tmp/popcapgame1.exe to overwrite steamapps/common/Plants\ Vs\ Zombies/PlantsVsZombies.exe, done.

Where is library folder? Go to “Settings->Downloads->Content Libraries” to open library folders configuration dialog:



Blank CJK Fonts

Source: 求助,游戏打开后没有字 :: Beholder General Discussions

This game exactly depends on font “WenQuanYi Micro Hei”, on Ubuntu 20.04 its package is fonts-wqy-microhei:

# systemd-nspawn --machine=steam --bind-ro=/etc/resolv.conf apt install fonts-wqy-microhei

If not working, you may need a manually refresh of fontconfig:

# systemd-nspawn --machine=steam fc-cache --force --verbose