Skip to content

finish-install: Disable cdrom sources if installation media is not a real CD

Pascal Hambourg requested to merge pham/apt-setup:pham/auto_disable_cdrom into master

After installing Debian from a DVD/BD installation image and a network mirror, /etc/apt/sources.lists looks like this:

deb cdrom:[Debian GNU/Linux 12.10.0 "Bookworm" - Official amd64 DVD with firmware 20250315-10:09] bookworm contrib main non-free-firmware

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

With this configuration, if the candidate version of a package is present in the installation media, then apt install requires to fetch it from an optical drive. If the original installation DVD/BD is inserted, then apt successfully fetches the package from it. Otherwise, or if the installation media was not a real DVD (USB stick, SD card, ISO file...), apt endlessly asks to insert the installation disc in the DVD drive:

Media change: please insert the disc labeled
 'Debian GNU/Linux 12.10.0 "Bookworm" - Official amd64 DVD with firmware 20250315-10:09'
in the drive '/media/cdrom/' and press [Enter]

The user must comment out the cdrom entry in /etc/apt/sources.list to prevent apt install from asking to insert the DVD.

So disable cdrom sources at the end of the installation if the installation media is not a real CD.

Closes: #1102140 #1103650

Merge request reports

Loading