APT ignores files in /etc/apt/sources.list.d/ that don't have valid extensions (.list or .sources). This happens when backup files, disabled sources, or files with wrong extensions are placed in the directory.
Fixes N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as it has an invalid file name extension
ls -la /etc/apt/sources.list.d/ls -la /etc/apt/sources.list.d/N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as it has an invalid file name extension
APT only processes source files in /etc/apt/sources.list.d/ if they have a valid file name extension. The valid extensions are .list (for traditional format) or .sources (for DEB822 format). Any other extension—including .bak, .save, .disabled, .txt, or no extension at all—causes APT to ignore the file and emit this informational notice. This is a safety feature to prevent accidental inclusion of backup files, editor temporary files, or disabled sources when APT updates its package lists.
First, identify which files in /etc/apt/sources.list.d/ have invalid extensions:
ls -la /etc/apt/sources.list.d/Look for files that don't end with .list or .sources. Files with extensions like .bak, .save, .disabled, .txt, or backup suffixes (like ~) are the problem files.
Delete files that are backups or temporary files:
sudo rm /etc/apt/sources.list.d/*.bak
sudo rm /etc/apt/sources.list.d/*.save
sudo rm /etc/apt/sources.list.d/*~
sudo rm /etc/apt/sources.list.d/*.swpIf you have specific invalid files, remove them individually:
sudo rm /etc/apt/sources.list.d/invalid-filename.txtIf you intentionally disabled a source by renaming it (e.g., to .disabled), you have two options:
Option A: If you want to keep the source but have it ignored, rename it to have a .list extension:
sudo mv /etc/apt/sources.list.d/google-chrome.disabled /etc/apt/sources.list.d/google-chrome.listOption B: If you want to permanently disable the source, prefix the filename with a dot (hidden file):
sudo mv /etc/apt/sources.list.d/google-chrome.list /etc/apt/sources.list.d/.google-chrome.listAfter renaming or removing files, run apt update to confirm the warning is gone:
sudo apt updateThe 'Ignoring file' notices should no longer appear. If you see the message again, double-check that all files in /etc/apt/sources.list.d/ end with .list or .sources.
APT's strict file extension policy prevents common mistakes like accidentally including backup files (created by text editors with ~ suffix) or disabled sources (often renamed with .disabled suffix). This is intentional design: APT processes files in sorted order and skips anything without .list or .sources extension. If you want to temporarily disable a source without deleting it, either rename it to .list and comment out its content using # characters, or use the .sources format with a commented-out directive. For DEB822 format (.sources files), the syntax differs slightly from .list files but offers advantages like inline GPG key specification. Most modern Debian/Ubuntu systems still use .list format, but newer systems prefer .sources for better structure and key management.