WSL报错Error code: Wsl/Service/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED解决

目录

解决方案

尝试升级wsl:

尝试开启Virtual Machine Platform

尝试重启Hyper-V服务

 查看hypervisor launch状态

VSCode安装WSL

WSL常用命令


VSCode安装wsl1后升级wsl2一直不成功,报错如下:

WSL2 is not supported with your current machine configuration.
Please enable the "Virtual Machine Platform" optional component and ensure virtualisation is enabled in the BIOS.
Enable "Virtual Machine Platform" by running: wsl.exe --install --no-distribution
For information please visit https://aka.ms/enablevirtualization
Error code: Wsl/Service/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED

解决方案

  • 尝试升级wsl:

wsl --update

如果安装的是wsl1,默认安装的OS版本也会是1,所以考虑先升级wsl后再指定OS版本;

  • 尝试开启Virtual Machine Platform

Control Panel > Programs > Turn Windows features on or off > Tick Virtual Machine Platform > Ok > Restart
  • 尝试重启Hyper-V服务

Control Panel > Programs > Turn Windows features on or off > Untick Hyper-V > Ok > Restart
Control Panel > Programs > Turn Windows features on or off > Tick Hyper-V > Ok > Restart
  • 查看hypervisor launch状态

bcdedit /enum | findstr -i hypervisorlaunchtype
if hypervisorlaunchtype is Off, then
bcdedit /set hypervisorlaunchtype Auto
restart

VSCode安装WSL

VSCode > Extensions > Remote Development安装;

 PowerShell 运行 wsl --install 开始安装支持组件;

运行 wsl.exe --install --no-distribution 安装其他默认组件;

运行 wsl --list --online or wsl -l -o 查看在线版本;

运行 wsl --install -d Ubuntu 安装Ubuntu的distro。

左下角Open a Remote Window - Connect to WSL using Distro...

WSL常用命令

// PowerShell -> Run as administrator

wsl --install // 安装Windows Subsystem for Linux组件,不是安装指定distro的OS系统

wsl --list --online | wsl -l -o //a list of available distros

wsl --install -d <DistroName> //install a distro

wsl -l -v // list your installed Linux distributions and its version

wsl --set-default-version <Version#> // set the default version to WSL 1 or WSL 2

wsl --set-default <DistributionName> | wsl -s <DistributionName> // set the default Linux distribution

wsl --set-version <distro name> 2 // upgrade version from WSL 1 to WSL 2

wsl --unregister // unregisters the distribution and deletes the root filesystem.

Docker Desktop - Unexpected WSL error An unexpected error occurred while executing a WSL command. Either shut down WSL down with wsl --shutdown, and/or reboot your machine. You can also try reinstalling WSL and/or Docker Desktop. If the issue persists, collect diagnostics and submit an issue ⁠. deploying WSL2 distributions ensuring main distro is deployed: deploying "docker-desktop": importing WSL distro "WSL2 is not supported with your current machine configuration.\r\nPlease enable the \"Virtual Machine Platform\" optional component and ensure virtualization is enabled in the BIOS.\r\nEnable \"Virtual Machine Platform\" by running: wsl.exe --install --no-distribution\r\nFor information please visit https://aka.ms/enablevirtualization\r\nError code: Wsl/Service/RegisterDistro/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED\r\n" output="docker-desktop": exit code: 4294967295: running WSL command wsl.exe C:\WINDOWS\System32\wsl.exe --import docker-desktop <HOME>\AppData\Local\Docker\wsl\main C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar --version 2: WSL2 is not supported with your current machine configuration. Please enable the "Virtual Machine Platform" optional component and ensure virtualization is enabled in the BIOS. Enable "Virtual Machine Platform" by running: wsl.exe --install --no-distribution For information please visit https://aka.ms/enablevirtualization Error code: Wsl/Service/RegisterDistro/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED : exit status 0xffffffff checking if isocache exists: CreateFile \\wsl$\docker-desktop-data\isocache\: The network name cannot be found.
最新发布
03-31
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值