遇到问题不要慌, 打开文档来看看.
背景
Microsoft Windows [版本 10.0.19044.1766].
或 Microsoft Windows [版本 10.0.22000.832].
Linux WSL-PC 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 22.04
由于 wsl 命令行 (wsl --list --online
) 中还没有, 需要手动下载, 或在 MS Store 中下载.
- https://docs.microsoft.com/en-us/windows/wsl/install-manual
- https://apps.microsoft.com/store/detail/ubuntu-2204-lts/9PN20MSR04DW
needrestart
Failed to retrieve available kernel versions.
Failed to check for processor microcode upgrades.
参考 failed-to-retrieve-available-kernel-versions-failed.
删除之.
name resolution
Temporary failure in name resolution.
参考 https://www.cnblogs.com/james-wangx/p/14848069.html.
确保 /run/resolvconf 目录已被删除, 再删除 /etc/resolv.conf 文件, 重新创建 /etc/resolv.conf
还有一个情况,generateResolvConf=false
下,每次重启 /etc/resolv.conf 都会丢失。
参考 https://github.com/microsoft/wsl/issues/5420.
sudo chattr +i /etc/resolv.conf
/etc/wsl.conf [boot]
在 Win10 不支持, 会导致错误.
ERROR: Systemd is not running. Please terminate this instance by running "wsl -t " from Windows shell and try again.
出现此错误, 可以先修改 default-user 为 root, 启动该distro后, 在 Win 中修改 \\wsl$\Ubuntu-22.04\etc\wsl.conf
.
snap
既然开机启动 /usr/libexec/wsl-systemd
不行, 要寻求其他方法.
若可以启动,后续可参考以下链接:
- https://github.com/ubuntu/wsl-setup
- https://github.com/microsoft/WSL/issues/5126#issuecomment-1111957720