Apt

Ubuntu14.04 - 無法 apt-get 更新

  • July 9, 2018
sudo apt-get update

返回一些錯誤:

W:無法獲取 http://archive.ubuntu.com/ubuntu/dists/trusty/Release 無法在發布文件中找到預期的條目 ‘restricted/source/Sources’(錯誤的 sources.list 條目或格式錯誤的文件)

W:無法獲取 http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages 雜湊和不匹配

W:無法獲取 http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages 雜湊和不匹配

W:無法獲取 http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/binary-i386/Packages 雜湊和不匹配

W:無法獲取 http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/i18n/Translation-en 雜湊和不匹配

E: 部分索引文件下載失敗。它們已被忽略,或者使用舊的。

它似乎發生在 ubuntu 官方回購中。知道為什麼嗎?

有關資訊,我的 sources.list 如下:

#----------------------------------------------------------#
#      OFFICIAL UBUNTU REPO                                #
#----------------------------------------------------------#


###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse

###### Ubuntu Update Repos
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-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 Partner Repo
deb http://archive.canonical.com/ubuntu trusty partner
deb-src http://archive.canonical.com/ubuntu trusty partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main

#------------------------------------------------------------------------------#
#                           UNOFFICIAL UBUNTU REPOS                            #
#------------------------------------------------------------------------------#


###### 3rd Party Binary Repos

#### MongoDB - http://www.mongodb.org/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

問題可能來自您的 /etc/resolv.conf 文件,檢查您是否有一些nameserver指令並嘗試 ping archive.ubuntu.com

這是我的 resolv.conf :

domain local
search local

nameserver 8.8.8.8
nameserver 8.8.4.4

我使用Google的公共 dns ( https://developers.google.com/speed/public-dns/ )

然後嘗試 apt-get update

它檢測到它獲得的一些文件已過時或損壞,因此它們無法使用。刪除記憶體文件,rm -rf /var/lib/apt/lists/*然後重試apt-get update.

如果問題仍然存在,則某處的記憶體代理可能仍在保存舊的或損壞的內容。apt-get update -o Acquire::http::No-Cache=True在這種情況下可能會有所幫助。

引用自:https://serverfault.com/questions/717226