在过去的几天里,当我运行 时sudo apt-get update
,它失败了,因为有些主机无法解析。但是,我可以 ping 它们,所以它们肯定正在得到解析。我的互联网运行良好。我!
在角落里也看到了一个红色的三角形。
以下是 的输出示例apt-get
:
steve@steve-ub:~$ sudo apt-get update
Ign http://ppa.launchpad.net trusty InRelease
Hit http://ppa.launchpad.net trusty Release.gpg
Hit http://ppa.launchpad.net trusty Release
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://ppa.launchpad.net trusty/main i386 Packages
Ign http://ppa.launchpad.net trusty/main Translation-en_US
Ign http://ppa.launchpad.net trusty/main Translation-en
Err http://repo.steampowered.com precise InRelease
Err http://repo.steampowered.com precise Release.gpg
Could not resolve 'repo.steampowered.com'
Err http://archive.canonical.com trusty InRelease
Err http://extras.ubuntu.com trusty InRelease
Err http://us.archive.ubuntu.com trusty InRelease
我在这里删减了一些输出,稍后继续:
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release.gpg Could not resolve 'dl.google.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
然而,我可以 ping 无法解析的主机:
steve@steve-ub:~$ ping us.archive.ubuntu.com
PING us.archive.ubuntu.com (91.189.91.14) 56(84) bytes of data.
64 bytes from orobas.canonical.com (91.189.91.14): icmp_seq=1 ttl=49 time=59.8 ms
...
steve@steve-ub:~$ ping repo.steampowered.com
PING user-att-75-46-72-0.a1507.d.akamai.net (23.72.83.64) 56(84) bytes of data.
64 bytes from a23-72-83-64.deploy.static.akamaitechnologies.com (23.72.83.64): icmp_seq=1 ttl=56 time=20.8 ms
我怎样才能使更新再次正常运行?
答案1
如果这是远程服务器,请尝试添加 Google DNS 服务器,看看是否有帮助。在终端上:
sudo nano /etc/resolv.conf or nano /etc/resolv.conf
然后加
nameserver 8.8.8.8
nameserver 8.8.4.4
选择“是”并退出Ctrl x。
再次运行更新。
sudo apt-get update && sudo apt-get upgrade
或者
apt-get update && apt-get upgrade