How to fix E: The value 'priority' is invalid for APT::Preferences in APT
This error occurs when the Pin-Priority field in /etc/apt/preferences or /etc/apt/preferences.d/ contains an invalid value. Pin-Priority must be a positive or negative integer, and common causes include non-numeric values, missing the Pin-Priority keyword, or incorrect syntax formatting.
Quick fix
Fixes E: The value 'priority' is invalid for APT::Preferences
cat /etc/apt/preferences
ls -la /etc/apt/preferences.d/- Check for syntax errors in your preferences files
- Verify the correct Pin-Priority syntax
- Correct invalid priority values
- Ensure proper file formatting
cat /etc/apt/preferencesls -la /etc/apt/preferences.d/E: The value 'priority' is invalid for APT::Preferences
What this error means
APT (Advanced Package Tool) validates the syntax of your preferences configuration files when parsing them. The error "The value 'priority' is invalid for APT::Preferences" indicates that APT encountered a malformed or invalid value in the Pin-Priority field. This field controls package installation priorities and must be an integer between -1 and an upper limit (typically 1000+). When APT reads your preferences files, it strictly validates this field and will reject any non-numeric values, malformed syntax, or invalid configurations.
Typical symptoms
- apt update, apt install, or apt-get commands fail with the error message
- Package manager becomes unusable until the preferences file is fixed
- APT operations that read preferences files consistently fail
- Error appears when running any apt-related command that needs to evaluate package priorities
Common causes
- Using 'Priority' instead of the correct 'Pin-Priority' keyword
- Non-numeric values in the Pin-Priority field (e.g., 'high', 'low', 'medium' instead of numbers)
- Special characters or invalid syntax in the priority value
- Missing blank lines between preference blocks causing parsing errors
- Extra whitespace or tabs in the preferences file
- Invalid Pin syntax or malformed Pin field definition
How to fix "E: The value 'priority' is invalid for APT::Preferences"
List and examine all APT preferences files:
cat /etc/apt/preferences
ls -la /etc/apt/preferences.d/Look for recently modified or added files. The error message typically indicates which file has the problem.
Ensure each preference block follows the correct format:
Package: package-name
Pin: release a=stable
Pin-Priority: 500
Package: another-package
Pin: origin example.com
Pin-Priority: 900Note that the keyword is Pin-Priority (not Priority), and the value must be a positive or negative integer.
Replace any non-numeric or text-based priority values with valid integers:
- Priority 0-99: Install only if no other version exists
- Priority 100-499: Install unless newer version from another source
- Priority 500-989: Install unless target release version is available
- Priority 990+: Install even if it's a downgrade
- Negative values: Prevent the version from being installed
Do NOT use text values like 'high', 'low', 'medium', or 'priority'.
Verify each preferences block is properly separated:
- Each block must end with a blank line (except the last block)
- No trailing whitespace after values
- File must end with a newline character
- Files in /etc/apt/preferences.d/ must have valid names (alphanumeric, hyphen, underscore, period only)
You can use a text editor to check:
nano /etc/apt/preferences
# or
vim /etc/apt/preferencesAfter making corrections, test the configuration:
apt-cache policyIf no errors appear, the syntax is valid. Then try a normal APT operation:
sudo apt updateIf you cannot identify the error, temporarily rename the preferences file:
sudo mv /etc/apt/preferences /etc/apt/preferences.bak
sudo apt updateIf this works, the issue was in the main preferences file. You can then examine the backup and fix it, or remove the file entirely if it's not needed.
Advanced notes
The Pin-Priority field accepts any integer value, but APT interprets them in specific ranges. Values equal to 0 have undefined behavior and should never be used. If you're using preferences for multiple distribution pinning, remember that the first matching specific-form record wins, so place wildcard pins first. The files in /etc/apt/preferences.d/ are parsed in alphanumeric order, which can affect which rule takes precedence if multiple files define preferences for the same package. For debugging, you can run apt-cache policy <package> to see how APT is interpreting your preferences for a specific package.
Frequently asked questions
- What does "E: The value 'priority' is invalid for APT::Preferences" mean?
- APT (Advanced Package Tool) validates the syntax of your preferences configuration files when parsing them. The error "The value 'priority' is invalid for APT::Preferences" indicates that APT encountered a malformed or invalid value in the Pin-Priority field. This field controls package installation priorities and must be an integer between -1 and an upper limit (typically 1000+).
- How do I fix "E: The value 'priority' is invalid for APT::Preferences"?
- This error occurs when the Pin-Priority field in /etc/apt/preferences or /etc/apt/preferences.d/ contains an invalid value. Pin-Priority must be a positive or negative integer, and common causes include non-numeric values, missing the Pin-Priority keyword, or incorrect syntax formatting.
- What causes "E: The value 'priority' is invalid for APT::Preferences"?
- Using 'Priority' instead of the correct 'Pin-Priority' keyword Non-numeric values in the Pin-Priority field (e.g., 'high', 'low', 'medium' instead of numbers) Special characters or invalid syntax in the priority value
- Is the "E: The value 'priority' is invalid for APT::Preferences" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐APT Official Documentation
- ๐