After trying

sudo apt-get update –fix-missing

and

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.

  1. sudo nano /var/lib/dpkg/status    (you can use vim or gedit instead of nano)
  2. Locate the corrupt package, and remove the whole block of information about it and save the file.

———–

Unlock the dpkg – (message /var/lib/dpkg/lock)

sudo fuser -vki /var/lib/dpkg/lock

sudo dpkg –configure -a

For 12.04 and newer:

You can delete the lock file with the following command:

sudo rm /var/lib/apt/lists/lock

You may also need to delete the lock file in the cache directory

sudo rm /var/cache/apt/archives/lock