在Ubuntu上不起作用时如何修复APT CMD

发布于 2025-02-04 07:40:11 字数 1565 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹤仙姿 2025-02-11 07:40:11

ubuntu 20.10已弃用了近一年。您应该将it.archive.ubuntu.com替换为old-releases.ubuntu.com

root@fd8c537092b2:/# grep VERSION /etc/os-release
VERSION="20.10 (Groovy Gorilla)"
VERSION_ID="20.10"
VERSION_CODENAME=groovy

root@fd8c537092b2:/# grep '^deb' /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ groovy main restricted
deb http://archive.ubuntu.com/ubuntu/ groovy-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ groovy universe
deb http://archive.ubuntu.com/ubuntu/ groovy-updates universe
deb http://archive.ubuntu.com/ubuntu/ groovy multiverse
deb http://archive.ubuntu.com/ubuntu/ groovy-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ groovy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ groovy-security main restricted
deb http://security.ubuntu.com/ubuntu/ groovy-security universe
deb http://security.ubuntu.com/ubuntu/ groovy-security multiverse

root@fd8c537092b2:/# apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu groovy InRelease
Ign:2 http://security.ubuntu.com/ubuntu groovy-security InRelease
Err:3 http://security.ubuntu.com/ubuntu groovy-security Release
  404  Not Found [IP: 91.189.91.38 80]
Ign:4 http://archive.ubuntu.com/ubuntu groovy-updates InRelease
Ign:5 http://archive.ubuntu.com/ubuntu groovy-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu groovy Release
  404  Not Found [IP: 185.125.190.36 80]
Err:7 http://archive.ubuntu.com/ubuntu groovy-updates Release
  404  Not Found [IP: 185.125.190.36 80]
Err:8 http://archive.ubuntu.com/ubuntu groovy-backports Release
  404  Not Found [IP: 185.125.190.36 80]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu groovy-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.
E: The repository 'http://archive.ubuntu.com/ubuntu groovy 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 groovy-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 groovy-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.

root@fd8c537092b2:/# sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

root@fd8c537092b2:/# grep '^deb' /etc/apt/sources.list
deb http://old-releases.ubuntu.com/ubuntu/ groovy main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy universe
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates universe
deb http://old-releases.ubuntu.com/ubuntu/ groovy multiverse
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates multiverse
deb http://old-releases.ubuntu.com/ubuntu/ groovy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ groovy-security main restricted
deb http://security.ubuntu.com/ubuntu/ groovy-security universe
deb http://security.ubuntu.com/ubuntu/ groovy-security multiverse

root@fd8c537092b2:/# apt-get update
Get:1 http://old-releases.ubuntu.com/ubuntu groovy InRelease [267 kB]
Ign:2 http://security.ubuntu.com/ubuntu groovy-security InRelease
Err:3 http://security.ubuntu.com/ubuntu groovy-security Release
  404  Not Found [IP: 185.125.190.36 80]
Get:4 http://old-releases.ubuntu.com/ubuntu groovy-updates InRelease [115 kB]
Get:5 http://old-releases.ubuntu.com/ubuntu groovy-backports InRelease [101 kB]
Get:6 http://old-releases.ubuntu.com/ubuntu groovy/restricted amd64 Packages [87.5 kB]
Get:7 http://old-releases.ubuntu.com/ubuntu groovy/main amd64 Packages [1768 kB]
Get:8 http://old-releases.ubuntu.com/ubuntu groovy/universe amd64 Packages [16.1 MB]
Get:9 http://old-releases.ubuntu.com/ubuntu groovy/multiverse amd64 Packages [247 kB]
Get:10 http://old-releases.ubuntu.com/ubuntu groovy-updates/universe amd64 Packages [559 kB]
Get:11 http://old-releases.ubuntu.com/ubuntu groovy-updates/restricted amd64 Packages [110 kB]
Get:12 http://old-releases.ubuntu.com/ubuntu groovy-updates/main amd64 Packages [453 kB]
Get:13 http://old-releases.ubuntu.com/ubuntu groovy-updates/multiverse amd64 Packages [20.1 kB]
Get:14 http://old-releases.ubuntu.com/ubuntu groovy-backports/main amd64 Packages [2681 B]
Get:15 http://old-releases.ubuntu.com/ubuntu groovy-backports/universe amd64 Packages [6237 B]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu groovy-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.

完成此操作后,您应该重新使用支持的版本。不幸的是,对于Ubuntu 20.10:

root@fd8c537092b2:/# apt-get install -y ubuntu-release-upgrader-core
...stuff...
root@fd8c537092b2:/# do-release-upgrade
...stuff...
An upgrade from 'groovy' to 'impish' is not supported with this tool.

虽然有更长的升级方法,但可以在此处找到: https://help.ubuntu.com/community/eolupgrades/

将来避免这种情况,如果您不打算升级每6个月的Ubuntu OS,则应留在LTS发行中。否则,请确保在发布下一个版本后尽快升级,这样您最终不会运行不受支持的发行版,并且升级路径很难。

Ubuntu 20.10 has been deprecated for nearly a year. You should replace it.archive.ubuntu.com with old-releases.ubuntu.com

root@fd8c537092b2:/# grep VERSION /etc/os-release
VERSION="20.10 (Groovy Gorilla)"
VERSION_ID="20.10"
VERSION_CODENAME=groovy

root@fd8c537092b2:/# grep '^deb' /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ groovy main restricted
deb http://archive.ubuntu.com/ubuntu/ groovy-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ groovy universe
deb http://archive.ubuntu.com/ubuntu/ groovy-updates universe
deb http://archive.ubuntu.com/ubuntu/ groovy multiverse
deb http://archive.ubuntu.com/ubuntu/ groovy-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ groovy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ groovy-security main restricted
deb http://security.ubuntu.com/ubuntu/ groovy-security universe
deb http://security.ubuntu.com/ubuntu/ groovy-security multiverse

root@fd8c537092b2:/# apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu groovy InRelease
Ign:2 http://security.ubuntu.com/ubuntu groovy-security InRelease
Err:3 http://security.ubuntu.com/ubuntu groovy-security Release
  404  Not Found [IP: 91.189.91.38 80]
Ign:4 http://archive.ubuntu.com/ubuntu groovy-updates InRelease
Ign:5 http://archive.ubuntu.com/ubuntu groovy-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu groovy Release
  404  Not Found [IP: 185.125.190.36 80]
Err:7 http://archive.ubuntu.com/ubuntu groovy-updates Release
  404  Not Found [IP: 185.125.190.36 80]
Err:8 http://archive.ubuntu.com/ubuntu groovy-backports Release
  404  Not Found [IP: 185.125.190.36 80]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu groovy-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.
E: The repository 'http://archive.ubuntu.com/ubuntu groovy 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 groovy-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 groovy-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.

root@fd8c537092b2:/# sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

root@fd8c537092b2:/# grep '^deb' /etc/apt/sources.list
deb http://old-releases.ubuntu.com/ubuntu/ groovy main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy universe
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates universe
deb http://old-releases.ubuntu.com/ubuntu/ groovy multiverse
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates multiverse
deb http://old-releases.ubuntu.com/ubuntu/ groovy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ groovy-security main restricted
deb http://security.ubuntu.com/ubuntu/ groovy-security universe
deb http://security.ubuntu.com/ubuntu/ groovy-security multiverse

root@fd8c537092b2:/# apt-get update
Get:1 http://old-releases.ubuntu.com/ubuntu groovy InRelease [267 kB]
Ign:2 http://security.ubuntu.com/ubuntu groovy-security InRelease
Err:3 http://security.ubuntu.com/ubuntu groovy-security Release
  404  Not Found [IP: 185.125.190.36 80]
Get:4 http://old-releases.ubuntu.com/ubuntu groovy-updates InRelease [115 kB]
Get:5 http://old-releases.ubuntu.com/ubuntu groovy-backports InRelease [101 kB]
Get:6 http://old-releases.ubuntu.com/ubuntu groovy/restricted amd64 Packages [87.5 kB]
Get:7 http://old-releases.ubuntu.com/ubuntu groovy/main amd64 Packages [1768 kB]
Get:8 http://old-releases.ubuntu.com/ubuntu groovy/universe amd64 Packages [16.1 MB]
Get:9 http://old-releases.ubuntu.com/ubuntu groovy/multiverse amd64 Packages [247 kB]
Get:10 http://old-releases.ubuntu.com/ubuntu groovy-updates/universe amd64 Packages [559 kB]
Get:11 http://old-releases.ubuntu.com/ubuntu groovy-updates/restricted amd64 Packages [110 kB]
Get:12 http://old-releases.ubuntu.com/ubuntu groovy-updates/main amd64 Packages [453 kB]
Get:13 http://old-releases.ubuntu.com/ubuntu groovy-updates/multiverse amd64 Packages [20.1 kB]
Get:14 http://old-releases.ubuntu.com/ubuntu groovy-backports/main amd64 Packages [2681 B]
Get:15 http://old-releases.ubuntu.com/ubuntu groovy-backports/universe amd64 Packages [6237 B]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu groovy-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.

After this is done, you should get back onto a supported version. Unfortunately, there's no way to do this anymore for ubuntu 20.10:

root@fd8c537092b2:/# apt-get install -y ubuntu-release-upgrader-core
...stuff...
root@fd8c537092b2:/# do-release-upgrade
...stuff...
An upgrade from 'groovy' to 'impish' is not supported with this tool.

There is a longer way to upgrade though, which is found here: https://help.ubuntu.com/community/EOLUpgrades/

To avoid this in the future, if you're not planning on upgrading your ubuntu OS every 6 months, you should stay on LTS releases. Otherwise be sure to upgrade soon after the next version is released so you do not end up running an unsupported release with a difficult upgrade path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文