当前位置: 首页 > news >正文

09-ubuntu20.04 执行 apt update时报错,是因为官网已停止维护不再更新的缘故吗?

不同版本的基础镜像,ubuntu24.04可以正常 apt update, ubuntu20.04 执行 apt update时报错,是因为 ubuntu20.04官网已停止维护不再更新的缘故吗?
当前日期是 2025.11.4,已超过维护期限了

(ros2) ➜ cuda11x git:(feature-hjw) ✗ docker run -it --rm ubuntu:noble
root@9a125502987a:/# apt update
Get:1 http://archive.ubuntu.com/ubuntu noble InRelease [256 kB]
Get:2 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:4 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [1170 kB]
Get:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:6 http://archive.ubuntu.com/ubuntu noble/restricted amd64 Packages [117 kB]
Get:7 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages [1808 kB]
Get:8 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [2703 kB]
Get:9 http://archive.ubuntu.com/ubuntu noble/multiverse amd64 Packages [331 kB]
Get:10 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages [19.3 MB]
Get:11 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [1635 kB]
Get:12 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Packages [33.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [2842 kB]
Get:14 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [2001 kB]
Get:15 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [1939 kB]
Get:16 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages [35.9 kB]
Get:17 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Packages [49.4 kB]
Get:18 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [33.9 kB]
Fetched 34.6 MB in 1min 26s (405 kB/s)
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
10 packages can be upgraded. Run ‘apt list --upgradable’ to see them.
root@9a125502987a:/# exit
exit
(ros2) ➜ cuda11x git:(feature-hjw) ✗ docker run -it --rm ubuntu:focal
root@b308a189bc19:/# apt update
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Couldn’t create temporary file /tmp/apt.conf.OEhhRn for passing config to apt-key
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [128 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [128 kB]
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Couldn’t create temporary file /tmp/apt.conf.kR14aw for passing config to apt-key
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [128 kB]
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Couldn’t create temporary file /tmp/apt.conf.QgCvOz for passing config to apt-key
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Couldn’t create temporary file /tmp/apt.conf.FxCltC for passing config to apt-key
Reading package lists… Done
W: GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: Couldn’t create temporary file /tmp/apt.conf.OEhhRn for passing config to apt-key
E: The repository ‘http://archive.ubuntu.com/ubuntu focal InRelease’ is not signed.
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.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-updates InRelease: Couldn’t create temporary file /tmp/apt.conf.kR14aw for passing config to apt-key
E: The repository ‘http://archive.ubuntu.com/ubuntu focal-updates InRelease’ is not signed.
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.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-backports InRelease: Couldn’t create temporary file /tmp/apt.conf.QgCvOz for passing config to apt-key
E: The repository ‘http://archive.ubuntu.com/ubuntu focal-backports InRelease’ is not signed.
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.
W: GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease: Couldn’t create temporary file /tmp/apt.conf.FxCltC for passing config to apt-key
E: The repository ‘http://security.ubuntu.com/ubuntu focal-security InRelease’ is not signed.
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.04 (Focal) 在 Docker 中执行 apt update 失败,而 Ubuntu 24.04 (Noble) 可以正常更新,原因确实与 Ubuntu 20.04 的官方维护状态有关。以下是详细分析:


1. Ubuntu 20.04 (Focal) 的维护状态

  • 官方支持周期:Ubuntu 20.04 LTS 的 标准支持(Standard Support)已于 2025 年 4 月结束,进入 扩展安全维护(ESM, Extended Security Maintenance) 阶段。
  • ESM 限制
    • ESM 仅提供安全更新,且需要 Ubuntu Pro 订阅(免费个人使用最多 5 台机器)。
    • 默认的 archive.ubuntu.comsecurity.ubuntu.com停止普通更新,导致 apt update 失败(GPG 签名错误或 404 错误)。
  • 你的测试现象
    • 错误提示 Couldn't create temporary file /tmp/apt.conf.* 可能是 Docker 环境中的临时文件权限问题,但根本原因是 仓库已失效(即使修复权限,也会因仓库无更新而失败)。

2. Ubuntu 24.04 (Noble) 正常更新的原因

  • Ubuntu 24.04 是 最新 LTS 版本(2024 年 4 月发布),处于标准支持阶段,官方仓库(archive.ubuntu.com)完全可用。
  • 你的测试中 apt update 成功,说明仓库配置和临时文件权限均正常。

3. 解决方案

方法 1:切换到受支持的 Ubuntu 版本
  • 推荐:使用 Ubuntu 22.04 (Jammy)24.04 (Noble),避免维护问题。
    docker run -it --rm ubuntu:24.04  # 或 ubuntu:jammy
    
方法 2:为 Ubuntu 20.04 启用 ESM(需订阅)
  • 注册 Ubuntu Pro(免费个人版):
    pro attach FREE  # 免费订阅(个人用途)
    
  • 或手动配置 ESM 仓库(需订阅令牌):
    # 示例(需替换 <TOKEN>)
    echo "deb https://esm.ubuntu.com/ubuntu/ <YOUR_UBUNTU_VERSION> main" > /etc/apt/sources.list.d/esm.list
    apt update
    
方法 3:使用旧版镜像存档(不推荐)
  • 如果仅需临时测试,可使用 Ubuntu 官方存档镜像(无安全更新):
    docker run -it --rm ubuntu:20.04
    sed -i 's|archive.ubuntu.com|old-releases.ubuntu.com|g' /etc/apt/sources.list
    apt update  # 可能仍会失败(GPG 密钥过期)
    
方法 4:修复临时文件权限(仅解决表象)
  • 如果错误是 /tmp 权限问题(非仓库失效),可尝试:
    chmod 1777 /tmp  # 确保临时目录可写
    apt update
    
    但 Ubuntu 20.04 的仓库问题仍会存在。

4. 根本原因总结

  • Ubuntu 20.04 的默认仓库已失效:因为超过了标准支持周期,官方不再提供普通更新。
  • Ubuntu 24.04 正常:处于支持周期内,仓库完全可用。
  • Docker 环境问题/tmp 权限错误可能是偶然现象,但即使修复,仓库失效问题仍会导致 apt update 失败。

建议

  • 升级到新版本:如无特殊依赖,优先使用 Ubuntu 22.0424.04
  • 必须使用 20.04:启用 ESM 或使用自定义镜像(如 old-releases.ubuntu.com,但需自行承担风险)。

如果有其他依赖问题(如 ROS2 兼容性),可进一步讨论具体场景!

http://www.dtcms.com/a/569622.html

相关文章:

  • 南通做网站找谁求网站懂的说下开车
  • ps做网站宽度重庆公司团建推荐
  • uniapp中的uni_modules分包
  • 算法笔记 09
  • 【VLAs篇】08:以实时速度运行VLA
  • 广西桂林建设局网站建立网站需要多少钱 索 圈湖南岚鸿
  • 买完服务器怎么做网站网页编辑软件绿色
  • 从奠基到前沿:CIFAR-10 数据集如何驱动计算机视觉研发进化
  • 计算机网络第六章学习
  • 华为A800I A2 arm64架构鲲鹏920cpu的ubuntu22.04 tls配置直通的grub配置
  • 耐热型发光颜料:高温环境下的功能材料新星
  • 简单易做的的网站做网站一定要注册域名吗
  • 正态分布概率:1σ、2σ、3σ、4σ深度解读
  • 红帽Linux-调优系统性能
  • python找到文件夹A中但是不在文件夹B中的文件
  • 做企业网站要怎么设计方案机关单位网站安全建设
  • 网站建设乙方义务wordpress 模板 淘宝客
  • 归并排序解读(基于java实现)
  • 从0开始学算法——第一天(如何高效学习算法)
  • 相似度计算算法系统性总结
  • 大型网站建设用什么系统好佛山网站设计哪里好
  • Perplexity AI 的 RAG 架构全解析:幕后技术详解
  • 免费查找资料的网站不同网站建设特点
  • 信诚网络公司网站莱芜吧莱芜贴吧
  • Web Js逆向——加密参数定位方法(Hook)
  • Python3 模块
  • APP网站建设什么用处昆明装饰企业网络推广
  • Vue开发系列——自定义组件开发
  • 网站网页和网址的关系乐陵森林覆盖率
  • 贵阳响应式网站开发汕头网站推广找哪里