1. 程式人生 > >Ubuntu 14.10執行apt-get update失敗

Ubuntu 14.10執行apt-get update失敗

一、問題描述:

因為經常使用apt-get命令安裝所需要的開發軟體,但經常由於連結不上軟體源不能正常安裝,於是就是用sudo apt-get update命令來更新軟體源,但這條更新命令也經常不能正常使用,出現大量的錯誤:W: Failed to fetch ***  404  Not Found ***。下面是我在虛擬機器Ubuntu 14.10 i386上更新軟體源失敗的詳細資訊:

[email protected]:~$ sudo apt-get update
[sudo] password for sktbj: 
Ign http://security.ubuntu.com utopic-security InRelease                       
Ign http://security.ubuntu.com utopic-security Release.gpg                     
Ign http://extras.ubuntu.com utopic InRelease                                  
Ign http://security.ubuntu.com utopic-security Release         
Get:1 http://extras.ubuntu.com utopic Release.gpg [72 B]       
Hit http://extras.ubuntu.com utopic Release                                    
Hit http://extras.ubuntu.com utopic/main Sources                               
Hit http://extras.ubuntu.com utopic/main i386 Packages                         
Ign http://us.archive.ubuntu.com utopic InRelease                              
Ign http://us.archive.ubuntu.com utopic-updates InRelease            
Ign http://us.archive.ubuntu.com utopic-backports InRelease          
Ign http://us.archive.ubuntu.com utopic Release.gpg                  
Ign http://us.archive.ubuntu.com utopic-updates Release.gpg          
Ign http://us.archive.ubuntu.com utopic-backports Release.gpg        
Ign http://us.archive.ubuntu.com utopic Release                      
Ign http://us.archive.ubuntu.com utopic-updates Release              
Ign http://extras.ubuntu.com utopic/main Translation-en_US           
Ign http://us.archive.ubuntu.com utopic-backports Release            
Ign http://extras.ubuntu.com utopic/main Translation-en              
Err http://security.ubuntu.com utopic-security/main Sources                    
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/restricted Sources
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/universe Sources
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/multiverse Sources
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/main i386 Packages
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/restricted i386 Packages
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/universe i386 Packages
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/multiverse i386 Packages
  404  Not Found [IP: 91.189.88.149 80]
Ign http://security.ubuntu.com utopic-security/main Translation-en_US
Ign http://security.ubuntu.com utopic-security/main Translation-en
Ign http://security.ubuntu.com utopic-security/multiverse Translation-en_US
Ign http://security.ubuntu.com utopic-security/multiverse Translation-en
Ign http://security.ubuntu.com utopic-security/restricted Translation-en_US
Ign http://security.ubuntu.com utopic-security/restricted Translation-en
Ign http://security.ubuntu.com utopic-security/universe Translation-en_US
Ign http://security.ubuntu.com utopic-security/universe Translation-en
Err http://us.archive.ubuntu.com utopic/restricted Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/main Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/universe Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/multiverse Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/main i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/restricted i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/universe i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/multiverse i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Ign http://us.archive.ubuntu.com utopic/main Translation-en_US
Ign http://us.archive.ubuntu.com utopic/main Translation-en
Ign http://us.archive.ubuntu.com utopic/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com utopic/multiverse Translation-en
Ign http://us.archive.ubuntu.com utopic/restricted Translation-en_US
Ign http://us.archive.ubuntu.com utopic/restricted Translation-en
Ign http://us.archive.ubuntu.com utopic/universe Translation-en_US
Ign http://us.archive.ubuntu.com utopic/universe Translation-en
Err http://us.archive.ubuntu.com utopic-updates/main Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/restricted Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/universe Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/multiverse Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/main i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/restricted i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/universe i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/multiverse i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Ign http://us.archive.ubuntu.com utopic-updates/main Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/main Translation-en
Ign http://us.archive.ubuntu.com utopic-updates/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/multiverse Translation-en
Ign http://us.archive.ubuntu.com utopic-updates/restricted Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/restricted Translation-en
Ign http://us.archive.ubuntu.com utopic-updates/universe Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/universe Translation-en
Err http://us.archive.ubuntu.com utopic-backports/main Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/restricted Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/universe Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/multiverse Sources
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/main i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/restricted i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/universe i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/multiverse i386 Packages
  404  Not Found [IP: 91.189.91.23 80]
Ign http://us.archive.ubuntu.com utopic-backports/main Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/main Translation-en
Ign http://us.archive.ubuntu.com utopic-backports/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/multiverse Translation-en
Ign http://us.archive.ubuntu.com utopic-backports/restricted Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/restricted Translation-en
Ign http://us.archive.ubuntu.com utopic-backports/universe Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/universe Translation-en
Fetched 72 B in 1min 8s (1 B/s)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/main/source/Sources  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/restricted/source/Sources  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/universe/source/Sources  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/multiverse/source/Sources  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/main/binary-i386/Packages  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/universe/binary-i386/Packages  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/main/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/restricted/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/universe/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/multiverse/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/main/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/universe/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/main/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/restricted/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/universe/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/multiverse/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/main/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/universe/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/main/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/restricted/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/universe/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/multiverse/source/Sources  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/main/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/universe/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.91.23 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.

二、錯誤原因:

由於Ubuntu更新換代很快,你的Ubuntu一旦不是最新版本後,其倉庫(repository)就會被轉移到另外的伺服器上面。所以不再是http://archive.ubuntu.com/ubuntu/dist/ 這裡能找到的。

三、解決方案:

你可以通過修改  /etc/apt/sources.list 來把連結指向舊的版本倉庫,使用以下例項程式碼將/etc/apt/sources.list中的所archive.ubuntu.com和security.ubuntu.com替換成old-releases.ubuntu.com:

sudo sed -i -e 's/us.archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

然後在執行更新命令:

sudo apt-get update

問題解決!