解决wsl闪退的问题

1,588 阅读1分钟

使用过vmware 再开启wsl2闪退处理

使用了一次VMware,重新开启hyper-v和虚拟化,打开wsl2时,发现Ubuntu-18.04闪退
powershell里面执行

wsl

报错:

请启用虚拟机平台 Windows 功能并确保在 BIOS 中启用虚拟化。

回溯开启VMware兼容步骤,解决问题:

开启vmware需要关闭hyper-v
所以我们如果重新开启wsl2时要:

在windows功能中重新勾选hyper-v

重启,

然后开启hyper-v模式
在管理员powershell中执行

bcdedit /set hypervisorlaunchtype auto

如果禁用了组策略里面的Device Guard虚拟化安全设置,
需要打开组策略管理,
本地计算机策略 > 计算机配置 > 管理模板>系统 > Device Guard
打开 基于虚拟化的安全设置为“已开启”或者“未设置”

wsl安装ubuntu20.04开启systemctl

  1. 下载并运行最新的安装程序脚本。
curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh" chmod +x install.sh 
sudo ./install.sh install。
  1. 在发行版中启用Distrod
/opt/distrod/bin/distrod enable --start-on-windows-boot

否则

/opt/distrod/bin/distrod enable

如果要在以后启用自动启动,则可以再次运行 with 。enable--start-on-windows-boot

  1. 重新启动发行版
wsl --terminate Distrod

安装完毕后,可以运行以下命令进行查询

systemctl status | cat