1. 程式人生 > >Linux - Ubuntu下執行apt-get update報錯:Some index files failed to download. They have been ignored, or old ones used instead.

Linux - Ubuntu下執行apt-get update報錯:Some index files failed to download. They have been ignored, or old ones used instead.

報錯命令

root@ubuntu:/etc/apt# apt-get update
Err:1 http://mirrors.aliyun.com/ubuntu trusty InRelease
  Could not resolve 'mirrors.aliyun.com'
Err:2 http://mirrors.aliyun.com/ubuntu trusty-backports InRelease
  Could not resolve 'mirrors.aliyun.com'
Err:3 http://mirrors.aliyun.com/ubuntu trusty-proposed InRelease
  Could not resolve 'mirrors.aliyun.com'
Err:4 http://mirrors.aliyun.com/ubuntu trusty-security InRelease
  Could not resolve 'mirrors.aliyun.com'
Err:5 http://mirrors.aliyun.com/ubuntu trusty-updates InRelease
  Could not resolve 'mirrors.aliyun.com'
Reading package lists... Done
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/trusty/InRelease  Could not resolve 'mirrors.aliyun.com'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/trusty-backports/InRelease  Could not resolve 'mirrors.aliyun.com'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/trusty-proposed/InRelease  Could not resolve 'mirrors.aliyun.com'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/trusty-security/InRelease  Could not resolve 'mirrors.aliyun.com'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/trusty-updates/InRelease  Could not resolve 'mirrors.aliyun.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

 

報錯原因

解析域名不對

 

解決方案

vim /etc/systemd/resolved.conf

dns改成8.8.8.8

 

 

儲存,重啟機器即可

&n