The apt package manager cannot access or find the /var/cache/apt/archives/partial directory, typically due to permission issues or accidental deletion. This error prevents package installations and updates. Recreating the directory and fixing permissions resolves the issue.
This error occurs when apt tries to download and cache package files but cannot access the required partial directory. The "partial" directory is a temporary staging area where apt stores incomplete downloads before moving them to the main archives folder. When this directory is missing or has incorrect ownership, apt cannot proceed with package operations, whether installing new packages or cleaning the cache. The error code 13 specifically indicates a permission denial, meaning the current user (or the _apt system user) lacks the necessary access rights to the directory.
Open a terminal and run the following command with sudo privileges:
sudo mkdir -p /var/cache/apt/archives/partialThe -p flag ensures all parent directories are created if they don't exist. This single command usually resolves the issue immediately.
The partial directory must be owned by the _apt system user. Run these commands:
sudo chown -R _apt:root /var/cache/apt/archives/partial
sudo chmod 700 /var/cache/apt/archives/partialThe chown command sets ownership to _apt user and root group. The chmod command sets permissions to 700 (read, write, execute for owner only). This prevents other users from accessing the cache, which is the intended security model.
Create the lock file that apt uses to prevent simultaneous operations:
sudo touch /var/cache/apt/archives/lock
sudo chmod 640 /var/cache/apt/archives/lockThis ensures apt can properly coordinate multiple operations on the cache.
Test that apt works again:
sudo apt-get updateIf successful, you should see the normal package list update output. You can also verify the cache is working:
sudo apt-get autocleanThis removes old cached package files and demonstrates that apt can now access the archives directory.
The /var/cache/apt/archives directory is critical to apt's security model. Never use rm -rf to delete files or subdirectories from this location. Always use apt-get clean (removes all cached packages) or apt-get autoclean (removes only outdated cached packages) for proper cache management. On systems with very limited storage (CF cards, small SSDs), some distributions mount /var/cache/apt as a tmpfs (in-memory filesystem). These systems should add mkdir -p /var/cache/apt/partial /var/cache/apt/archives/partial to /etc/rc.local to recreate the directories on each boot. If you regularly run into disk space issues, consider implementing a cron job to periodically run apt-get autoclean instead of manually deleting the cache.
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
E: The value 'value' is invalid for APT::Default-Release
How to fix invalid APT::Default-Release value 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