If you ever experience that your solution never retracts (or deploys), first verify that the SharePoint Administration Service is running. If it is, restart it and see if that helps.
If your solution is still stuck, start Sharepoint 2010 Management Shell and type in the following command:
stsadm -o enumdeployments
You will see a list of in-progress or pending jobs. Cancel the pending job, either by STS / Powershell commands or through the Solution Management. No point wasting any more time – Sharepoint’s showed you another one of its ugly sides so just run this command to force your solution to be deleted:
Remove-SPSolution -Identity the_name_of_your_solution.wsp -force
There, it’s gone. But now you will most likely get an error message when re-deploying your solution:
This is because after forced solution removal, Sharepoint still believes the feature is installed. You’ll therefore have to deploy your solution from SharePoint 2010 Management Shell with the –force attribute:
Install-SPSolution -Identity the_name_of_your_solution.wsp -AllWebApplications -GACDeployment –force
Note: make sure you match the scope (“AllWebApplications”) of your solution.
If your solution is STILL stuck, stop the Sharepoint Administration Service and manually trigger the administration jobs from Sharepoint 2010 Management Shell:
stsadm.exe -o execadmsvcjobs