20

When I use the command

apt --fix-broken install 

I get the following errors:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
libhogweed4 : Depends: libnettle6 (= 3.3-1+b1) but 3.4-1 is installed
mana-toolkit : Depends: dnsmasq but it is not installable
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

I am unable to install anything because of this.
What can I do?

zx485
  • 2,337
GM games
  • 309

5 Answers5

31

This is not a simple problem, and I faced a similar one just a minute ago. I solved it by running (a variation on):

  • dpkg --force-all --configure -a
  • dpkg --purge --force-depends libnettle6 (cf. this post)
  • apt --fix-broken install
  • apt-get -f install
Clément
  • 436
9

Clement's solution solved only part of the problem in my case, i had to purge all the faulty packages. My issue was like so:

root@MrApollos:/var/cache/apt/archives/partial# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 kali-desktop-base : Depends: kali-themes-common (= 2021.2.3) but 2021.2.1 is installed
 kali-themes : Depends: kali-themes-common (= 2021.2.3) but 2021.2.1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

In my case, I had to run

dpkg --force-all --configure -a

Remove the first faulty package

dpkg --purge --force-depends kali-desktop-base

Remove the second faulty package

dpkg --purge --force-depends kali-themes

Remove the third faulty package

dpkg --purge --force-depends kali-themes-common

apt-get -f install apt update & apt upgrade

2

Restart, close other (automatic) updates that are running in background, then try this:

sudo apt-get install -f
0

Solved this by clearing the apt cache before running the fix.

$ sudo apt clean
$ sudo apt autoclean
$ apt --fix-broken install
AFwcxx
  • 158
0

My distribution upgrade failed and it left my apt in a very broken state (a freshly changed package name refused to overwrite the old package files...). After a half day of struggling, I fixed with the following steps:

  1. Exported upgradable package list with apt: apt list --upgradable|cut -d'/' -f1 > upgradable.txt
  2. Removed the first line (not a package name)
  3. Downloaded all package with apt: cat upgradable.txt|xargs apt download
  4. Installed all downloaded package with dpkg: dpkg -i *.deb
  5. Then I issued a the apt --fix-broken install and a apt dist-upgrade for a good measure.

This ended my struggle. I just don't understand why apt doesn't have a command for this. I also doesn't understand why so hard to continue an apt upgrade if fails in the middle. I can fix the issue, but why can't continue??

GT.
  • 1