Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Fix Broken Packages in Kali Linux

Spot a broken package, then repair it with apt and dpkg.

VPS and Cloud Servers2 min read2 screenshots

How to spot broken packages

  • Error messages. apt says "unmet dependencies", "broken packages" or "held broken packages" during an install or update.
  • Check the package list:
sudo apt list --installed
The list of packages
  • Find damaged packages. This lists packages in a bad state:
dpkg -l | grep ^..r

Fixes

Try them in this order.

1. Update and fix missing

sudo apt update && sudo apt upgrade -f
Updating and fixing missing packages

You can also use sudo apt --fix-broken install.

2. Reinstall the package

sudo apt install --reinstall <package_name>

3. Configure half-installed packages with dpkg

sudo dpkg --configure -a

4. Force an overwrite

If a package fails because a file belongs to another package:

sudo apt install -o dpkg::options::="--force-overwrite" <package_name>
Warning: Use this only when you know which file clashes. It can replace system files.

5. Remove and install again

sudo apt remove --purge <package_name>
sudo apt update
sudo apt install <package_name>

Good habits

  • Run apt update and apt upgrade on a regular basis.
  • Use only the official Kali repositories.
  • Search the exact error text if the problem is new.
  • Write down the changes you make to packages.

Quick recap

  • apt --fix-broken install and dpkg --configure -a fix most cases.
  • Reinstall or purge the package that fails.
  • Keep Kali updated.