recovery from "rm -rf /var/lib/dpkg/info" ?

Ben Collins ben.collins at
Wed Aug 22 18:01:01 UTC 2007

On Wed, 2007-08-22 at 13:37 -0400, Kristian Erik Hermansen wrote:
> Hey guys,
> I did something dumb.  I was playing around with some debs and hacking
> some control files, when I accidentally removed /var/lib/dpkg/info !!!
>  Now, if I even try to do 'aptitude reinstall ~i', I am greeted with
> "Writing extended state information... Error!".  dpkg --list still
> shows all the currently installed packages, but I am unable to
> reinstall.  Does anyone have a good idea on how to recover from
> this???  Ideally, I think it would be easiest to reinstall all the
> packages, since they are all from the repositories and none are
> non-standard.
> Let me just state that I do not want to do any file recovery, even
> though I know quite well how to do that.  This should be able to be
> reversed with some apt/dpkg kung-fu...

sudo apt-get --reinstall install `dpkg --get-selections | grep '[[:space:]]install' | cut -f1`

This _might_ work. There is no silver bullet to fix your problem other
than file backups.

Ubuntu   :

More information about the ubuntu-server mailing list