How to fix W: Conflicting distribution: URL InRelease (expected codename but got codename) in APT

APTINTERMEDIATEMEDIUMUpdated Dec 29, 2025· 252 views

This warning appears when an APT repository's metadata (InRelease file) reports a different distribution codename than what your sources.list expects. This typically happens after system upgrades or when third-party repositories are misconfigured.

Quick fix

Fixes W: Conflicting distribution: URL InRelease (expected codename but got codename)

lsb_release -cs
  1. Find your system's current codename
  2. Check sources.list for mismatched codenames
  3. Update mismatched repository entries
  4. Update files in sources.list.d/
apt — error
lsb_release -cs
W: Conflicting distribution: URL InRelease (expected codename but got codename)

What this error means

APT (Advanced Package Tool) validates that repositories match your system's distribution. When a repository's Release file specifies a different codename than configured, APT warns about the mismatch. This can occur because a system was upgraded without updating repository sources, a third-party PPA was configured for a different Ubuntu/Debian version, or a repository's metadata changed on the upstream server.

Typical symptoms

  • Warning message appears during 'apt update' but updates may still proceed
  • Repository metadata cannot be trusted without explicit user acceptance
  • CI/CD pipelines may fail if they treat warnings as errors
  • Multiple repositories with similar codename mismatches

Common causes

  1. System was upgraded (e.g., Ubuntu 16.04 to 18.04) but sources.list still references old codename
  2. Third-party repository configured for different distribution version
  3. Repository metadata changed on upstream server without local configuration update
  4. PPA or external repository has mismatched Suite and Codename fields in Release file
  5. Using development/rolling release aliases that don't match sources.list configuration

How to fix "W: Conflicting distribution: URL InRelease (expected codename but got codename)"

1Find your system's current codename

Run:

bash
lsb_release -cs

This displays your Ubuntu/Debian version codename (e.g., 'focal', 'jammy', 'bullseye').

2Check sources.list for mismatched codenames

List your APT sources:

bash
grep -r '^deb' /etc/apt/sources.list /etc/apt/sources.list.d/

Compare each codename against your actual system codename from step 1. Look for entries that don't match.

3Update mismatched repository entries

Edit /etc/apt/sources.list:

bash
sudo nano /etc/apt/sources.list

Replace the old codename with your current one. For example, change:

bash
deb http://example.com/ubuntu focal main

to:

bash
deb http://example.com/ubuntu jammy main

Save with Ctrl+O, Enter, Ctrl+X.

4Update files in sources.list.d/

Check for third-party repository files:

bash
ls -la /etc/apt/sources.list.d/

Edit any files with old codenames:

bash
sudo nano /etc/apt/sources.list.d/microsoft-ubuntu-*.list

Update codenames in these files as well.

5Accept repository metadata changes (temporary fix)

If you need updates immediately, allow APT to accept the codename mismatch:

bash
sudo apt update --allow-releaseinfo-change

This is a workaround; proper fix is updating sources.list to match actual codenames.

6Verify the fix

Run apt update without warnings:

bash
sudo apt update

The warning should no longer appear if all repositories now match your system's codename.

Advanced notes

On Debian systems, check /etc/os-release for the VERSION_CODENAME field if lsb_release is not available. Some repositories intentionally use 'stable' or 'rolling' instead of specific codenames—in those cases, update your sources.list to match the repository's actual codename, not your system version. This is particularly common with Kali Linux (which uses 'rolling') and custom repository mirrors. For Docker images, ensure the base image distribution matches configured repositories. The --allow-releaseinfo-change flag should only be used when you explicitly trust the repository's change; always verify the repository URL and signing key.

Frequently asked questions

What does "W: Conflicting distribution: URL InRelease (expected codename but got" mean?
APT (Advanced Package Tool) validates that repositories match your system's distribution. When a repository's Release file specifies a different codename than configured, APT warns about the mismatch. This can occur because a system was upgraded without updating repository sources, a third-party PPA was configured for a different Ubuntu/Debian version, or a repository's metadata changed on the upstream server.
How do I fix "W: Conflicting distribution: URL InRelease (expected codename but got"?
This warning appears when an APT repository's metadata (InRelease file) reports a different distribution codename than what your sources.list expects. This typically happens after system upgrades or when third-party repositories are misconfigured.
What causes "W: Conflicting distribution: URL InRelease (expected codename but got"?
System was upgraded (e.g., Ubuntu 16.04 to 18.04) but sources.list still references old codename Third-party repository configured for different distribution version Repository metadata changed on upstream server without local configuration update
Is the "W: Conflicting distribution: URL InRelease (expected codename but got" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading