我正在运行 Ubuntu 14.04,并且已经sudo apt-get update
好几个月没有运行了。
当我尝试更新本地时,/etc/apt/sources.list
apt-get
可以连接到许多存储库,没有问题,但许多(可能占总数的 15%)返回这样的错误
W: Failed to fetch http://nz.archive.ubuntu.com/ubuntu/dists/trusty-backports/multiverse/binary-i386/Packages 403 Forbidden
W: Some index files failed to download. They have been ignored, or old ones used instead.
我想知道自我的机器上次联系以来存储库地址或配置是否已更改,因此我需要通过一些过程来完全刷新然后重新建立/etc/apt/sources.list
?我在想类似的事情
sudo apt-cache clean
但我不想让我的系统变得比现在更无聊。
我该如何解决这个问题403 Forbidden error
?
/etc/apt/sources.list 的当前状态
# deb cdrom:[Ubuntu 14.04 LTS _Trusty Tahr_ - Release amd64 (20140417)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://nz.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://nz.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://nz.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://nz.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://nz.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://nz.archive.ubuntu.com/ubuntu/ trusty universe
deb http://nz.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://nz.archive.ubuntu.com/ubuntu/ trusty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://nz.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://nz.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://nz.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://nz.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://nz.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://nz.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main
答案1
存储库似乎存在 GPG 关键问题http://nz.archive.ubuntu.com
:
W: GPG error: http://nz.archive.ubuntu.com trusty-backports Release: The following signatures were invalid: BADSIG 40976EAF437D05B5
要解决这个问题,您需要获取指纹的公钥40976EAF437D05B5
:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
现在sudo apt-get update
应该可以正常工作了。
作为替代解决方案,您可以使用主存储库或不同的镜像:
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
编辑:
正如 @muru 指出的,镜像存在一些问题,nz
因此您应该使用不同的存储库作为解决方案。
答案2
我刚刚生成了一个新列表http://repogen.simplylinux.ch/#,尝试包含同一组存储库。您可以自己生成它,并发现它几乎相同。
我尝试使用你的sources.list和这个在本地ubuntu安装,它们在apt-get clean和apt-update之后都工作了。即使你遇到错误的那个对我来说也很好用:
Get:79 http://nz.archive.ubuntu.com trusty-backports/multiverse i386 Packages [1552 B]
有一些没有公钥,但没有 403 错误。你试过多少次了?某些存储库是否短时间离线?