Ubuntu 解决:当执行`sudo apt-get update`命令时 出现的 “apt-get 404 Not Found Package Repository Errors” 问题

时间:2022-04-30 12:46:07

Ubuntu 解决:当执行sudo apt-get update或者sudo apt-get install命令是出现的 “apt-get 404 Not Found Package Repository Errors” 问题 和 “E: Some index files failed to download They have been ignored, or old ones used” 问题

当你执行sudo apt-get update命令的时候,如果你遇到下面的问题:

W: The repository 'http://ppa.launchpad.net/ackondro/tibesti/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/ackondro/tibesti/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

或者

W: The repository 'http://ppa.launchpad.net/ackondro/tibesti/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/ackondro/tibesti/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

解决方法

首先,我们将现在出问题的 /etc/apt/sources.list 文件备份一份。(只是一个好习惯而已)

sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

注: /etc/apt/sources.list 文件 里面存放的是 Linux系统需要的软件源的网站。

接着,我们重新编写一个 /etc/apt/sources.list 文件:

sudo gedit /etc/apt/sources.list

将下面的模板内容,复制粘贴到 /etc/apt/sources.list 文件里面后,保存就可以了:(我们使用的Ubuntu 是16.04)

deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse

如要用于其他版本,把 xenial 换成版本代号就好:
16.04
xenial(模板详细内容
15.10
willy(模板详细内容
14.04
trusty(模板详细内容
12.04
precise(模板详细内容

现在,再执行:

sudo apt-get update

现在就没有“apt-get 404 Not Found Package Repository Errors” 问题了。

小结:
这个问题,解决方法简单,但是对于初学者来说,却是一个触手的问题。


出现这个问题的原因是: 之前 /etc/apt/sources.list 路径里面的软件源更新网站有的已经过时了,需要更新新的网站。


Unable to connect to cn.archive.ubuntu.com:http: [112.124.140.210 80]

如果你出现这样的错误,说明你的网断了,查看网络连接情况。


参考网站:

How to fix Ubuntu/Debian apt-get 404 Not Found Package Repository Errors (Saucy, Raring, Quantal, Oneiric, Natty…)
https://smyl.es/how-to-fix-ubuntudebian-apt-get-404-not-found-package-repository-errors-saucy-raring-quantal-oneiric-natty/
Ubuntu apt-get unable to fetch packages
http://*.com/questions/30316812/ubuntu-apt-get-unable-to-fetch-packages
源列表
http://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8