How to fix W: Conflicting distribution: URL InRelease (expected codename but got codename) in APT
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- Find your system's current codename
- Check sources.list for mismatched codenames
- Update mismatched repository entries
- Update files in sources.list.d/
lsb_release -csW: 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
- 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
- PPA or external repository has mismatched Suite and Codename fields in Release file
- 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)"
Run:
lsb_release -csThis displays your Ubuntu/Debian version codename (e.g., 'focal', 'jammy', 'bullseye').
List your APT sources:
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.
Edit /etc/apt/sources.list:
sudo nano /etc/apt/sources.listReplace the old codename with your current one. For example, change:
deb http://example.com/ubuntu focal mainto:
deb http://example.com/ubuntu jammy mainSave with Ctrl+O, Enter, Ctrl+X.
Check for third-party repository files:
ls -la /etc/apt/sources.list.d/Edit any files with old codenames:
sudo nano /etc/apt/sources.list.d/microsoft-ubuntu-*.listUpdate codenames in these files as well.
If you need updates immediately, allow APT to accept the codename mismatch:
sudo apt update --allow-releaseinfo-changeThis is a workaround; proper fix is updating sources.list to match actual codenames.
Run apt update without warnings:
sudo apt updateThe 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
- 📚APT Official Documentation
- 🐙
- 💬Fix Conflicting values when running apt update(Stack Overflow)