How to fix N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as it has an invalid file name extension in APT
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.
Quick fix
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/- Check which files are being ignored
- Remove unwanted backup and temporary files
- Rename disabled sources to .list extension (if you want to keep them)
- Verify the fix with apt update
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
What this error means
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.
Typical symptoms
- APT update succeeds but shows 'Ignoring file' notices in the output
- Expected repository sources are not being recognized by APT
- apt search and apt install don't find packages from the ignored source
- Backup or disabled source files are still present in /etc/apt/sources.list.d/
Common causes
- Files with incorrect extensions (.bak, .save, .disabled, .txt, .conf) in /etc/apt/sources.list.d/
- Backup files created by text editors (e.g., filename.list~, filename.list.swp)
- Files renamed to disable them without using a valid extension pattern
- Files accidentally copied without the .list extension
- Leftover temporary files from installation scripts or tools
How to fix "N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as it has an invalid file name extension"
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.
Advanced notes
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.
Frequently asked questions
- What does "N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as" mean?
- d/ if they have a valid file name extension. sources (for DEB822 format). txt, or no extension at all—causes APT to ignore the file and emit this informational notice.
- How do I fix "N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as"?
- 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.
- What causes "N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as"?
- Files with incorrect extensions (.bak, .save, .disabled, .txt, .conf) in /etc/apt/sources.list.d/ Backup files created by text editors (e.g., filename.list~, filename.list.swp) Files renamed to disable them without using a valid extension pattern
- Is the "N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as" error serious?
- It is a low-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚APT Official Documentation
- 📖
- 📖Debian Wiki: SourcesList(Official Docs)