搬到另一个国家后无法更新或安装任何东西

sin*_*ium 12 software-center updates apt

几天前,我在我的 PC 上安装了 Ubuntu,一切正常。
碰巧我去了另一个国家,我仍然在那里。因此,每当我运行更新或尝试从 Ubuntu 软件安装任何东西时,尽管我的互联网工作正常并且我可以使用我的 PC 访问互联网(我现在正在使用它来编写这些行),但没有任何效果。
我试图将服务器更改为我现在所在的国家/地区的服务器之一,但是没有用。所以我换了Ubuntu主服务器,也没用。
我重新启动我的电脑,运行sudo apt autocleansudo 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.
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个问题?

编辑:
问题在于我在/etc/apt/sources.list. 我的问题是,当我运行更新时,终端中出现的链接与我在终端中的链接不相似。/etc/apt/sources.list 此外,当我/etc/apt/sources.list按照Raffa所说的那样进行更新时,我仍然遇到类似的错误。

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.
Run Code Online (Sandbox Code Playgroud)

虽然/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
Run Code Online (Sandbox Code Playgroud)

Raf*_*ffa 19

由于某种原因,APT 无法Release在指定的存储库列表中找到该文件。

为了解决这个问题,我建议如下:

  • 检查您与 Internet 的连接是否在防火墙之后、以任何方式受到限制或在代理之后,并相应地配置您的系统和连接或更改为不同的连接(如果可用)。

  • 通过运行以下命令检查是否有 APT 代理配置文件:

ls /etc/apt/apt.conf.d/*proxy*
Run Code Online (Sandbox Code Playgroud)

如果该命令返回任何结果,请将这些文件移出/etc/apt/apt.conf.d/目录或删除它们。

  • 通过在终端中运行以下命令,将您的存储库列表恢复为原始的 Ubuntu Bionic Beaver 列表:
sudo nano /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

将打开一个文件编辑器。删除其中的所有行,然后将以下内容复制并粘贴到文件编辑器中:

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
Run Code Online (Sandbox Code Playgroud)

然后,按Ctrl+保存并关闭文件,X然后按Y然后按Enter

要验证您是否正确保存了文件,请在终端中运行以下命令:

cat /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

输出应该是:

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
Run Code Online (Sandbox Code Playgroud)

Ubuntu 存储库具有定义的格式。例如,它们应该类似于deb http://archive.ubuntu.com/ubuntu bionic main.

解释:

deb这些存储库包含二进制文件或预编译包。大多数用户都需要这些存储库。

http://archive.ubuntu.com/ubuntu URI(统一资源标识符),在这种情况下是互联网上的一个位置。

bionic:是您的 Ubuntu 安装的版本名称。

main& restricted...etc:是部分名称或组件。可以有多个部分名称,以空格分隔。


之后,请通过在终端中运行以下命令来更新您的存储库列表:

sudo apt update
Run Code Online (Sandbox Code Playgroud)

您现在应该能够安装软件包并再次更新您的系统。


注意:

如果仍然出现错误,请首先/etc/apt/sources.list.d/通过在终端中运行以下命令备份到您的主目录:

mkdir ~/old_sources_list_d && sudo cp -r /etc/apt/sources.list.d/* ~/old_sources_list_d/
Run Code Online (Sandbox Code Playgroud)

之后,请/etc/apt/sources.list.d/通过在终端中运行以下命令来清除所有现有的 PPA 和存储库列表:

sudo rm -r /etc/apt/sources.list.d/*
Run Code Online (Sandbox Code Playgroud)

然后,请通过在终端中再次运行以下命令来更新您的存储库列表:

sudo apt update
Run Code Online (Sandbox Code Playgroud)