- 要使用 systemd,首先需确保运行的是来自 Microsoft Store 且版本号为 0.67.6 及以上版本的 WSL,用户可以运行
wsl --version
来检查版本号。 - 其次需要在 Ubuntu 实例中,将以下修改内容添加到
/etc/wsl.conf
中:
[boot]
systemd=true
- 然后通过在 PowerShell 中运行
wsl --shutdown
来重启实例,并重新启动 Ubuntu
wsl --version
来检查版本号。/etc/wsl.conf
中:[boot]
systemd=true
wsl --shutdown
来重启实例,并重新启动 Ubuntu