Ubuntu “Failed to fetch”错误的解决方法

操做系统Ubuntu 12.04 LTSubuntu


Ubuntu操做系统中,使用apt-get命令安装所需的开发软件很是方便,但也有很多时候因为连接不上软件源而不能正常安装,因而不少人都会想到使用sudo apt-get update命令来更新软件源,而偏偏这时屋漏偏逢连夜雨,更新命令也不能正常工做,出现大量“Failed to fetch”的错误。   
vim


W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise-updates/main/binary-i386/Packages  Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname)

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise-updates/restricted/binary-i386/Packages  Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname)

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise-updates/universe/binary-i386/Packages  Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname)

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise-updates/multiverse/binary-i386/Packages  Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname)

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise-updates/main/i18n/Translation-en_US  Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname)

其实,解决这个问题十分简单,只要设置稳当 DNS 服务器便可.

$ sudo vim /etc/resolv.conf
修改DNS:

nameserver 8.8.8.8服务器

nameserver 8.8.4.4网络

而后重启网络服务:sudo etc/init.d/networking restartapp

再次执行sudo apt-get update命令,结果一切正常。
fetch


我按照这个改了以后发现依然不行,后来点击连接进入该连接的上一级目录,发现是该目录下没有所请求的资源,而不是网络的问题。spa