The "failed to read archive" error occurs when dpkg-deb cannot parse a .deb package file, usually due to corruption, an incomplete download, or an unsupported compression format. This guide covers diagnosis and repair strategies.
When dpkg-deb encounters a .deb archive that does not conform to the Debian package format, it cannot extract the control files and payload. This error means the file header is invalid, the file is corrupted, or the compression method is not supported by your dpkg version. The dpkg package manager relies on these archives to install software, so a malformed archive blocks installation entirely.
The most common cause is a failed or corrupted download. Remove the problematic file and download it again from the official repository or source:
rm ~/path/to/package.deb
wget https://example.com/package.debVerify the file is not empty or truncated:
file package.debA valid .deb file should show as "Debian binary package".
If the package was downloaded via apt, cached corrupted versions may persist. Clear the entire cache:
sudo apt cleanOr remove only the problematic package:
sudo rm /var/cache/apt/archives/package-name*.debThen retry the installation.
Older dpkg versions do not support modern compression formats. Update to ensure compatibility:
sudo apt update
sudo apt install --only-upgrade dpkgIf you are blocked from apt, download dpkg manually from your distribution's repository and install with: sudo dpkg -i dpkg*.deb
If the installation was interrupted mid-way, the dpkg database may be in an inconsistent state. Reconfigure all packages:
sudo dpkg --configure -aThis command tells dpkg to finish configuring any partially installed packages.
After reconfiguring, resolve any lingering dependency issues:
sudo apt install -fThis command installs or removes packages to satisfy dependencies.
If the error persists across multiple packages, your storage device may have hardware issues. Check system logs for I/O errors:
sudo dmesg | tail -20Look for messages about read/write errors or timeout. If found, run a file system check on the next reboot:
sudo fsck -n /dev/sdX(Replace sdX with your device; use -n to preview without making changes)
As a last resort, if you are certain the package is safe, attempt installation with the --force-overwrite flag:
sudo dpkg -i --force-overwrite package.debUse this only if you trust the package source and have no other options.
For advanced users: if dpkg-deb shows specific errors like "archive uses unknown compression for member 'control.tar.zst'", this indicates your dpkg version is too old to handle zstd-compressed packages. Ensure you are on the latest stable release of your distribution. On systems where apt itself is broken, you may need to manually download and install dpkg first, then proceed with other packages. For developers creating .deb packages, ensure the archive structure is correct: control.tar.{gz,xz,zst} must precede data.tar.{gz,xz,zst}, and both must be preceded by the debian-binary file.
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: Sub-process /usr/bin/dpkg returned an error code (2)
How to fix "Sub-process /usr/bin/dpkg returned an error code (2)" in APT
dpkg-divert: error: rename involves overwriting 'path' with different file
How to fix dpkg-divert rename conflicts in APT
E: Sub-process /usr/bin/dpkg returned an error code (1) during kernel installation
How to fix "dpkg returned an error code (1)" in APT kernel installation
dpkg: dependency problems prevent configuration of triggers
dpkg: dependency problems prevent configuration of triggers in apt