One problem that can leave your system unstable is dependencies or orphaned packages leaving after you uninstall a package.

This problem can be solved by installing a tool called debfoster. It tracks what you have installed and ask you to uninstall dependencies files when you uninstalled a program.

sudo apt-get install debfoster

sudo debfoster --help

//create initial keeper
sudo debfoster -q

//system to conform to keeper
sudo debfoster -f

//check orphaned/dependencies files
sudo debfoster

More information: using debfoster in practice