Question: I get an error on my server with apt-get, and it will not let me install any new packages. What should I do?
Answer: Depending on the error, there are a number of solutions you can try. The first is to tell APT to resolve any unfinished transactions or unmet dependences. As root or with sudo, type:
apt-get -f install
This will finish any installs that might have been interrupted or remove packages that were installed manually and cannot be completed because of dependency problems. If your packages were downloaded and installed but did not finish configuring, you can also run dpkg as root or with sudo:
dpkg --configure -a
This will finished any outstanding configurations. If those two general fixes do not work, you will need to diagnose the specific problem. Try searching some Linux forums or specific support pages for your distribution. Your web hosting provider might also have a knowledge base. Chances are, if you have a problem, others have experienced it as well.