启动
常见问题
- Windows文件管理器直接访问wsl2内容器系统文件夹
- wsl2内访问Windows文件
- 使用主机代理
- 无法升级到2或者systemd无法使用
- 需要用管理员权限打开cmd运行
wsl --update
- 让同网络其他设备访问指定wsl2暴露的端口
- 首先设置服务listen 0.0.0.0:port
- wsl2中
ip addr | grep eth0找到wsl2的虚拟ip(这个ip每次重启wsl2都会再分配)
- CMD中设置
netsh interface portproxy add v4tov4 listenport=port connectaddress=ip_address connectport=port来进行一次端口转发(netsh interface portproxy delete v4tov4 listenport=port取消转发)
- SSH访问时报错
Wsl/Service/CreateInstance/CreateVm/HCS/HCS_E_SERVICE_NOT_AVAILABLE ^9ce3c4
- 启动的前提是VMP和WSL在Windows中已经启动(但好像远程的这俩状态和物理机上操作时并不一样?)
- 切换成Power Shell:
powershell.exe(需要管理员权限)
- 检查VMP状态:
dism /online /get-featureinfo /featurename:VirtualMachinePlatform
- 启用WSL和VMP:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- 重启
- 启动WSL