惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
G
Google Developers Blog
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Engineering at Meta
Engineering at Meta
B
Blog
博客园_首页
量子位
博客园 - 叶小钗
L
LangChain Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
F
Fortinet All Blogs
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
D
DataBreaches.Net
雷峰网
雷峰网
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
The GitHub Blog
The GitHub Blog
I
Intezer
H
Help Net Security
The Hacker News
The Hacker News
The Register - Security
The Register - Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
AWS News Blog
AWS News Blog
V
V2EX
Microsoft Security Blog
Microsoft Security Blog
T
Tenable Blog
Spread Privacy
Spread Privacy
A
Arctic Wolf
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
Schneier on Security
Schneier on Security
C
CERT Recently Published Vulnerability Notes
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Last Watchdog
The Last Watchdog
Latest news
Latest news
T
Troy Hunt's Blog
L
LINUX DO - 热门话题

Feed of liolok

Fix Broken URLs of My Site Containerize Android Studio with systemd-nspawn Run Desktop App with systemd-nspawn Container Oculus Quest 2 Usage Note Set Environment Variables with pam_env Install Arch Linux on Acer Swift 3 SF313-52 Run Mastodon Server on Arch Linux VPS V2Ray Subscription Parse Manage Dotfiles with Git and Stow Run SS and MTProxy Server on AWS How to Add Image to Hexo Blog Post Build Blog with Hexo and GitHub Pages
Containerize Steam with systemd-nspawn
2021-08-31 · via Feed of liolok

cd ~{,/zhs/}


  • Create Btrfs Subvolume
  • Install Minimal Ubuntu
  • Network
  • Locale
  • Install Steam
  • Other Preparation
  • Passthrough Devices
    • Graphic Cards
    • Joysticks
  • Wrap Up
  • Game Issues
    • Don’t Starve Together
      • No Sound
    • Plants vs. Zombies GOTY Edition
      • FPS Drop During Plant Selection
    • Beholder
      • Blank CJK Fonts

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 jammy. Feel free to use your preferred repository.

# codename=jammy
# repository_url='https://mirrors.ustc.edu.cn/ubuntu/'
# 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.

Network

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

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

Locale

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 update
# apt 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
# 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

  • Device files:
    • For Intel or AMD: --bind=/dev/dri/card0 and so on
    • For NVIDIA: --bind=/dev/nvidia0 and so on
  • Access: --property=DeviceAllow='char-drm rw'

Note for NVIDIA card user:

  1. Stop using it and save your time
  2. Mount /dev/nvidia*
  3. Make sure user space driver version is exactly the same with kernel module in host.

Joysticks

  • Device files: --bind-ro=/dev/input/js0 and so on
  • Access: --property=DeviceAllow='char-input r'

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.

Solutions:

  • Debian/Ubuntu: apt install pulseaudio
  • Arch Linux: pacman --sync pulseaudio-alsa --assume-installed pulseaudio

Plants vs. Zombies GOTY Edition

(Run through Steam Play)

FPS Drop During Plant Selection

Source: AngrySpaceElf@ProtonDB

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:

library-folders

Beholder

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