The "dependency problems - leaving unconfigured" dpkg error occurs when a package installation or upgrade is interrupted due to unmet dependencies. This prevents the package from being fully configured. Quick fix: run "sudo apt --fix-broken install" to resolve missing dependencies.
This error happens when dpkg (Debian Package Manager) attempts to configure a package but encounters unmet dependency requirements. The package gets "half-installed"—its files are present but it's not fully functional. The error typically appears during package upgrades, when installing .deb files directly with dpkg, or when system updates are interrupted. Unlike apt, which resolves dependencies automatically, dpkg alone cannot fetch and install missing packages, leaving the system in an inconsistent state.
Run dpkg with the -a flag to attempt configuring all unconfigured packages:
sudo dpkg --configure -aThis forces dpkg to retry configuration for any packages left in an inconsistent state. Often this resolves the issue by itself if the dependencies are already installed.
If the first step doesn't work, use apt to install missing dependencies:
sudo apt --fix-broken installThis command tells apt to download and install any missing dependencies required by the problematic package, then reconfigure it. This is the most common solution.
Alternatively, use the legacy flag:
sudo apt-get install -fBoth commands do the same thing. Apt will show what it plans to install and ask for confirmation.
If the above steps don't work, clear apt's cache and retry:
sudo apt clean
sudo apt autoclean
sudo apt update
sudo apt --fix-broken installSometimes stale cache entries prevent proper dependency resolution. Cleaning and updating the package index can help.
If the error persists, see which package is actually failing:
sudo apt full-upgradeOr list packages in an inconsistent state:
dpkg -l | grep '^iH'The output shows which packages are half-installed. You can then manually inspect what went wrong for that specific package.
If the above steps fail, remove the package entirely and reinstall it:
# Remove the half-installed package
sudo apt remove package-name
# Reinstall it
sudo apt install package-nameOnly do this if you're sure the package isn't a critical dependency for your system. Removing the wrong package can break your system.
For kernel-related packages (linux-image, linux-headers), be especially careful—removing them can make the system unbootable.
Understanding dpkg vs apt: dpkg is the low-level package tool that handles .deb files. It does not automatically fetch dependencies from repositories—it only manages files already present on the system. apt, conversely, resolves dependencies automatically by downloading them from configured repositories.
Always use 'apt' or 'apt-get' for normal package operations. Only use 'dpkg -i' directly when you have a specific .deb file and have already installed its dependencies via apt first.
If you install a .deb file with 'dpkg -i' instead of 'apt install ./package.deb', you'll encounter this error if dependencies are missing. The correct way is:
sudo apt install ./path/to/package.debThis tells apt to install the file while resolving its dependencies.
For persistent issues: If apt still cannot resolve the dependency, check:
- Are you using custom PPAs? They may have incompatible package versions.
- Is the package available in your enabled repositories? Check /etc/apt/sources.list and /etc/apt/sources.list.d/
- Is there a version mismatch? A newer package might depend on a library version not yet available in your repos.
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