"apt-get -f install" fails with "/usr/bin/dpkg returned an error code (1)" [duplicate]

http://www.iasptk.com/ubuntu-fix-broken-package-best-solution

After trying

sudo dpkg --configure -a

and

sudo apt-get install -f

the problem of a broken package still exist the solution is to edit the dpkg status file manually.

`sudo nano /var/lib/dpkg/status`    (you can use vi or gedit instead of nano)

Locate the corrupt package, and remove the whole block of information about it and save the file.