The "invalid for APT::Default-Release" error occurs when the release name specified in your APT configuration doesn't match any release in your sources.list. This prevents apt from finding the specified distribution, causing package installation to fail.
This error happens when APT tries to use a default release that doesn't exist in your configured package sources. The APT::Default-Release setting tells apt which Debian/Ubuntu release to prefer when multiple versions of a package are available. When the specified release name (like "stable", "bookworm", or "jammy") doesn't appear in any of your sources.list entries, APT rejects it. Common scenarios include: - Setting APT::Default-Release to "stable" when your sources only have codename-based entries like "bookworm" - Trying to use a release that's no longer supported on your system - Referencing a backports release that isn't configured in sources.list - Typos in the release name configuration
Search for the Default-Release setting in your APT configuration files:
grep -r "Default-Release" /etc/apt/This will show where the setting is configured. Common locations are:
- /etc/apt/apt.conf
- /etc/apt/apt.conf.d/ (various files in this directory)
- /root/.synaptic/synaptic.conf (if using Synaptic package manager)
Note the exact value that's set (e.g., 'stable', 'bookworm', 'jammy').
Check what releases are actually configured in your sources:
cat /etc/apt/sources.list
cat /etc/apt/sources.list.d/*Look at the fourth column of each deb line - this is the release name. For example:
- deb http://deb.debian.org/debian bookworm main - releases named "bookworm"
- deb http://deb.debian.org/debian stable main - releases named "stable"
Compare this with the value from step 1. If your Default-Release doesn't appear in any line, that's your problem.
You have three options:
Option A: Update Default-Release to match your sources (recommended)
If your sources use codenames like "bookworm", update APT config:
# Edit the file where Default-Release was found
sudo nano /etc/apt/apt.conf.d/00local
# Change: APT::Default-Release "bookworm";
# (Use the actual release names from your sources.list)Option B: Update sources.list to include the desired release
If you want to use "stable" or another suite name, add it to sources:
echo "deb http://deb.debian.org/debian stable main contrib non-free" | sudo tee -a /etc/apt/sources.list.d/stable.listOption C: Remove the Default-Release configuration entirely
The safest option if you don't need a default release:
# Find and comment out or remove the Default-Release line
sudo nano /etc/apt/apt.conf.d/00local
# or delete the file if it only contains this setting:
sudo rm /etc/apt/apt.conf.d/00localAfter making changes, update the package cache:
sudo apt updateOnce you've fixed the configuration, test apt:
sudo apt install -y package-nameReplace package-name with any package you want to install. If this succeeds without the error, your fix worked.
If you still see the error, double-check:
1. You edited the correct file
2. The syntax is valid (APT config uses quotes and semicolons)
3. You ran sudo apt update after making changes
4. The release name exactly matches what's in sources.list (case-sensitive)
Understanding APT::Default-Release
This setting is primarily useful when you have multiple versions of the same package available from different releases. For example, if you have both "stable" and "testing" in your sources, APT might offer both old and new versions of a package. The Default-Release setting tells APT which to prefer.
Release naming in Debian/Ubuntu
Debian uses two naming schemes:
- Suite names: "stable", "testing", "unstable", "oldstable"
- Codenames: "bookworm" (current stable), "trixie" (testing), "sid" (unstable)
Ubuntu uses version names: "focal", "jammy", "noble", etc.
These are often NOT interchangeable in APT configuration. If your sources use codenames, your Default-Release should also use codenames.
Backports special case
If you use backports (backported newer packages for older releases), don't set it as Default-Release. Instead, use APT pinning in /etc/apt/preferences to selectively pull backports packages only when explicitly requested:
Package: *
Pin: release a=bookworm-backports
Pin-Priority: 100Then install from backports with: sudo apt install -t bookworm-backports package-name
E: Could not connect to proxy server
Could not connect to proxy server
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt
dpkg: error: unable to create new file 'path': Permission denied
How to fix dpkg permission denied errors in APT
subprocess installed post-removal script returned error exit status 1
How to fix "subprocess installed post-removal script returned error exit status 1" in APT
dpkg: error processing package package-name (--install)
How to fix "dpkg: error processing package" in apt