Pre-Steps-1 (Remove the apt-get package locks)
$ sudo rm -rf /var/lib/apt/lists/lock /var/cache/apt/archives/lock /var/lib/dpkg/lock
Pre-Steps-2 (Restart your Ubuntu / Debian distribution)
$ sudo init 6
Step-1 (Remove the repository cache using apt-get package manager)
$ sudo apt-get clean all
Step-2 (Update the repository cache using given commands)
$ sudo apt-get update
Step-3 (Upgrade the packages to upgrade the distributions)
$ sudo apt-get upgrade
Step-4 (Now run distribution upgrade command to update the packages)
$ sudo apt-get dist-upgrade
Step-5 (Find broken packages list to fix)
$ sudo dpkg -l | grep ^..r
Note: After the above command it shows the list of broken packages and you need to note all the broken packages name to remove it one by one using given commands.
Step-6 (Force removal of broken packages using given commands)
$ sudo apt-get remove package-name
Note: You must change the
broken-packages-namethat you have noted earlier.If above commands won’t works then given command is necessary to remove it forcefully.
$ sudo dpkg --force-all --remove package-name
Finally you have fixed above broken packages using above apt-get and dpkg package mangers using above commands. Above fix is useful to fix those broken packages and If you have some issues then you need to use the comment section below for more help and support.