This article is adapted from shorinkiwata/archlinuxinstall, preserving the original tutorial's operational detail while anonymizing it and correcting risk guidance. Package names, extensions, drivers, and interfaces may change with rolling updates. All commands below are examples for reading; they were not executed or verified in this task.
Prerequisites for Virtualization and Passthrough#
First verify CPU virtualization, firmware IOMMU, and kernel support. The monolithic libvirtd example below is one management model; current libvirt also offers modular daemons. Choose according to your installation, and do not mix service startup approaches.
GPU passthrough requires a separate, suitable IOMMU group, while the host must retain working display and input devices. IOMMU logs alone do not prove that device grouping is safe for passthrough. After changing vfio bindings, check driver bindings with lspci -nnk; rebuild the initramfs when reverting as well. Do not blindly assign the host's only active GPU/USB controller to a guest.
Waydroid requires a Wayland session, kernel Binder support, and a working graphics path. ARM translation and additional image scripts are third-party components. Review their code and licenses before execution, especially installation flows using sudo. Android applications in a container do not automatically gain full compatibility with games, DRM, or anti-cheat systems.
KVM Virtual Machines#
[Solved] Cannot Access Storage Files in KVM Libvirt: Permission Denied How to Install KVM on Ubuntu | phoenixNAP KB How to Share Folders Between a Linux Host and a Windows Guest in KVM | Linux China - Zhihu
- Install qemu, the graphical interface, and TPM support
sudo pacman -S qemu-full virt-manager swtpm
- Enable the libvirtd system service
sudo systemctl enable --now libvirtd
- Enable the default NAT network
sudo virsh net-start default
sudo virsh net-autostart default
- Add group permissions; log out for them to take effect
sudo usermod -a -G libvirt <username> # 仅当当前授权方案使用此组
- Check access permissions for virtual machine storage
sudo vim /etc/libvirt/qemu.conf
# 把user = "libvirt-qemu"改为user = "用户名"
# 把group = "libvirt-qemu"改为group = "libvirt"
# 取消这两行的注释
- Restart the service
sudo systemctl restart libvirtd
Nested Virtualization
First check the current module's nested parameter. Load-time parameters take effect only if the module is not already loaded. Do not unload KVM modules to change parameters while virtual machines are running; verify persistent configuration after a planned reboot. For Intel, use kvm_intel to enable it temporarily.
sudo modprobe kvm_amd nested=1
Make It Persistent
sudo vim /etc/modprobe.d/kvm_amd.conf
Add the following
options kvm_amd nested=1
Regenerate
sudo mkinitcpio -P
Configure Bridged Networking
Wired interfaces can join an ordinary bridge; most Wi-Fi station connections cannot be bridged in the same way. Switching connections interrupts networking, so save the current configuration first.
- Launch the advanced network configuration tool
nm-connection-editor
# 添加虚拟网桥,接口填bridge0或者别的
# 添加网桥连接,选择以太网,选择网络设备
# 保存后将网络连接改为刚才创建的以太网网桥连接
Install a Windows 11 Virtual Machine
A Step-by-Step Guide to Reinstalling Your Laptop's Operating System (Windows Edition) - bilibili A Surprise Arrival: The Official Streamlined Win11 LTSC Edition Is Finally Here - Zhihu
- Download the win11 iot LTS ISO image
https://go.microsoft.com/fwlink/?linkid=2270353&clcid=0x409&culture=en-us&country=us
- Download the virtiowin11 ISO
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.271-1/virtio-win-0.1.271.iso
按获得授权的安装介质和当前虚拟机向导安装,选择 UEFI 与所需 TPM 设备。
Choose the display protocol, VirtIO graphics device, and OpenGL acceleration based on host and guest driver support. Do not treat virtio 3D support for Windows as guaranteed or make absolute judgments based on GPU brand. For high-performance Windows graphics, investigate GPU passthrough.
- Skip the network requirement: ensure the machine is disconnected from the network, press Shift+F10, click the window, and enter
oobe\bypassnro # 历史版本的可选 OOBE 操作,当前 Windows 版本可能已移除
- Share files with the host: How to Share Folders Between a Linux Host and a Windows Guest in KVM | Linux China - Zhihu
确认开启共享内存
打开文件管理器,复制要共享的文件夹的路径
在虚拟机管理器内添加共享文件夹,粘贴刚才复制的路径,取个名字
虚拟机内win11安装winFSP
https://winfsp.dev/rel/
搜索service(服务),启用VirtIO-FS Service,设置为自动
GPU Passthrough
PCI passthrough via OVMF - ArchWiki
- Check whether iommu is enabled; output indicates it is enabled
sudo dmesg | grep -e DMAR -e IOMMU
- Obtain the GPU's hardware ID and record the IDs of every device in its group. If the group contains a CPU, consult the wiki.
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
printf 'IOMMU Group %s ' "$n"
lspci -nns "${d##*/}"
done
- Isolate the GPU
sudo vim /etc/modprobe.d/vfio.conf
Add the following content
options vfio-pci ids=EXAMPLE_GPU_ID,EXAMPLE_AUDIO_ID
- Load vfio-pci first
sudo vim /etc/mkinitcpio.conf
Add vfio_pci vfio vfio_iommu_type1 inside MODULES=()
MODULES=(... vfio_pci vfio vfio_iommu_type1 ...)
Add modconf inside HOOKS=()
HOOKS=(... modconf ...)
- Regenerate
sudo mkinitcpio -P
Reboot the computer, then install ovmf
sudo pacman -S edk2-ovmf
Edit the configuration file
sudo vim /etc/libvirt/qemu.conf
# 在 virt-manager 中选择 edk2-ovmf 提供的 UEFI 固件
# 不复制旧发行版 OVMF 文件路径;为每台客体保留独立 NVRAM VARS
Restart the service
sudo systemctl restart libvirtd
On the virtual machine's page in virt-manager, add hardware and find the GPU to pass through under PCI Host Device. Then pass through the mouse and keyboard under USB hostDevice as well.
- Undo GPU Passthrough
sudo vim /etc/modprobe.d/vfio.conf
Comment out the contents
sudo mkinitcpio -P
重启
Gaming on Linux#
This section applies to Windows applications as well as Windows games. Prefer Steam for games, and manage games unavailable on Steam with Lutris, using Proton or Wine to run them. Use Waydroid for Android mobile games. If none of these works, play in a win11 virtual machine configured with GPU passthrough.
Playing Steam Games
sudo pacman -S steam
Choose the default compatibility tool under Settings → Compatibility to run most games without anti-cheat
Playing Android Mobile Games
waydroid
Install Instructions | Waydroid Waydroid - Arch Linux Chinese Wiki Android uses the Linux kernel, but graphics, Binder, architecture, and hardware integration still limit compatibility and performance. Waydroid is an Android container on Linux, effectively providing a complete Android system.
- Install
sudo pacman -S waydroid
Optional: install waydroid-image from archlinuxcn (requires adding the cn repository, which the tutorial's procedure already added in the yay installation section)
sudo pacman -S waydroid-image
# 带谷歌play的
sudo pacman -S waydroid-image-gapps
- Initialize
sudo waydroid init
# 带谷歌的
sudo waydroid init -s GAPPS
- Start the service
sudo systemctl enable --now waydroid-container.service
- Install ARM translation: GitHub - casualsnek/waydroid_script: Python Script to add OpenGapps, Magisk, libhoudini translation library and libndk translation library to waydroid ! Translation may be necessary to run applications containing only ARM native code on an x86_64 system. Translation tools are additional third-party components; check compatibility and licensing requirements rather than choosing solely by CPU brand.
# 第三方转译安装示例,先审阅项目及依赖;不是 Waydroid 必需步骤
sudo pacman -S lzip
git clone https://github.com/casualsnek/waydroid_script
cd waydroid_script
python3 -m venv venv
venv/bin/pip install -r requirements.txt
sudo venv/bin/python3 main.py
按照窗口的指引进行安装
- Start
waydroid session start
You should then see many icons on the desktop
- Install Applications
waydroid app install /path/to/example.apk
- Applications open fullscreen by default; you can configure them to open in windows
Uninstall Waydroid
waydroid session stop
sudo systemctl disable --now waydroid-container.service
sudo pacman -Rns waydroid #如果下载了waydroid-image的话需要一并删除
# 可选清理:这些目录含应用数据,确认已备份且路径正确后才删除
# sudo rm -rf -- /var/lib/waydroid
# rm -rf -- ~/.local/share/waydroid
# 逐个检查并删除对应 desktop 入口,避免未经检查的通配符
Running Applications with the Wine/Proton Compatibility Layer
Wine is a compatibility layer for running Windows programs on Linux. Proton is a gaming-focused compatibility layer developed from Wine by Valve, the company behind Steam. It works by translating requests made by Windows programs into equivalent requests on Linux. Usually, the latest Wine or Proton version is sufficient.
lutris
Download Lutris Lutris is a tool designed specifically for gaming, making it easy to manage software that needs the Wine or Proton compatibility layer. Lutris can manage standalone games and runners; its integration features differ from Steam's non-Steam game entries.
- Install
sudo pacman -S lutris
- The first launch automatically downloads the required components
- Uninstall
sudo pacman -Rns lutris
# 可选清理会删除设置、运行器与本地游戏管理数据,先备份并逐项检查
# rm -rf -- ~/.config/lutris ~/.cache/lutris ~/.local/share/lutris
# 在 ~/.local/share/applications/ 中只删除已确认属于 Lutris 的入口
After Steam downloads Proton, you can set the Wine version to Proton in Lutris
Gaming with GPU Passthrough
GPU passthrough gives the guest direct use of a dedicated GPU, but compatibility still depends on drivers, reset behavior, IOMMU, anti-cheat, and licensing requirements. Do not assume every game will run; retain working display and input devices for the host during testing.
Official References for Verification#
ArchWiki: PCI passthrough via OVMF.
Official Waydroid installation instructions.
References & further reading
- Original tutorial: shorinkiwata/archlinuxinstall ↗
- ArchWiki: Libvirt ↗
- ArchWiki: PCI passthrough via OVMF ↗
- ArchWiki: Waydroid ↗
- ArchWiki: Steam ↗
- Official Waydroid installation instructions ↗
Adapted from technical notes. Examples use generic names.
Continue along a reading path
Arch Linux
- 01Arch Linux philosophy and installation planning
- 02Kernel management, systemd-boot, and UKIs
- 03Pacman hooks, the AUR, and build security
- 04Btrfs subvolume layouts and Snapper snapshots
- 05Hardening with LUKS2, Secure Boot, and TPM2
- 06Performance choices and an everyday maintenance checklist
- 07Common Pacman commands and how to remember their flags
- 08Diagnosing slow Pacman downloads and choosing mirrors
- 09informant: Arch news and Pacman hooks
- 10Arch Linux with Btrfs: manual installation and archinstall
- 11Configuring GNOME, input methods, and snapshots
- 12GNOME laptop management and desktop customization
- 13KVM, GPU passthrough, and gaming on Arch Linux
- 14Swap, kernels, and troubleshooting on an Arch desktop