轉自: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一個域名,當時就可以解析了,無需重啟。
