- How to Fix broken package script - Ubuntu

When a command in the package script returns error for some reason and the script exits with error, the package management system aborts their action and ends up with partially installed packages. When a package contains bugs in its removal scripts, the package may become impossible to remove and quite nasty.

For the package script problem of "package_name", you should look for:
/var/lib/dpkg/info/package_name.preinst
/var/lib/dpkg/info/
package_name.postinst
/var/lib/dpkg/info/
package_name.prerm
/var/lib/dpkg/info/
package_name.postrm
You edit the offending part of the script from the root:
by prepending it with "#" or,
by appending it with "|| true". 
Then configures all partially installed packages by: # dpkg --configure -a


source:http://linuxpoison.blogspot.com/2010/08/13578167755813.html