wsl

 Tue, 27-Oct-2026 11:29:21

linux镜像在C:UserschenminAppDataLocalwsl{4a7af2c6-2be1-4106-8b23-0ff5b4952719}

迁移到d盘

wsl --manage Ubuntu-26.04 --move D:wslUbuntu-26.04

 

wsl里面的linux不能上午,在powershell执行下面命令

Restart-Service -Force hns
Restart-Service -Force LxssManager
wsl --shutdown
Restart-NetAdapter -Name "vEthernet (WSL)"

 

1. Restart-Service -Force hns

2. Restart-Service -Force LxssManager

组合起来的效果

这两条命令一起执行,相当于:

  1. 先重启 WSL 的管理服务,强制所有 Linux 实例下线。

  2. 再重启 Windows 的虚拟网络服务,清空并重建 WSL 使用的虚拟网卡和 NAT 规则。

之后当你再次运行 wsl 时,WSL 会重新向 HNS 请求网络资源,从而有机会修复之前损坏的网络连接。

 

如果仍然不行,继续执行下面命令

netsh winsock reset
netsh int ip reset
ipconfig /flushdns