官方文档

硬件加速渲染

pacman -S mesa vulkan-dzn vulkan-icd-loader
# ~/.bashrc
export GALLIUM_DRIVER=d3d12
export LIBVA_DRIVER_NAME=d3d12

若 openGL 依然在英特尔 GPU 上使用 llvmpipe 软件渲染,则需要为 libedit 创建符号链接:

# ln -s /usr/lib/libedit.so /usr/lib/libedit.so.2

从 Windows 桥接 SSH 代理服务

在 WSL 内使用 Windows SSH 代理

安装yay

sudo pacman -S git base-devel
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
cd yay
makepkg -si
yay wsl2-ssh-agent
eval "$(/usr/sbin/wsl2-ssh-agent)"

使用 Windows Hello 进行 PAM 认证

踩坑后让AI生的手动安装指南,成功力!

yay wsl-hello-sudo-bin

欲使用 Windows Hello 进行认证,将 auth sufficient pam_wsl_hello.so 行添加到 /etc/pam.d 中相应组件的配置文件,例如 Sudo:

/etc/pam.d/sudo
#%PAM-1.0
auth            sufficient      pam_wsl_hello.so
auth            include         system-auth
account         include         system-auth
session         include         system-auth

启用 允许执行Windows命令:

# 挂载 binfmt_misc 并注册 Windows 可执行文件格式
sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
echo ':DOSWin:M::MZ::/init:' | sudo tee /proc/sys/fs/binfmt_misc/register

# 验证 Interop 是否生效(执行 Windows 的 cmd.exe)
/mnt/c/Windows/System32/cmd.exe /C echo "Interop OK"
# 输出 "Interop OK" 则成功;若报错,重启 WSL 后重试

配置中文 locale 环境

sudo locale-gen zh_CN.UTF-8

编辑系统环境变量配置文件:

#/etc/profile
sudo -i
bash
export LANG=zh_CN.UTF-8 
export LC_ALL=zh_CN.UTF-8" 

安装中文字体

yay wqy-microhei ttf-noto-sans-cjk