The /etc/apt/preferences.d directory is missing from your system, causing APT to warn it cannot read pinning preferences. Recreating this directory resolves the warning.
APT (Advanced Package Tool) looks for package pinning preferences in the /etc/apt/preferences.d directory. When this directory doesn't exist—either due to accidental deletion, failed system restore, or incomplete installation—APT issues a warning that it cannot read preferences. This directory should be present on all Debian-based systems running APT 0.7.22 or later. The warning itself is non-critical and won't prevent APT from functioning, but it indicates a system configuration issue that should be corrected. Missing this directory can also prevent you from using APT pinning, which is useful for managing package versions and repository priorities.
Check if the /etc/apt/preferences.d directory exists:
ls -ld /etc/apt/preferences.dIf you see "No such file or directory", proceed to the next step. If the directory exists but shows permissions errors, skip to the advanced notes section.
Create the missing directory with the correct permissions:
sudo mkdir -p /etc/apt/preferences.dThis creates the directory with default permissions. APT will now have the location available for pinning preferences.
Confirm the directory was created and has correct permissions:
ls -ld /etc/apt/preferences.dThe output should show:
drwxr-xr-x 2 root root 4096 <date> /etc/apt/preferences.dRun apt commands again to confirm the warning is gone:
sudo apt updateThe warning should no longer appear.
If the directory exists but shows permission errors, fix them:
# Ensure root owns the directory
sudo chown root:root /etc/apt/preferences.d
# Set correct permissions (755)
sudo chmod 755 /etc/apt/preferences.dPermission errors typically manifest as "Permission denied" rather than "DirectoryExists", but correcting permissions ensures APT can read the directory properly.
The /etc/apt/preferences.d directory allows administrators to split package pinning rules across multiple files instead of maintaining a single /etc/apt/preferences file. Files in this directory are processed alphabetically and should follow APT's preferences format.
The directory should be owned by root with permissions 755 (drwxr-xr-x). Individual preference files within it should have 644 permissions.
If you're experiencing widespread missing directories under /etc/apt/ (such as sources.list.d and preferences.d simultaneously), this may indicate a failed system backup restore or incomplete apt package installation. In severe cases, you may need to reinstall the apt package or restore from system media. For one-off recreations of just preferences.d, using mkdir -p is sufficient.
E: Cannot set to hold: package 'package-name' is not installed
How to fix "Cannot set to hold" error when package is not installed in APT
debconf: unable to initialize frontend: Dialog
How to fix "debconf: unable to initialize frontend: Dialog" in APT
E: Could not connect to proxy server
Could not connect to proxy server
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt