码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu apt-get update 失败解决

时间:2018-11-14 15:39:30      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:pre   nss   设置   and   index   pen   修改dns   com   hand   

转自:https://blog.csdn.net/ronghua_liu/article/details/8609450


 

当运行apt-get update后出现如下错误时:
E: Some index files failed to download, they have been ignored, or old ones used instead.

可以将目录下/var/lib/apt/lists/partial/所有的文件清掉,再次运行apt-get update即可!自带源在大陆不好。

 

出现以下错误:

1 E: 下载 http://mirrors.aliyun.com/ubuntu/pool/main/o/openssh/openssh-server_7.2p2-4ubuntu2.4_i386.deb  暂时不能解析域名“mirrors.aliyun.com” 失败
2 
3 E: 下载 http://mirrors.aliyun.com/ubuntu/pool/main/s/ssh-import-id/ssh-import-id_5.5-0ubuntu1_all.deb  暂时不能解析域名“mirrors.aliyun.com” 失败

修改DNS后可以正常更新并install软件:

1.sudo vi /etc/resolvconf/resolv.conf.d/base(这个文件默认是空的)

在里面插入:
nameserver 8.8.8.8
nameserver 8.8.4.4

如果有多个DNS就一行一个

修改好保存,然后执行

sudo resolvconf -u

再看/etc/resolv.conf,最下面就多了2行:

cat /etc/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 8.8.8.8
nameserver 8.8.4.4

可以看到我们的设置已经加上了,然后再ping一个域名,当时就可以解析了,无需重启。

 

ubuntu apt-get update 失败解决

标签:pre   nss   设置   and   index   pen   修改dns   com   hand   

原文地址:https://www.cnblogs.com/guanjian/p/9957984.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!