rebuild pkg stuff:
sudo dpkg –configure -a

remove pkg:
apt-get autoremove

fix installed pkg:
sudo apt-get -f install