有报错:
Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Reading package lists... Done
E: The repository 'cdrom://[Debian GNU/Linux 12.13.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20260110-15:44] 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.
这是因为你的 Debian 安装镜像(DVD ISO)被自动添加到了 APT 软件源中,但当前系统无法正确验证这个 CD-ROM 仓库,因此 apt update 被阻止了。
你现在有两种解决方案:
方案一(推荐):删除 CD-ROM 软件源
现在大多数情况下都直接使用网络源,不需要 DVD 源。
编辑 APT 源列表:
sudo nano /etc/apt/sources.list
找到类似这一行:
deb cdrom:[Debian GNU/Linux 12.13.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20260110-15:44]/ bookworm main
在前面加 # 注释掉:
# deb cdrom:[Debian GNU/Linux 12.13.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20260110-15:44]/ bookworm main
保存退出:
-
Ctrl + O -
回车
-
Ctrl + X
然后更新软件源:
sudo apt update
方案二:正确添加 DVD 源(不推荐)
如果你真的想使用 DVD 作为离线软件源:
插入 ISO 或挂载镜像后执行:
sudo apt-cdrom add
APT 会扫描并注册光盘。
之后再:
sudo apt update
但通常:
-
软件包版本旧
-
依赖不全
-
使用不方便
因此 Debian 用户基本都改用网络镜像源。
推荐再配置国内/官方网络源
你可以直接换成 Debian 官方源:
编辑:
sudo nano /etc/apt/sources.list
替换为:
deb http://deb.debian.org/debian bookworm main contrib non-free-firmware
deb http://deb.debian.org/debian-security bookworm-security main contrib non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free-firmware
然后:
sudo apt update
一键快速修复(直接执行)
如果你只是想赶紧修好:
sudo sed -i '/cdrom:/s/^/#/' /etc/apt/sources.list
sudo apt update
这会自动禁用 CD-ROM 源。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
