E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


問題描述:

  多次在apt install時候遇到E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 的error。

  Error報的信息顯示是這個包向source里的資源下載失敗了,但是原因是多種多樣的,這里做了個總結,以防下次踩坑:

  

  ······

  

問題解決:

  1- source本身的問題

  根據提示,我們首先應當 apt-get update 一下source,如果在apt-get update后依然報這個error,那就說明這個source本省就有錯誤,嘗試apt-get update --fix-missing后依舊報這個error,果斷換source。

  輸入命令:

sudo cp sources.list sources.list.bak

  就是先將sources.list備份到sources.list.bak

  將 /etc/apt/sources.list 的內容換成:

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

  更多源請參考:https://www.cnblogs.com/X-knight/p/10598498.html

  最后sudo apt-get update一下就OK了。

  2- 網絡的問題

  網關錯誤攔截了數據包或者防火牆故意將其屏蔽在外(比方update 包含有google-chrome瀏覽器的source時候,ip 會自動重定向至6.6.6.6) 

 sudo vim /etc/resolv.conf

添加:

nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 223.6.6.6

  或是換網絡試一下或者參見該配置代理即可。

  最后sudo apt-get update一下就OK了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM