This error occurs when dpkg-deb encounters a malformed or incomplete Debian package archive that lacks the required control file. Fix it by verifying the DEBIAN directory structure when building packages, or re-downloading corrupted .deb files when installing.
The "archive contains no control file" error means dpkg-deb detected that a .deb package archive is missing its control information directory or the control file itself. The control file is essential metadata that describes the package name, version, dependencies, and maintainer information. This error typically occurs in two scenarios: when building a new Debian package from source using dpkg-deb --build, or when trying to install a corrupted or malformed .deb package that was already created.
If you are building a .deb package from source, ensure your package directory structure includes a DEBIAN subdirectory (case-sensitive, must be uppercase):
ls -la my-package/
DEBIAN/
usr/
var/The DEBIAN directory must contain a control file and other metadata files.
Verify the control file exists and is readable:
ls -la my-package/DEBIAN/
control
postinst
prermIf missing, create a minimal control file with:
Package: my-package
Version: 1.0
Architecture: all
Maintainer: Your Name <[email protected]>
Description: Brief descriptionUse the correct dpkg-deb syntax to create the .deb file:
dpkg-deb --build my-package/
# or explicitly specify output filename
dpkg-deb --build my-package/ my-package.debFor compatibility with older systems, add compression options:
dpkg-deb --build --no-uniform-compression -Zgzip my-package/When the error occurs during installation of a downloaded package, the .deb file may be corrupted:
# Clear the package cache
sudo apt-get clean
# Remove the corrupted .deb from the archives directory
sudo rm /var/cache/apt/archives/package-name*.deb
# Update and reinstall
sudo apt-get update
sudo apt-get install package-nameIf the error occurs when installing a newer .deb package on an older system, the dpkg version may not support the package's compression format:
# Check your dpkg version
dpkg --version
# Update dpkg to the latest version
sudo apt-get update
sudo apt-get install dpkgAlternatively, when building packages, ensure backwards compatibility:
# Build with gzip compression for older systems
dpkg-deb --build --no-uniform-compression -Zgzip my-package/The dpkg-deb tool supports multiple compression formats: gzip, xz, and none. Starting with dpkg 1.19.0, uniform compression became the default, meaning all members of the archive use the same compression. Older systems with dpkg 1.16.x or 1.17.x may not recognize newer compression formats like xz in the control.tar member, causing the "archive contains no control file" error. If you're packaging for distribution across different Debian/Ubuntu versions, use --no-uniform-compression and -Zgzip for maximum compatibility. The --nocheck option can bypass validation when building (dpkg-deb --build --nocheck), but this is not recommended for production packages as it may mask other structural issues.
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