ubuntu 更新源 或者 apt-get install 出錯404 not found ,Failed to fetch


1.考慮是不是能上網

 

2.用apt-get update ,然后再試試apt-get install

如果apt-get update 也出現很多 404 not found 或者 failed to fetch ,就要考慮更換自己的源,百度搜 /etc/apt/sources.list

3.如果還不行,估計是Ubuntu版本太老了,沒有維護的了。

比如我用11.04,sudo apt-get install open-vm-dkms 不行,sudo apt-get  update  不行,就死活不行,猜測是版本太老了。?。

 

也可以參考該文

http://www.tuicool.com/articles/EjMJNz

轉載如下:

關於ubuntu的sources.list總結

一、作用

文件/etc/apt/sources.list是一個普通可編輯的文本文件,保存了ubuntu軟件更新的源服務器的地址。和sources.list功能一樣的是/etc/apt/sources.list.d/*.list(*代表一個文件名,只能由字母、數字、下划線、英文句號組成)。sources.list.d目錄下的*.list文件為在單獨文件中寫入源的地址提供了一種方式,通常用來安裝第三方的軟件。

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

如上是ubuntu官方sources.list文件內容,具體地含義如下:

每一行的開頭是deb或者deb-src,分別表示直接通過.deb文件進行安裝和通過源文件的方式進行安裝。

deb或者deb-src字段之后,是一段URL,之后是五個用空格隔開的字符串,分別對應相應的目錄結構。在瀏覽器中輸入http://archive.ubuntu.com/ubuntu/,並進入dists目錄,可以發現有5個目錄和前述sources.list文件中的第三列字段相對應。任選其中一個目錄進入,可以看到和sources.list后四列相對應的目錄結構。

更多內容可以使用man source.list獲得。

二、源的選擇

ubuntu官方有自身的軟件源,直接從官方的軟件源獲取數據的速度比較慢。而通過國內的一些的源的鏡像進行更新一般能夠獲得比官方源更快的速度,不過不同國內的源的下載速度也會不一樣。 這里 給出了較為詳細的ubuntu軟件源列表,個人現在覺得選取ubuntu軟件源的方法是首先選擇位於相同地區的源,然后進行ping操作,時延不是太高即可。對比aliyun、sohu、ubuntu官方ping的數據,可以發現aliyun的源在時延上表現最好。

三、使用sudo apt-get install出現404 not found問題的原因和解決

最近在12.10上使用sudo apt-get install命令時,出現了404 not found的問題,此時ping archive.ubuntu.com可以ping通,在http://archive.ubuntu.com/ubuntu/dists/ 目錄下已經沒有quantal相關目錄。具體原因是ubuntu對12.10的維護時間不超過一年,超過了相應的時間之后,對應的源的文件都轉移到了http://old-releases.ubuntu.com/ubuntu/dists/  目錄下。ubuntu發布的版本可以從 這里 看到,從中一方面可以看到ubuntu數字版本號和英文名稱的對應關系,也可以看到以04結尾的版本LTS標識,標識長期維護,這些版本的源在archive.ubuntu.com中呆的時間就比較長。

解決方法:

1)使用gedit將sources.list文件打開

sudo gedit /etc/apt/sources.list

2)進入替換界面(Search->Replace或者ctrl+H)進行替換操作

四、直接安裝deb文件的方法

1)下載一個deb格式的軟件kismet

curl https://www.kismetwireless.net/code/dists/quantal/kismet/binary-i386/kismet-2011.03.2.i386.deb >kismet-2011.03.2.i386.deb

2)安裝kismet

dpkg -i kismet-2011.03.2.i386.deb

3)根據提示安裝相關包

sudo apt-get install libnl2

五、參考材料

[1] repository - How do you tell apt to use files in /etc/apt/sources.list.d - Ask Ubuntu

[2] 源列表 - Ubuntu中文

[3] Releases - Ubuntu Wiki

[4] How to fix Ubuntu/Debian apt-get 404 Not Found Package Repository Errors (Saucy, Raring, Quantal, Oneiric, Natty…) | sMyl.es

[5] How do I install a .deb file via the command line  askubuntu

[6] Ubuntu .deb包安裝方法 - 程序生活 - 博客頻道 - CSDN.NET


免責聲明!

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



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