apt --fix-broken install not working

Solution 1

As HVNSweeting says in their answer, they fixed it by following the below:

First, run:

dpkg -l | grep ^iU | awk '{print $2}' | xargs sudo dpkg --purge

If the output is:

dpkg: error: --purge needs at least one package name argument

Type dpkg --help for help about installing and deinstalling packages []; Use 'apt' or 'aptitude' for user-friendly package management; Type dpkg -Dhelp for a list of dpkg debug flag values; Type dpkg --force-help for a list of forcing options; Type dpkg-deb --help for help about manipulating .deb files;

Options marked * produce a lot of output - pipe it through 'less' or 'more' !

Then go to the next solution, or run:

sudo apt update && sudo apt upgrade

Done!

Solution 2

You need to clear the contents of /var/lib/dpkg/status.

To do the above:

Backup the file by running:

sudo cp -r /var/lib/dpkg/status $HOME

Then clear the contents by running:

echo > /var/lib/dpkg/status

After that run:

sudo apt update && sudo apt upgrade