0


windows家庭版 安装 wsl 2失败,总结

背景

windows版本

winver

或者

ver
Microsoft Windows [版本 10.0.19044.2006]

根据docker文档 https://docs.docker.com/desktop/install/windows-install/ 安装WSL2,但在设置 WSL为WSL 2时失败。原因未知。

错误提示

> wsl --set-version Ubuntu 2
正在进行转换,这可能需要几分钟时间...
有关与 WSL 2 的主要区别的信息,请访问 https://aka.ms/wsl2
请启用虚拟机平台 Windows 功能并确保在 BIOS 中启用虚拟化。
有关信息,请访问 https://aka.ms/wsl2-install

根据提示,虚拟化和安装Linux kernel后,依旧失败。

卸载

wsl --unregister Ubuntu

如果在卸载前设置过

wsl --set-default-version 2

,那么会重装失败,错误提示

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.
For information please visit https://aka.ms/enablevirtualization
Press any key to continue...

所以,将默认的distribution对应的wsl版本改回

1

,命令:

wsl --set-default-version 1

再启动会成功。

以下为安装WSL 2的步骤,仅供参考

Install WSL

参考官方文档:https://learn.microsoft.com/en-us/windows/wsl/install

wsl --install

如果弹出help信息,可直接下一步

Install distribution

查看

wsl --list --online

选择一个下载,也可通过Microsoft Store下载。命令行下载不知为何很慢。

wsl --install -d Ubuntu

Upgrade WSL to WSL2

查看WSL,以及安装distribution对应的wsl版本

wsl -l -v
> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         1

Download the linux kernel

官方文档:https://learn.microsoft.com/en-us/windows/wsl/install-manual

Linux kernal下载地址:the linux kernel download page

下载完毕,安装.msi文件。

Enable virtual machine feature

需要管理员模式下,运行命令

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart the computer

Set the distribution to WSL 2

运行命令

wsl --set-version Ubuntu 2

参考

https://blog.csdn.net/qq_33540705/article/details/112603137
https://www.ziruchu.com/art/197

标签: docker windows linux

本文转载自: https://blog.csdn.net/BS0003/article/details/127677727
版权归原作者 chyongdu 所有, 如有侵权,请联系我们删除。

“windows家庭版 安装 wsl 2失败,总结”的评论:

还没有评论