Ubuntu Server 21.04 apt 更新时出现更新错误

auw*_*lup 5 linux ubuntu apt

我试图安装一个 deb 软件包,但由于依赖项而拒绝运行,在尝试安装依赖项或操作系统更新失败后,我卸载了 deb 软件包。由于有许多待处理的更新,我尝试运行这些更新,但源网址报告未找到。

服务器:ubuntu 21.04

apt update
Hit:1 https://deb.nodesource.com/node_14.x hirsute InRelease
Hit:2 https://dl.yarnpkg.com/debian stable InRelease                       
Ign:3 http://us.archive.ubuntu.com/ubuntu hirsute InRelease                
Ign:4 http://us.archive.ubuntu.com/ubuntu hirsute-updates InRelease
Ign:5 http://us.archive.ubuntu.com/ubuntu hirsute-backports InRelease
Ign:6 http://us.archive.ubuntu.com/ubuntu hirsute-security InRelease
Err:7 http://us.archive.ubuntu.com/ubuntu hirsute Release
  404  Not Found [IP: 91.189.91.38 80]
Err:8 http://us.archive.ubuntu.com/ubuntu hirsute-updates Release
  404  Not Found [IP: 91.189.91.38 80]
Err:9 http://us.archive.ubuntu.com/ubuntu hirsute-backports Release
  404  Not Found [IP: 91.189.91.38 80]
Err:10 http://us.archive.ubuntu.com/ubuntu hirsute-security Release
  404  Not Found [IP: 91.189.91.38 80]
Reading package lists... Done
E: The repository 'http://us.archive.ubuntu.com/ubuntu hirsute 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://us.archive.ubuntu.com/ubuntu hirsute-updates 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://us.archive.ubuntu.com/ubuntu hirsute-backports 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://us.archive.ubuntu.com/ubuntu hirsute-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.
Run Code Online (Sandbox Code Playgroud)

关于如何解决这个问题的任何想法

小智 17

对此的快速解决方法是运行:

sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

...在apt update命令之前。

  • 请注意,没有“us.old-releases.ubuntu.com”。运行 sed 后需要删除“us.”,或者添加到 sed 匹配项之前。 (2认同)

und*_*ine 7

Ubuntu 21.04 是非 LTS 版本,支持截至 2022 年。最好的解决方案是升级到当前的 LTS 版本 - 22.04。如果不可能 - 将 /etc/apt/sources.list 中的源更改为https://old-releases.ubuntu.com/ubuntu/ - 这是过时的 ubuntu 版本的存档。