APT Repository Issues and Fixes

Fix broken APT repositories, expired keys, and conflicting PPA problems on Ubuntu-based systems.

Intermediate Verified Working Updated 5 min read Tested on Zorin OS 18.1 Pro (Ubuntu 24.04 Noble base) Hardware Lenovo ThinkPad L14 Gen 2

What This Guide Achieves

GoalStatus
Fix duplicate repository warningsDone
Resolve GPG key errorsDone
Clean up old .list files (legacy format)Done
Understand .list vs .sources file formatsDone
Safely remove PPAsDone

The Problem (Windows User Perspective)

On Windows, software updates come from one place (Windows Update or the app itself). On Linux, software comes from repositories — external servers that apt checks for packages. When you install Chrome, Edge, Brave, or add PPAs, each one adds its own repository configuration. Over time, these can conflict, duplicate, or break — especially when repository formats changed from .list (old) to .sources (new) in Ubuntu 24.04.


Understanding the Two File Formats

Ubuntu 24.04 introduced a new repository format. Both formats work, but having both for the same repo causes problems.

Old Format: .list files

Location: /etc/apt/sources.list.d/*.list

deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] https://dl.google.com/linux/chrome/deb/ stable main

New Format: .sources files (DEB822)

Location: /etc/apt/sources.list.d/*.sources

Types: deb
URIs: https://dl.google.com/linux/chrome/deb/
Suites: stable
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/google-chrome.gpg

Key insight: When you install Chrome or Edge via .deb, the installer may create a .sources file. If you previously had a .list file from an older install or manual setup, you now have both — and apt update complains about duplicates.


Diagnosing Issues

Check for Duplicates

# List all repository config files
ls /etc/apt/sources.list.d/

# Look for pairs of .list and .sources for the same app
ls /etc/apt/sources.list.d/ | grep google
# Example problematic output:
# google-chrome.list
# google-chrome.sources

Check for Errors

sudo apt update 2>&1 | grep -E "W:|E:|Err"

Common error patterns:

  • W: Target ... is configured multiple times — duplicate repos
  • W: ...doesn't support architecture 'i386' — missing arch restriction
  • Err: ... NO_PUBKEY ... — missing GPG signing key

Fix: Duplicate Repository Entries

Chrome (Most Common)

# Check what exists
ls /etc/apt/sources.list.d/ | grep google

# If BOTH google-chrome.list AND google-chrome.sources exist:
sudo rm /etc/apt/sources.list.d/google-chrome.list

# Verify
sudo apt update

Edge

ls /etc/apt/sources.list.d/ | grep microsoft-edge

# If both formats exist:
sudo rm /etc/apt/sources.list.d/microsoft-edge.list

sudo apt update

Brave

ls /etc/apt/sources.list.d/ | grep brave

# If both formats exist:
sudo rm /etc/apt/sources.list.d/brave-browser-release.list

sudo apt update

General Rule

When both .list and .sources exist for the same app:

  1. Keep the .sources file (new format)
  2. Remove the .list file (old format)
  3. Run sudo apt update to verify

Fix: Architecture Warnings (i386)

N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository '...' doesn't support architecture 'i386'

This means a 64-bit-only repository is configured without specifying arch=amd64.

For .list files:

# Edit the file
sudo nano /etc/apt/sources.list.d/google-chrome.list

# Change:
deb https://dl.google.com/linux/chrome/deb/ stable main
# To:
deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main

For .sources files:

sudo nano /etc/apt/sources.list.d/google-chrome.sources

# Add this line if missing:
Architectures: amd64

Fix: GPG Key Errors

Missing Key (NO_PUBKEY)

W: GPG error: https://dl.google.com/linux/chrome/deb stable InRelease:
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ABCDEF1234567890

Fix — import the key:

# For Chrome
curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg

# For Edge
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-edge.gpg

# For Brave
curl -fsSL https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg | sudo tee /usr/share/keyrings/brave-browser-archive-keyring.gpg > /dev/null

Deprecated apt-key Warning

W: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg)

This means a key was added with the old apt-key add method. Modern Ubuntu uses per-repo keyring files in /usr/share/keyrings/.

Fix — migrate to new format:

# Export the key from legacy keyring
sudo apt-key export KEYID 2>/dev/null | sudo gpg --dearmor -o /usr/share/keyrings/repo-name.gpg

# Update the .sources or .list file to reference the new keyring:
# signed-by=/usr/share/keyrings/repo-name.gpg

Safely Removing PPAs

# List installed PPAs
grep -r "ppa" /etc/apt/sources.list.d/

# Remove a PPA and its source file
sudo add-apt-repository --remove ppa:owner/repo-name

# Clean up afterward
sudo apt update

Full PPA Removal Example (Papirus icons)

sudo apt remove --purge papirus-icon-theme papirus-folders
sudo add-apt-repository --remove ppa:papirus/papirus
sudo apt autoremove
sudo apt update

Full PPA Removal Example (FSearch)

sudo apt remove --purge fsearch
sudo add-apt-repository --remove ppa:christian-boxdoerfer/fsearch-daily
sudo apt autoremove --purge
sudo apt update

Clean State Verification

After fixing repository issues, verify everything is clean:

# Check for errors
sudo apt update 2>&1 | grep -E "W:|E:|Err"

# List all configured repos
ls /etc/apt/sources.list.d/

# Check for duplicate entries
apt-cache policy | grep -E "http" | sort | uniq -d

# Check for orphaned keys
ls /usr/share/keyrings/

What Didn’t Work (and Why)

Approach TriedWhy It Failed
Having both .list and .sources for ChromeCauses “Target is configured multiple times” duplicate warning
Using apt-key add to import GPG keysDeprecated in Ubuntu 24.04 — use /usr/share/keyrings/ instead
Not specifying [arch=amd64] in repo entryTriggers i386 architecture warning on every apt update
Removing a PPA without removing its packages firstPackages remain installed but won’t get updates
Ignoring apt update warningsWarnings accumulate and can eventually become errors

Discussion