旧版Ubuntu Docker镜像 apt 失败

在配置arm64v8/Ubuntu22.04镜像时,apt 失败,切换到国内源同样报错

究其原因是arm64v8/Ubuntu22.04是个精简镜像,没有ca证书, 需要安装ca-certificates, 但apt 不能用,死锁了。

根据网上/AI 提示, 下面三个方法均不起作用:

  1. 导入缺失的 GPG 公钥

> apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

不起作用:" gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation"

  1. 手动下载并添加公钥

> gpg --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

> gpg --export 871920D1991BC93C | tee /etc/apt/trusted.gpg.d/ubuntu-ports.gpg > /dev/null

不起作用:"gpg: command not found"

  1. 修复密钥文件的权限

>chmod 644 /etc/apt/trusted.gpg.d/*.gpg

不安全的解决方法

方法1. 所有apt update 增加参数 --allow-insecure-repositories --allow-unauthenticated

apt install增加参数 --allow-unauthenticated

> apt update --allow-insecure-repositories --allow-unauthenticated
> apt install --allow-unauthenticated xxxx

方法2. 修改 /etc/apt/sources.list

deb 后面增加**trusted=yes**

deb trusted=yes http://mirrors.aliyun.com/ubuntu-ports/ jammy main restricted universe multiverse

deb trusted=yes http://mirrors.aliyun.com/ubuntu-ports/ jammy-updates main restricted universe multiverse

deb trusted=yes http://mirrors.aliyun.com/ubuntu-ports/ jammy-backports main restricted universe multiverse

deb trusted=yes http://mirrors.aliyun.com/ubuntu-ports/ jammy-security main restricted universe multiverse

但上面方法都是直接取消安全验证,所以是不安全的。

。

相关推荐
by209995 小时前
Linux 基础指令与文件操作
linux·1024程序员节
Escalating_xu6 小时前
【Linux 网络编程】手写序列化与反序列化:从 x op y 到能校验的文本协议
linux·运维·网络
todoitbo7 小时前
在 Ubuntu ARM64 上运行 Q1 V3.0 MuJoCo 模型:加载、步进和单执行器响应
linux·运维·ubuntu·ai·机器人·仿真教程·启元
AR-26710-8 小时前
Linux Day26——传输层与三次握手
linux·运维
隔窗听雨眠9 小时前
PostgreSQL单表从Windows迁移到Linux:差异剖析、方案对比与全流程实战
linux·windows·postgresql
xinruoqianqiu9 小时前
记录Linux
linux
额额额对了9 小时前
嵌入式 Linux 实战:i.MX6ULL 上的 CAN 通信与摄像头采集
linux·运维·服务器
牛马鸡niumasi9 小时前
【Linux】进程替换
linux
灯澜忆梦10 小时前
【Linux】#10 | Linux 终端实用快捷键 + 安装应用
linux·运维·服务器
码士集团小青10 小时前
面霸篇:高频 Java 基础问题(核心卷一)
linux·服务器·数据库·redis·缓存·1024程序员节