2014年2月26日 星期三

[Ubuntu] 如何解決 apt-get update 的 failed to fetch 錯誤

有時因為 Server 掛掉的關係,會導致在執行 apt-get update 或是 upgrade 時,出現 "failed to fetch" 的錯誤。
這個時候你可以在伺服器模式或圖形界面,自己去更新 apt-get 的 Server 列表,換成可用的 Server。


Steps: (Shell mode)

  1. Backup /etc/apt/sources.list
  2. sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak


  3. Update contents of sources.list
    1. Configure sources.list
    2. sudo vi /etc/apt/sources.list

    3. Replace "tw.archive.'Ubuntu'.com" with "us.archive.'Ubuntu'.com"
    4. :1,$s/tw/us/g

    5. Save and quit
    6. :wq


  4. Re-synchronize the package index files from their sources.
  5. sudo apt-get update


Steps: (Desktop mode)

  1. Open the Update Manager

  2. Go to "Settings ..."

  3. Go to tab "'Ubuntu' Software"

  4. Open "Download from:"

  5. You could manual choose a server from list or let system auto select a server (by press "Select Best Server").


以上兩種方法擇一,皆可解決 "failed to fetch" 的錯誤。



References:

沒有留言:

張貼留言