sudo apt-get install -f sudo dpkg --configure -a
$ sudo dpkg --list then look for a package with the name of the one you're trying to install eg mysql and purge them by name. I repeat by name. $sudo apt-get purge <package name>