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

操作系统Ubuntu 12.04 LTS


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


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 restart

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


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


  

  • 11
    点赞
  • 47
    收藏
    觉得还不错? 一键收藏
  • 25
    评论
评论 25
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值