WishMeLz

生活其实很有趣

修复Debian12系统 apt-get 安装/更新时发生的错误:“Media change: please insert the disc labeled ...”

错误提示:

media change: please insert the disc labeled 'debian gnu/linux 12.5.0 bookworm - official amd64 dvd binary-1 with firmware 20240210-11:28' in the drive '/media/cdrom/' and press [enter]

打开 /etc/apt/sources.list 文件

deb cdrom:[Debian GNU/Linux 12.5.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240210-11:28]/ bookworm contrib main non-free-firmware

deb http://mirrors.jdcloudcs.com/debian bookworm main non-free-firmware
# Line commented out by installer because it failed to verify:
#deb-src http://mirrors.jdcloudcs.com/debian bookworm main non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware

# bookworm-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://mirrors.jdcloudcs.com/debian bookworm-updates main non-free-firmware
# Line commented out by installer because it failed to verify:
#deb-src http://mirrors.jdcloudcs.com/debian bookworm-updates main non-free-firmware

这个文件会提示所有可用的安装包来源,会看到deb cdrom:[Debian GNU/Linux 12.5.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240210-11:28]/ bookworm contrib main non-free-firmware 光盘安装包来源也在其中。
直接讲其注释即可

# deb cdrom:[Debian GNU/Linux 12.5.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240210-11:28]/ bookworm contrib main non-free-firmware

deb http://mirrors.jdcloudcs.com/debian bookworm main non-free-firmware
# Line commented out by installer because it failed to verify:
#deb-src http://mirrors.jdcloudcs.com/debian bookworm main non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware

# bookworm-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://mirrors.jdcloudcs.com/debian bookworm-updates main non-free-firmware
# Line commented out by installer because it failed to verify:
#deb-src http://mirrors.jdcloudcs.com/debian bookworm-updates main non-free-firmware

或者修改其他的配置文件如:

deb http://ftp.us.debian.org/debian/ wheezy main
deb-src http://ftp.us.debian.org/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ wheezy-updates main
deb-src http://ftp.us.debian.org/debian/ wheezy-updates main