How to fix N: Ignoring file 'filename' in directory '/etc/apt/sources.list.d/' as it has an invalid file name extension in APT

APTBEGINNERLOWUpdated Oct 26, 2026· 509 views

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/
  1. Check which files are being ignored
  2. Remove unwanted backup and temporary files
  3. Rename disabled sources to .list extension (if you want to keep them)
  4. Verify the fix with apt update
apt — error
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

  1. Files with incorrect extensions (.bak, .save, .disabled, .txt, .conf) in /etc/apt/sources.list.d/
  2. Backup files created by text editors (e.g., filename.list~, filename.list.swp)
  3. Files renamed to disable them without using a valid extension pattern
  4. Files accidentally copied without the .list extension
  5. 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"

1Check which files are being ignored

First, identify which files in /etc/apt/sources.list.d/ have invalid extensions:

bash
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.

2Remove unwanted backup and temporary files

Delete files that are backups or temporary files:

bash
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/*.swp

If you have specific invalid files, remove them individually:

bash
sudo rm /etc/apt/sources.list.d/invalid-filename.txt
3Rename disabled sources to .list extension (if you want to keep them)

If 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:

bash
sudo mv /etc/apt/sources.list.d/google-chrome.disabled /etc/apt/sources.list.d/google-chrome.list

Option B: If you want to permanently disable the source, prefix the filename with a dot (hidden file):

bash
sudo mv /etc/apt/sources.list.d/google-chrome.list /etc/apt/sources.list.d/.google-chrome.list
4Verify the fix with apt update

After renaming or removing files, run apt update to confirm the warning is gone:

bash
sudo apt update

The '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