How to fix dpkg: error processing archive filename.deb: short read in buffer_copy in APT
The "short read in buffer_copy" error indicates a corrupted .deb file that dpkg cannot extract. This typically happens due to incomplete downloads, hardware failures, or corrupted package mirrors. Clear your apt cache and re-download the package to resolve the issue.
Quick fix
Fixes dpkg: error processing archive filename.deb: short read in buffer_copy
sudo apt clean
sudo apt update- Clear the apt package cache
- Re-attempt the installation with force-depends if needed
- Try a different mirror (if cache clear doesn't work)
- Check disk health and filesystem integrity
sudo apt cleansudo apt updatedpkg: error processing archive filename.deb: short read in buffer_copy
What this error means
This error occurs when dpkg tries to extract files from a .deb package but encounters corrupted or truncated data. The decompression layer discovers unexpected data, causing the extraction process to end prematurely. Dpkg reports that it did not receive all the data that was announced in the package header—hence the "short read" error. This is essentially dpkg's way of indicating the .deb file itself is damaged or incomplete, rather than an issue with the installation process itself.
Typical symptoms
- Package installation fails with error message mentioning "short read in buffer_copy"
- System cannot complete package updates or installations
- Error occurs during apt upgrade or apt install commands
- Partial or interrupted downloads may leave corrupted .deb files
Common causes
- Incomplete or interrupted package download (network interruption, timeout, or connection drop)
- Corrupted package on the mirror server being used
- Hardware failure or disk corruption during file transfer or storage
- Sudden system shutdown or power failure during package installation
- Antivirus software or security tools interfering with file integrity
- Corrupted filesystem using delayed allocation (ext4, xfs, btrfs)
How to fix "dpkg: error processing archive filename.deb: short read in buffer_copy"
Remove all cached .deb files and fetch fresh copies:
sudo apt clean
sudo apt updateThe apt clean command removes all cached package files in /var/cache/apt/archives/, ensuring you get fresh downloads of any corrupted packages.
Try installing the package again, or use the fix-broken flag:
sudo apt install -fThis will attempt to fix any broken dependencies and re-download packages. If you were installing a specific package:
sudo apt install <package-name>If the error persists, the mirror server itself may be distributing a corrupted package. Change your apt mirror:
1. Edit /etc/apt/sources.list or relevant .list files in /etc/apt/sources.list.d/
2. Replace the current mirror URL with an alternative one
3. Run sudo apt update again
For Ubuntu users, you can use the mirror selection tool:
sudo software-properties-gtkThen select a different mirror from the dropdown.
If the error continues across multiple packages, check your storage device:
dmesg | tail -20Look for hardware errors. If you suspect disk corruption, run a filesystem check (requires root and ideally a non-root partition):
sudo fsck.ext4 -n /dev/sdX # -n flag does a read-only checkIf errors are found, run without -n to fix them (requires unmounting the partition first).
Insufficient disk space can cause failed writes and file corruption:
df -hEnsure you have at least 100-200 MB free space in /var. If disk space is low, delete unnecessary files or uninstall unneeded packages.
Some antivirus software (like ESET NOD32) can interfere with package integrity checking. If you have antivirus running:
1. Temporarily disable real-time scanning
2. Attempt the package installation again
3. Re-enable the antivirus after completion
If this resolves the issue, configure your antivirus to exclude /var/cache/apt/ and /var/lib/apt/ from scanning.
Advanced notes
This error has been documented since the early dpkg versions (bug #158999 in 2002) and remains common. The error message itself is somewhat misleading—it's actually coming from zlib decompression rather than a true buffer read operation. On systems with filesystems supporting delayed allocation (ext4, xfs, btrfs), sudden power failures during package installation can cause this error. If you frequently encounter this error, it may indicate underlying hardware problems. Monitor dmesg and system logs for correlating hardware errors, especially if multiple packages fail. For CI/CD environments, implement retry logic with cache clearing between attempts, and ensure mirrors are health-checked before directing traffic to them.
Frequently asked questions
- What does "dpkg: error processing archive filename.deb: short read in buffer_copy" mean?
- deb package but encounters corrupted or truncated data. The decompression layer discovers unexpected data, causing the extraction process to end prematurely. Dpkg reports that it did not receive all the data that was announced in the package header—hence the "short read" error.
- How do I fix "dpkg: error processing archive filename.deb: short read in buffer_copy"?
- The "short read in buffer_copy" error indicates a corrupted .deb file that dpkg cannot extract. This typically happens due to incomplete downloads, hardware failures, or corrupted package mirrors. Clear your apt cache and re-download the package to resolve the issue.
- What causes "dpkg: error processing archive filename.deb: short read in buffer_copy"?
- Incomplete or interrupted package download (network interruption, timeout, or connection drop) Corrupted package on the mirror server being used Hardware failure or disk corruption during file transfer or storage
- Is the "dpkg: error processing archive filename.deb: short read in buffer_copy" 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
- 📖Ubuntu Wiki: Debugging Installation Issues(Official Docs)