Ubuntu Server 21.04 更新 apt update 时出错

Ubuntu Server 21.04 更新 apt update 时出错

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

服务器: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.

关于如何解决这个问题有什么想法

答案1

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

答案2

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

sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

... 在apt update命令之前。

答案3

相关内容