几天前,我在 PC 上安装了 Ubuntu,一切正常。
碰巧我去了另一个国家,现在还在那里。因此,每当我运行更新或尝试从 Ubuntu 软件安装任何东西时,都不起作用,尽管我的互联网运行正常,我可以使用 PC 访问互联网(我现在正在使用它来写这些代码)。我试图将服务器更改为我现在所在国家的服务器之一,但没有成功。所以我换成了 Ubuntu 主服务器,但
还是不行。
我重启了 PC,运行,什么都没有改变。 每次运行更新过程时,我仍然会收到这些错误: sudo apt autoclean
sudo apt clean
sudo apt update
Ign:1 http://archive.canonical.com/ubuntu bionic InRelease
Err:2 http://archive.canonical.com/ubuntu bionic Release
404 Not Found [IP: 91.189.92.191 80]
Ign:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Ign:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Ign:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Ign:6 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Err:7 http://archive.ubuntu.com/ubuntu bionic Release
404 Not Found [IP: 91.189.88.174 80]
Err:8 http://archive.ubuntu.com/ubuntu bionic-updates Release
404 Not Found [IP: 91.189.88.174 80]
Err:9 http://archive.ubuntu.com/ubuntu bionic-backports Release
404 Not Found [IP: 91.189.88.174 80]
Err:10 http://archive.ubuntu.com/ubuntu bionic-security Release
404 Not Found [IP: 91.189.88.174 80]
Reading package lists... Done
E: The repository 'http://archive.canonical.com/ubuntu bionic Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
有人知道如何解决这个问题吗?
编辑:
问题是不是我没有正确的链接/etc/apt/sources.list
。我的问题是,当我运行更新时,终端中显示的链接与我在 中的链接不相似。/etc/apt/sources.list
此外,当我更新/etc/apt/sources.list
为拉法说完,我仍然遇到类似的错误。
sudo apt update
Ign:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Ign:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu bionic-security Release
404 Not Found [IP: 91.189.91.14 80]
Err:5 http://archive.ubuntu.com/ubuntu bionic Release
404 Not Found [IP: 91.189.88.31 80]
Err:6 http://archive.ubuntu.com/ubuntu bionic-updates Release
404 Not Found [IP: 91.189.88.31 80]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu bionic-security Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
虽然/etc/apt/sources.list
包含提到的链接拉法
cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted
答案1
由于某种原因,APT 无法Release
在指定的存储库列表中找到该文件。
为了解决这个问题,我建议如下:
检查您的互联网连接是否在防火墙后面、是否受到任何限制或是否在代理后面,并相应地配置您的系统和连接,或更改为其他连接(如果可用)。
通过运行以下命令检查是否存在 APT 代理配置文件:
ls /etc/apt/apt.conf.d/*proxy*
如果命令返回任何结果,请将这些文件移出/etc/apt/apt.conf.d/
目录或删除它们。
- 通过在终端中运行以下命令将您的存储库列表恢复为原始 Ubuntu Bionic Beaver 列表:
sudo nano /etc/apt/sources.list
将打开一个文件编辑器。删除其中的所有行,然后将以下内容复制并粘贴到文件编辑器中:
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted
Ctrl然后按+保存并关闭文件,X然后按Y,然后按Enter
为了验证您是否正确保存了文件,请在终端中运行以下命令:
cat /etc/apt/sources.list
输出应该准确:
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted
Ubuntu 存储库具有定义的格式。例如,它们应该是这样的
deb http://archive.ubuntu.com/ubuntu bionic main
。解释:
deb
:这些存储库包含二进制文件或预编译包。大多数用户都需要这些存储库。
http://archive.ubuntu.com/ubuntu
:URI(统一资源标识符),在本例中是互联网上的位置。
bionic
:是您的 Ubuntu 安装的发布名称。
main
&restricted
...ETC:是部分名称或组成部分。可以有多个部分名称,以空格分隔。
之后,请通过在终端中运行以下命令来更新您的存储库列表:
sudo apt update
您现在应该能够安装软件包并再次更新系统。
注意:
如果仍然出现错误,请先/etc/apt/sources.list.d/
通过在终端中运行以下命令备份到您的主目录:
mkdir ~/old_sources_list_d && sudo cp -r /etc/apt/sources.list.d/* ~/old_sources_list_d/
之后,请通过/etc/apt/sources.list.d/
在终端中运行以下命令清除所有现有的 PPA 和存储库列表:
sudo rm -r /etc/apt/sources.list.d/*
然后,请通过在终端中再次运行以下命令来更新您的存储库列表:
sudo apt update
答案2
我认为这并不是因为你连接的国家/地区发生变化。这是因为新连接有代理服务器或系统来阻止或重定向 Ubuntu 服务器...(可能是政府或机构)
我在我所在大学的“sala de computo”(计算室)连接时也遇到了类似的问题。
我想我可以使用一些 VPN 或服务器配置(DNS)来跳过这个......
答案3
如果你在突尼斯,你可以切换到适当的存储库https://launchpad.net/ubuntu/+mirror/ubuntu.mirror.tn-archive2
但我注意到它不是最新的,甚至没有 Bionic 的文件,更不用说较新的发行版了。阿尔及利亚和利比亚没有存储库,因此您可以尝试以下替代方案法国,西班牙,瑞士, 或者荷兰人。
答案4
对于新手来说,不使用命令行的更简单的方法:
- 打开软件更新程序
- 设置
- Ubuntu 软件
- 下载自:
- 其他...
- mirrors.ubuntu.com(向上滚动到第一个条目)
- 选择服务器
- (如果有提示,请输入密码)
- 关闭
- 重新加载(当提示“软件过期时”)
更新应该可以正常工作。