How to fix W: Duplicate sources.list entry in APT

APTBEGINNERLOWUpdated Jun 10, 2026· 351 views

The 'Duplicate sources.list entry' warning appears when apt finds the same repository configured twice in your system. This typically happens when PPAs, Chrome, or other software auto-register repositories in multiple locations. While not critical, duplicates cause unnecessary package index updates and confusion.

Quick fix

Fixes W: Duplicate sources.list entry

sudo apt-get update
# Output shows: W: Duplicate sources.list entry https://dl.google.com/linux/direct/deb/ stable Release
  1. Identify the duplicate source
  2. Check all source locations
  3. Method 1: Comment out the duplicate line (manual edit)
  4. Method 2: Delete the duplicate .list file
apt — error
sudo apt-get update
# Output shows: W: Duplicate sources.list entry https://dl.google.com/linux/direct/deb/ stable Release
W: Duplicate sources.list entry

What this error means

The "Duplicate sources.list entry" warning indicates that apt has detected the same software repository configured more than once on your system. This warning occurs because: - The same repository appears in multiple locations (/etc/apt/sources.list and /etc/apt/sources.list.d/*.list files) - Software packages like Google Chrome automatically create source files that duplicate existing entries - Manual PPA additions or configuration management tools may add the same source twice - Third-party installers may add repositories without checking for duplicates This is a **warning, not an error**. Your system will still function normally and download packages correctly. However, apt will process the duplicate entry twice during each update, wasting bandwidth and time.

Typical symptoms

  • apt-get update shows 'W: Duplicate sources.list entry' warning message
  • Warning includes the exact duplicate repository URL or PPA
  • apt update takes longer than expected due to redundant processing
  • System continues to work normally despite the warning
  • Multiple source files reference the same repository
  • Duplicate appears to come from automatic software installation (Chrome, VS Code, etc.)

Common causes

  1. Software packages (Chrome, Slack, Microsoft products) auto-register repositories multiple times
  2. Manual PPA additions that duplicate an existing entry in /etc/apt/sources.list
  3. Automation tools or deployment scripts adding sources without checking existing entries
  4. Ubuntu Software Center or GUI package managers adding PPAs that already exist
  5. System upgrades that don't clean up stale duplicate entries
  6. User manually editing sources.list while separate .list files already contain the same repository

How to fix "W: Duplicate sources.list entry"

1Identify the duplicate source

First, identify which repository is duplicated. The apt warning shows which entry is repeated:

bash
sudo apt-get update
# Output shows: W: Duplicate sources.list entry https://dl.google.com/linux/direct/deb/ stable Release

Note the exact URL or PPA name from the warning message.

2Check all source locations

The duplicate can be in either /etc/apt/sources.list or in /etc/apt/sources.list.d/ directory:

bash
# Check the main sources list
grep -n "duplicate-url" /etc/apt/sources.list

# Check all .list files in sources.list.d
grep -r "duplicate-url" /etc/apt/sources.list.d/

Example output might show the same repository in multiple files.

3Method 1: Comment out the duplicate line (manual edit)

Open the file containing the duplicate and comment it out with a # symbol:

bash
# For duplicates in the main file:
sudo nano /etc/apt/sources.list

# Find the duplicate line and add # at the beginning:
# deb https://dl.google.com/linux/direct/deb/ stable main

# Save (Ctrl+O, Enter, Ctrl+X)

# For duplicates in sources.list.d/ files:
sudo nano /etc/apt/sources.list.d/google-chrome.list

After editing, test the fix:

bash
sudo apt-get update
# Warning should be gone
4Method 2: Delete the duplicate .list file

If the duplicate is in a separate file in /etc/apt/sources.list.d/, you can delete the entire file:

bash
# List files in sources.list.d
ls -la /etc/apt/sources.list.d/

# Remove the duplicate file (example)
sudo rm /etc/apt/sources.list.d/google.list

# Or for a more specific match:
sudo rm /etc/apt/sources.list.d/google-chrome.list

This is safe because:
- You're only removing one of the duplicate entries
- The software still has its source configured in the other location
- The package manager will continue to work normally

Verify the fix:

bash
sudo apt-get update
5Method 3: Use grep to find and remove duplicates

For multiple duplicates or complex setups, use grep to identify all instances:

bash
# Find all duplicate sources
grep -r "specific-url" /etc/apt/sources.list*

# Example: Find all Google Chrome sources
grep -r "dl.google.com/linux/direct" /etc/apt/sources.list*

This shows you exactly where duplicates exist. Then manually edit the files shown.

Advanced: Use a one-liner to check for all duplicates

bash
# Combine all sources and find duplicates
cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null | \
  grep -v "^#" | grep -v "^$" | sort | uniq -d

This shows only lines that appear more than once.

6Method 4: Use Software Sources GUI (Ubuntu)

If you prefer a graphical approach on Ubuntu/Linux Mint:

1. Open "Software Sources" from the application menu
2. Click on the "Other Software" tab
3. Look through the list for duplicate entries
4. Select the duplicate and click "Remove"
5. Close the dialog and run update

This method is safer because the GUI prevents accidental syntax errors.

7Method 5: Prevent future duplicates (best practice)

Configure your system to avoid adding duplicate sources:

bash
# Before adding a PPA, check if it already exists
grep -r "ppa:name/ppa" /etc/apt/sources.list*

# If found, don't add it again

# When installing software that adds its own repo:
# 1. Check what repo will be added
# 2. Verify it doesn't already exist
# 3. Only proceed if necessary

For automation (deployment scripts):

bash
#!/bin/bash

# Only add the source if it doesn't exist
if ! grep -q "repository-url" /etc/apt/sources.list /etc/apt/sources.list.d/* 2>/dev/null; then
    sudo add-apt-repository -y ppa:name/ppa
    sudo apt-get update
fi

This prevents duplicates from being added by automation tools.

8Verify the fix is complete

After removing duplicates, verify the fix:

bash
# Run update and check for warnings
sudo apt-get update

# Count total sources
wc -l /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null

# List all enabled sources (no duplicates)
grep -v "^#" /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null | \
  grep -v "^$" | sort -u

The output should show no duplicate warnings and a clean list of sources.

Advanced notes

Understanding apt Sources

The apt package manager looks for repositories in two places:
- /etc/apt/sources.list - The main configuration file (legacy)
- /etc/apt/sources.list.d/ - Directory for additional sources (modern approach)

When you add a PPA with add-apt-repository, it creates a new .list file in sources.list.d/ directory. This modular approach is cleaner than editing the main file.

How Duplicates Happen

Software vendors often auto-register their repositories:
- Google Chrome: Creates google-chrome.list on installation
- Microsoft: Creates multiple files for VS Code, Edge, etc.
- Slack: Adds slack.list automatically
- Ubuntu: Some upgrades may re-add existing sources

If a user manually adds the same PPA before the software is installed (or if upgrading a system), duplicates can occur.

Performance Impact

Each duplicate source causes apt to:
1. Download the repository's package index
2. Merge it with existing packages
3. Process the redundant metadata

This adds roughly 10-30 seconds per duplicate during apt-get update, making system updates slower.

Safety Considerations

- Safe to remove: Duplicates can be safely removed without breaking anything
- Keep one copy: Always keep at least one copy of the source
- Test after removal: Run apt-get update to verify nothing breaks
- Common mistake: Some users accidentally remove ALL copies of a needed source

Detecting Auto-Added Repositories

Software often adds sources without your knowledge. Check timestamps:

bash
ls -lt /etc/apt/sources.list.d/
# Newest files are recently added repositories

Review unexpected .list files and remove if you didn't explicitly add them.

Automating Cleanup (Advanced)

For system administrators managing multiple machines:

bash
#!/bin/bash

# Remove duplicates from all source lists
{
  cat /etc/apt/sources.list
  cat /etc/apt/sources.list.d/*.list 2>/dev/null
} | grep -v "^#" | grep -v "^$" | sort | uniq | \
  tee /tmp/unique-sources.txt

# Then reconstruct sources.list with unique entries
# (requires careful handling to avoid breaking the system)

This is complex and not recommended unless you fully understand apt configuration.

Comparing with Other Package Managers

| Package Manager | Source Config | Duplicate Handling |
|-----------------|----------------|--------------------|
| apt (Debian/Ubuntu) | /etc/apt/sources.list + .d/ | Shows warnings |
| yum (RedHat/CentOS) | /etc/yum.repos.d/ | Ignores duplicates |
| pacman (Arch) | /etc/pacman.conf | Ignores duplicates |
| dnf (Fedora) | /etc/yum.repos.d/ | Ignores duplicates |

apt is more verbose about duplicates than other package managers.

Related apt Issues

If you see similar warnings:
- "Target Packages is configured multiple times" - Same root cause
- "Target Release is configured multiple times" - Same repository with different releases
- "Target InRelease is configured multiple times" - Metadata conflicts

Frequently asked questions

What does "W: Duplicate sources.list entry" mean?
list entry" warning indicates that apt has detected the same software repository configured more than once on your system. list files) - Software packages like Google Chrome automatically create source files that duplicate existing entries - Manual PPA additions or configuration management tools may add the same source twice - Third-party installers may add repositories without checking for duplicates This is a warning, not an error. Your system will still function normally and download packages correctly.
How do I fix "W: Duplicate sources.list entry"?
The 'Duplicate sources.list entry' warning appears when apt finds the same repository configured twice in your system. This typically happens when PPAs, Chrome, or other software auto-register repositories in multiple locations. While not critical, duplicates cause unnecessary package index updates and confusion.
What causes "W: Duplicate sources.list entry"?
Software packages (Chrome, Slack, Microsoft products) auto-register repositories multiple times Manual PPA additions that duplicate an existing entry in /etc/apt/sources.list Automation tools or deployment scripts adding sources without checking existing entries
Is the "W: Duplicate sources.list entry" error serious?
It is a low-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading