How to get dpkg working again?

i tried to install sqlite3 on ubuntu 10.04 by typing:

sudo apt-get install sqlite3

this gave me the message

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

so i tried the "sudo dpkg --configure -a", no error. I tried to install sqlite3 again. This time it showed what updates will be done. So i continued and received this error message (partially translated from greman):

Unpacking substitution for ubuntu-docs ...
dpkg: ../../src/archives.c:763: tarobject: Assertion »r == stab.st_size« not fullfilled 
E: Sub-process /usr/bin/dpkg exited unexpectedly

i hope that some experts in here can help me :)


Turns out one package (ubuntu-docs) was in an inconsistant state, which lead to the error message shown above.

I found this post on UbuntuFormus and used

sudo dpkg --force-all -r ubuntu-docs

to force the removal of all ubuntu-docs related package information. apt-get/aptitude purge/remove (even with force) didn't work because of the inconsistant state.

Be cautious when using this command because it might destroy your system