How do I fix a "Previous installation hasn't been completed." error in Software Center?

Ubuntu Software Center crashes whenever I try to install something. It shows the following error:

Previous installation hasn't been completed.

The installation could have failed because of an error in the corresponding software package or it was cancelled in an unfriendly way. You have to repair this before you can install or remove any further software.

How do I fix this?


Simply install anything through the terminal, such as ccsm Using sudo apt-get install ccsm. If it fails to install, check its output. It will tell you a recommended solution, or a command to run to fix it. At most times, the command is sudo dpkg --configure -a But it varies according to the problem.