How to fix "the repository cdrom does not have a release file" error on Debian 12
Debian is an evergreen and long-term-supported Linux distro that has been used to power hundreds of servers around the globe. It is known for its stability and reliability which is the reason multiple Linux distros have been derived from it including Ubuntu. While the official Debian repositories contain a vast array of software, there might be occasions when you wouldn’t have it out of the box after completing the installation. In such a scenario, we have to add them manually, to make the system work properly and install various packages using the internet.
Add official Souces.list repos in Debian 12
In this tutorial, we’ll walk you through the process of adding the repositories in “sources.list” file on your Debian 12 system.
Step 1: Run the system update
Go to your Debian 12 Desktop or Server terminal and execute the system update command to confirm that the official repositories are not available.
# apt update
If the system doesn’t update itself instead through the following error then it means, the default system repositories in your Debian 12 are missing.
Step 2: Add the Debian 12 default repository
Now, to solve this problem of not having a connection with the remote Debian 12 repo server which appears after the installation because our system only has one repository link which is to the CD, we have used to install the OS. So, that needs to be changed.
In your command terminal with root privileges edit the Sources.list file:
# nano /etc/apt/sources.list
Put # in the front of the existing CDRom repo or delete it.
After that copy and paste the default Debian 12 system repositories:
deb https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware # deb-src https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware deb https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware # deb-src https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware deb https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware # deb-src https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware deb https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware # deb-src https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware deb https://security.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware # deb-src https://security.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware
Save the file by pressing Ctrl+X and typing Y after that hit the Enter key.
Step 3: Update the APT package list
After updating the repository source file, once again run the system update command and this time you will not see any error. Your system will download and install not only the latest updates but even the common packages available for Linux systems.
# apt update
# apt upgrade
The error has been resolved and the update was successful
Conclusion
A guide to fixing the “Repository does not have a Release file” error in Debian. Trust me, I’ve faced this error more times than I can count and these steps have helped me every single time.
Good Luck!