apt-get 命令在 Ubuntu-On-Windows / Windows 子系统上不起作用 Linux

apt-get command does not work on Ubuntu-On-Windows / Windows Subsystem for Linux

我刚刚安装了 Ubuntu-On-Windows 最近在 Windows 10 上为快速环上的人们添加了。但是,当尝试使用 apt-get 安装新应用程序时,该命令似乎每次都失败。我收到此错误:

Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://archive.ubuntu.com trusty Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'

我知道这是一个测试版,刚刚发布,但是否有解决方案?

为了解决这个问题,我运行执行了以下命令:

apt-get update && apt-get upgrade

现在它工作正常,即使我关闭并重新打开终端。

这可能是 /etc/resolve.conf. 的问题,最新的 Windows 更新解决了这个问题,因此您可以尝试更新。

我遇到了这个问题,发现所有网络都被禁用了。关闭我的 bitdefender 防火墙允许一切按预期工作。执行此操作时,标准 windows 防火墙会自动打开。

我发现这个 post that indicates bitdefender 2017 has fixed the issue, and evidence of other AV products 有类似的问题,但对我来说,我对 windows 防火墙很满意,Windows 上的 Bash 运行良好。

检查您的 Windows 或防病毒防火墙设置。您可能需要禁用它才能允许网络连接。

发现 AVG 明确具有 allowing/disallowing 防火墙访问 Ubuntu 的开关。 结果你必须进入 Firewall > Advanced Settings > Expert Settings > Advanced Settings > Allow any traffic of Windows subsystem for Linux.

只是记录一下,以防其他人正在寻找这个小复选框,就像我花了几个小时做的那样。

我遇到了 运行 sudo apt-get update 未显示任何类型的网络 activity 并因同样的错误而关闭的问题。 运行 bash 作为管理员 为我解决了这个问题。