旧版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

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

相关推荐
金色熊族几秒前
windows11 + wsl2 上安装ubuntu20.04
ubuntu·windows11·wsl2
虚无的纽扣12 分钟前
【Linux】每个进程都拥有“假内存” | 进程地址空间详解
linux·运维·服务器
拂拉氏1 小时前
【知识讲解】 Linux进程的回收相关接口了解
linux·进程回收
新时代牛马1 小时前
PCI与PCIe 完整篇:硬件拓扑→ 报文协议→配置/BAR → Linux 驱动(一条主线讲透)
linux·运维·网络
WX _ jishuwu19901 小时前
esmfold gpu模式 批量预测蛋白三级结构实况记录 - 供参考
人工智能·ubuntu·三代测序·亚细胞定位,·deeploc·protcompv9
LuiChun1 小时前
与精神病患者的日常探讨20260913
docker
闲云野鹤在人间1 小时前
Docker入门|第1章 容器生态系统完整解析
运维·服务器·docker·容器·centos
筝筝ba1 小时前
如何跳过FFDC
xml·linux·运维·服务器·网络
赴生-1 小时前
Liunx 操作系统 进程概念(下)
linux
风静如云1 小时前
VMWare:Ubuntu(26.04)共享后看不到
linux