情况:

WSL2 Ubuntu apt-get update失败

这个问题在github上也有讨论:https://github.com/microsoft/WSL/issues/4342

不过经过我的尝试,是DNS问题,这是默认的配置:

WSL2 Ubuntu apt-get update失败

这个配置来自windows为WSL的虚拟ip地址:

WSL2 Ubuntu apt-get update失败

解决方案是将DNS server更换为google的8.8.8.8。

直接修改的会发有如下问题:

WSL2 Ubuntu apt-get update失败

 使用nano修改:

WSL2 Ubuntu apt-get update失败

 WSL2 Ubuntu apt-get update失败

 Ctrl+X退出,Y确认,回车返回。

再次查看:

WSL2 Ubuntu apt-get update失败

 修改成功了。

我们重新运行apt-get update

WSL2 Ubuntu apt-get update失败

 OK。

 

相关文章:

  • 2022-12-23
  • 2021-04-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-14
  • 2021-12-21
  • 2021-06-16
  • 2021-09-13
  • 2021-05-30
  • 2021-11-01
相关资源
相似解决方案