转自: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一个域名,当时就可以解析了,无需重启。