apt update Ign and 404 Not Found

1. 环境及目标

环境:在Ubuntu 24.04.1 LTS系统上通过virt-manager启动了debian系统,网络为NAT,可以连通互联网


2. 问题描述及原因分析

执行命令

复制代码
apt update

输出如下信息:

复制代码
Ign:1 http://mirrors.ustc.edu.cn/debian buster InRelease
Err:2 http://mirrors.ustc.edu.cn/debian buster Release
  404  Not Found [IP: 218.104.71.170 80]
Reading package lists... Done
E: The repository 'http://mirrors.ustc.edu.cn/debian buster 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.

怀疑是网络问题,进行了ping测试,网络正常能ping通,网络没问题。

那只有可能是源的问题了,中途更换过其他源,也是不能正常工作。故怀疑签名可能过期,要在 apt update 时关闭验证:

复制代码
apt -o Acquire::Check-Valid-Until=false update

执行结果如下:

复制代码
Get:1 http://mirrors.ustc.edu.cn/debian bullseye InRelease [75.1 kB]
Get:2 http://mirrors.ustc.edu.cn/debian-security bullseye-security InRelease [27.2 kB]
Err:1 http://mirrors.ustc.edu.cn/debian bullseye InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY 605C66F00D6C9793
Err:2 http://mirrors.ustc.edu.cn/debian-security bullseye-security InRelease   
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8
Reading package lists... Done                                                  
W: GPG error: http://mirrors.ustc.edu.cn/debian bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D
386FA1D9 NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY 605C66F00D6C9793
E: The repository 'http://mirrors.ustc.edu.cn/debian bullseye 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://mirrors.ustc.edu.cn/debian-security bullseye-security InRelease: The following signatures couldn't be verified because the public key is not available: 
NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8
E: The repository 'http://mirrors.ustc.edu.cn/debian-security bullseye-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.

在错误很明确:缺少 Debian Bullseye 的签名公钥。APT 默认会校验 Release 文件签名,文件系统里面GPG key 太老了,Bullseye 的 key 不存在,所以报 NO_PUBKEY。

手动导入公钥:

复制代码
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 605C66F00D6C9793
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 54404762BBB6E853
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BDE6D2B9216EC7A8

3. 解决方案

手动导入公钥:

复制代码
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 605C66F00D6C9793
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 54404762BBB6E853
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BDE6D2B9216EC7A8
相关推荐
qqxhb6 分钟前
系统架构设计师备考第61天——嵌入式系统架构模式&操作系统&数据库&中间件
数据库·中间件·系统架构·sqlite·dds·层次化(封闭/开放)·递归模式
SelectDB17 分钟前
Apache Doris 数据导入原理与性能优化 | Deep Dive
运维·数据库·数据分析
西西学代码19 分钟前
Flutter---个人信息(1)---实现简单的UI
开发语言·javascript·flutter
superman超哥21 分钟前
仓颉语言中正则表达式引擎的深度剖析与实践
开发语言·后端·仓颉
在坚持一下我可没意见34 分钟前
Java 网络编程:TCP 与 UDP 的「通信江湖」(基于UDP回显服务器)
java·服务器·开发语言·tcp/ip·udp·java-ee
悟能不能悟1 小时前
在service方法中已经catch异常,Transactional失效怎么办
java·数据库·sql
西红柿维生素1 小时前
23种设计模式-框架中的使用
java·开发语言·设计模式
LNN20221 小时前
Qt creator +Valgrind检测内存泄漏(linux)
linux·开发语言·qt
月夜奇术师1 小时前
SQL查询性能优化:从30分钟到30秒的蜕变——破解串行查询瓶颈
数据库·性能优化
修炼前端秘籍的小帅1 小时前
精读《JavaScript 高级程序设计 第4版》第6章 集合引用类型(三)Map、WeakMap、Set、WeakSet
开发语言·javascript·ecmascript