喜欢还有很多其他问题,我不能跑apt-get update
有时。重新启动或等待一段时间即可解决问题。我从未遇到过 ping 或访问浏览器中相应 URL 的问题。
我尝试了所有获得支持的答案,但都无济于事。apt
这与我的浏览器有什么不同ping
?例如,当我运行时,apt-get update
我看到的是:
Err:1 https://download.docker.com/linux/ubuntu xenial InRelease
Could not resolve host: download.docker.com
Err:2 https://deb.opera.com/opera-stable stable InRelease
Could not resolve host: deb.opera.com
Err:3 http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu xenial InRelease
Could not resolve 'ppa.launchpad.net'
Err:4 http://ppa.launchpad.net/saiarcot895/myppa/ubuntu xenial InRelease
Could not resolve 'ppa.launchpad.net'
Err:5 http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu xenial InRelease
Could not resolve 'ppa.launchpad.net'
Err:6 http://repository.spotify.com stable InRelease
Could not resolve 'repository.spotify.com'
Err:7 http://dl.google.com/linux/chrome/deb stable InRelease
Could not resolve 'dl.google.com'
Err:8 http://archive.ubuntu.com/ubuntu xenial InRelease
Could not resolve 'archive.ubuntu.com'
Err:9 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Could not resolve 'archive.ubuntu.com'
Err:10 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Could not resolve 'archive.ubuntu.com'
Err:11 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/InRelease Could not resolve 'archive.ubuntu.com'
W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/xenial/InRelease Could not resolve host: download.docker.com
W: Failed to fetch http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu/dists/xenial/InRelease Could not resolve 'ppa.launchpad.net'
W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/InRelease Could not resolve 'dl.google.com'
W: Failed to fetch https://deb.opera.com/opera-stable/dists/stable/InRelease Could not resolve host: deb.opera.com
W: Failed to fetch http://ppa.launchpad.net/saiarcot895/myppa/ubuntu/dists/xenial/InRelease Could not resolve 'ppa.launchpad.net'
W: Failed to fetch http://repository.spotify.com/dists/stable/InRelease Could not resolve 'repository.spotify.com'
W: Failed to fetch http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu/dists/xenial/InRelease Could not resolve 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.
跑步ping download.docker.com
:
PING d2h67oheeuigaw.cloudfront.net (52.85.41.233) 56(84) bytes of data.
64 bytes from server-52-85-41-233.mel50.r.cloudfront.net (52.85.41.233): icmp_seq=1 ttl=251 time=18.8 ms
64 bytes from server-52-85-41-233.mel50.r.cloudfront.net (52.85.41.233): icmp_seq=2 ttl=251 time=18.4 ms
64 bytes from server-52-85-41-233.mel50.r.cloudfront.net (52.85.41.233): icmp_seq=3 ttl=251 time=19.5 ms
在我的浏览器中访问该页面时一切正常。我怎样才能让apt-get
“正常工作”?
以下是我的内容/etc/apt/resolv.conf
:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search home.gateway
答案1
从终端运行此命令,以后您就可以正常apt
使用:)apt-get
echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
答案2
如果/etc/atp/apt.conf
存在,请复制该文件,然后编辑原始文件以注释掉以下行(如果不在代理服务器后面):
Acquire::http::Proxy "http://proxyaddress:proxyport";