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

Debian系统更新实现

只是想简单更新一下Debian,没有想到一下子遇到这么多错误过不去。
root@Opensource:~# apt update
Ign:1 cdrom://[Debian GNU/Linux 12.6.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240629-10:19] bookworm InRelease
Err:2 cdrom://[Debian GNU/Linux 12.6.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240629-10:19] bookworm Release
Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Get:3 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm InRelease [47.0 kB]
Err:3 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Get:4 https://download.docker.com/linux/debian bookworm InRelease [47.0 kB]
Get:5 https://download.docker.com/linux/debian bookworm/stable amd64 Packages [45.3 kB]
Reading package lists... Done
E: The repository 'cdrom://[Debian GNU/Linux 12.6.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240629-10:19] bookworm 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.
W: GPG error: https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm 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: https://download.docker.com/linux/debian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
......

一.解除cdrom错误问题
最前面的错误是因为cdrom的问题,在sources.list中将cdrom源用#注释掉。
root@Opensource:~# nano /etc/apt/sources.list
成功解决cdrome问题。


二.解决公钥的问题
在网上搜到解决方案是获取公钥。
失败1:
root@Opensource:~# apt-key adv --keyserver keyserver.ubunto.com --recv-keys 7EA0A9C3F273FCD8
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.MJi3idqjeo/gpg.1.sh --keyserver keyserver.ubunto.com --recv-keys 7EA0A9C3F273FCD8
gpg: keyserver receive failed: No name
apt-key降级了,失败,换成gpg命令
失败2:
root@Opensource:~# gpg --keyserver keyserver.ubunto.com --recv-keys 7EA0A9C3F273FCD8
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: keyserver receive failed: No name
还是失败,换一个公钥服务器,还是失败。
失败3:
root@Opensource:~# gpg --keyserver keyring.debian.org --recv-keys 7EA0A9C3F273FCD8
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
再换公钥服务器,成功。
root@Opensource:~# gpg --keyserver hkps://keys.openpgp.org --recv-keys 7EA0A9C3F273FCD8
gpg: key 8D81803C0EBFCD88: new key but contains no user ID - skipped
gpg: Total number processed: 1
gpg:           w/o user IDs: 1
再次update,还是同样的错误
root@Opensource:~# apt update
Get:1 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm InRelease [47.0 kB]
Err:1 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
失败4:
试着将docker的源也注释掉,换一个源试试
root@Opensource:~# nano /etc/apt/sources.list
root@Opensource:~# echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
https://download.docker.com/linux/debian \
bookworm stable" | sudo tee /etc/apt/sources.list.d/docker-official.list
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bookworm stable

再次update,还是同样的错误
失败5:
手工下载密钥
root@Opensource:~# curl -fsSL https://download.docker.com/linux/debian/gpg | \sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
这次提示错误变了。提示存在冲突,搞多了乱了。
root@Opensource:~# apt update
E: Conflicting values set for option Signed-By regarding source https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/ bookworm: /usr/share/keyrings/docker-archive-keyring.gpg != /usr/share/keyrings/docker-ce.gpg
E: The list of sources could not be read.

成功:
查找出重复内容
root@Opensource:~#grep -r "mirrors.tuna.tsinghua.edu.cn/docker-ce" /etc/apt/sources.list /etc/apt/sources.list.d
/etc/apt/sources.list:#deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm stable
/etc/apt/sources.list:deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm stable
/etc/apt/sources.list.d/docker.list:deb [arch=amd64 signed-by=/usr/share/keyrings/docker-ce.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm stable
使用编辑器用#注释掉多余的。
root@Opensource:~# nano /etc/apt/sources.list.d/docker.list
终于看到有5个包可以更新了。
root@Opensource:~# apt update
Get:1 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm InRelease [47.0 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm/stable amd64 Packages [45.3 kB]
Hit:3 https://download.docker.com/linux/debian bookworm InRelease
Fetched 92.3 kB in 1s (101 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.

三.更新
查看更新包
root@Opensource:~# apt list --upgradable
root@Opensource:~# apt upgrade
但是更新的都是docker,Debian自己的更新包一个都没有,原因是原debian的cdrom源被我注释掉,也没有添加新的更新源。

root@Opensource:~# nano /etc/apt/sources.list.d/docker.list
# 将下面这些更新源添加进去
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# 更新
root@Opensource:~# apt update
root@Opensource:~# apt upgrade
# 启用自动更新
root@Opensource:~#apt install unattended-upgrades
root@Opensource:~#dpkg-reconfigure unattended-upgrades

http://www.lryc.cn/news/612010.html

相关文章:

  • 在 Neo4j实现虚拟关系(间接)的可视化
  • (Python)待办事项升级网页版(html)(Python项目)
  • 识别 Base64 编码的 JSON、凭证和私钥
  • IntelliJ IDEA 2025.1.4.1 中文版
  • 防火墙(firewalld)
  • 医疗AI中GPU部署的“非对等全节点架构“方案分析(中)
  • 队列很多时,为什么RocketMQ比Kafka性能好?
  • Linux seLinux
  • 【通俗易懂】详解AI大模型微调中的常见超参数的作用
  • 工控机 vs 服务器:核心区别与应用场景深度解析
  • K8S云原生监控方案Prometheus+grafana
  • 基于MATLAB实现的具有螺旋相位板的4F系统用于图像边缘增强的仿真
  • [科普] 从单核到千核:Linux SMP 的“演化史”与工程细节
  • 学习 Android (十六) 学习 OpenCV (一)
  • 【React 插件】@uiw/react-md-editor 使用教程:从基础使用到自定义扩展
  • 人工智能大数据模型驱动企业创新
  • AttributeError: ‘WSGIRequest‘ object has no attribute ‘data‘
  • LibTorch C++ 部署深度学习模型:GPU 调用配置详解
  • 关于C语言连续强制类型转换,有符号数据位移,以及温度传感器int16有符号数据重组处理问题
  • 数论手机辅助:打造便捷高效的移动应用交互体验
  • 房产开发证书识别-建筑工程施工许可证识别-竣工验收备案表识别-土地规划许可证识别-商品房预售许可证识别-建筑工程施工许可证识别等房产企业证书识别场景剖析
  • 【数据分享】西藏土壤类型数据库
  • 生成模型实战 | GPT-2(Generative Pretrained Transformer 2)详解与实现
  • 【Linux内核系列】:信号(上)
  • 力扣热题100------136.只出现一次的数字
  • JAVA高级编程第五章
  • QT----简单的htttp服务器与客户端
  • 主流linux版本分类与说明
  • 盲盒抽卡机小程序系统开发:打造个性化娱乐新平台
  • Web 端 AI 图像生成技术的应用与创新:虚拟背景与创意图像合成