Comment 40 for bug 634487

mr.b (mr.b) wrote :

On how to fix corrupted apt-get/dpkg:

1. Run: dpkg -l |grep -v -E "^ii"

This will list all packages that are either not in perfectly installed state; either incompletely installed, or that have config files remaining behind them after they have been uninstalled (or some other variant). You can tell them apart by value in first column. (rc = removed & conf-files; iU = install & unpacked). See listing header ("dpkg -l | head" for detailed meanings).

2. Run: dpkg -P package_name [package_name2] [package_name3 ...]

This will purge those incomplete packages.

Personally, I have removed all listed packages (as they were all related to broken jre install), and dpkg was running without a problem afterwards.