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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
罗磊的独立博客
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
The Register - Security
The Register - Security
IT之家
IT之家
WordPress大学
WordPress大学
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Help Net Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
NISL@THU
NISL@THU
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
B
Blog
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
S
Security Affairs
小众软件
小众软件
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
A
Arctic Wolf
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

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