How to Fix ‘Failed to Fetch cdrom://’ in apt-get Update Ubuntu

Executing sudo apt update or attempting to install software packages in Ubuntu or Debian-based distributions only to be stopped by the error “E: The repository ‘cdrom://[Ubuntu…] … does not have a Release file’ or ‘Failed to fetch cdrom://… Please use apt-cdrom to make this CD-ROM recognized by APT'” halts package updates. This error occurs because the Ubuntu installation media (a USB flash stick, DVD-ROM, or ISO image) was registered as a primary package repository during the initial operating system setup. Once installation finishes and the physical media is removed, APT fails whenever it tries to query the unmounted installation disc. Resolving this issue requires disabling or removing the CD-ROM repository line from the APT sources list.

Comment Out the CD-ROM Entry in /etc/apt/sources.list

The standard repository configuration file contains declarations for both official online mirrors and local optical media drives. Disabling the CD-ROM entry restores purely online repository queries.

  1. Open a terminal window (press Ctrl + Alt + T).
  2. Open the master repository list file in the nano text editor with administrative privileges:
    sudo nano /etc/apt/sources.list
  3. Inspect the very top of the file. You will see one or two lines beginning with deb cdrom:[Ubuntu...]/.
  4. Insert a hash symbol (#) at the very beginning of any line starting with deb cdrom::
    # deb cdrom:[Ubuntu 24.04 LTS _Noble Numbat_ - Release amd64 (20240424)]/ noble main restricted
  5. Adding the # character comments out the instruction, telling the APT package manager to ignore local installation discs.
  6. Save the file by pressing Ctrl + O followed by Enter, then exit nano by pressing Ctrl + X.
  7. Refresh your package lists to verify the fix:
    sudo apt update

Inspect Modern deb822 Format Sources (Ubuntu 24.04 and Later)

Starting with Ubuntu 24.04 LTS, default repositories are defined in deb822-format configuration files stored inside /etc/apt/sources.list.d/ubuntu.sources rather than the legacy single file.

  1. Check if a CD-ROM source file exists inside the modular directory:
    ls /etc/apt/sources.list.d/
  2. Search for any files referencing the cdrom: URI:
    grep -rn "cdrom:" /etc/apt/sources.list /etc/apt/sources.list.d/
  3. If an entry appears inside /etc/apt/sources.list.d/ubuntu.sources or a dedicated cdrom.list file, open that specific file in nano:
    sudo nano /etc/apt/sources.list.d/cdrom.list
  4. Delete or comment out the lines referencing URIs: cdrom:.
  5. Save and exit the editor.

Disable CD-ROM Repositories via the Graphical ‘Software & Updates’ Tool

If you prefer a graphical user interface, Ubuntu provides a native settings panel to manage package sources without editing configuration files manually.

  1. Press the Super key (Windows key) on your keyboard to open the Activities search.
  2. Type Software & Updates and launch the application.
  3. Click on the Ubuntu Software tab.
  4. Look at the bottom of the window for an option labelled Installable from CD-ROM/DVD.
  5. Ensure this checkbox is unchecked.
  6. Switch to the Other Software tab.
  7. Review the list: if any entry shows a CD-ROM or ISO drive path, uncheck it or click Remove.
  8. Click Close. Ubuntu will prompt you to reload software cache lists; click Reload.

Clean APT Cache and Verify Integrity

After removing obsolete repository references, purge old metadata cache files to ensure clean synchronization with official mirrors.

  1. Clean out local package archives:
    sudo apt clean
  2. Update your repository cache:
    sudo apt update
  3. Verify that the output finishes with All packages are up to date without displaying CD-ROM fetch errors.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.