dpkg exit with error "cannot scan updates directory `/var/lib/dpkg/updates/': No such file or directory", how to fix it?

Solution 1:

Open a terminal and type the following:

sudo mkdir -p /var/lib/dpkg/{updates,alternatives,info,parts,triggers}
sudo killall apt* software-center* dpkg
sudo apt-get update
sudo apt-get purge wine1.4 ia32-libs-multiarch
sudo apt-get upgrade

The first command gets rid of the "cannot scan updates directory" (along with the disaster of the rm -r), then we need to end any dkpg/apt instance to get rid of "Unable to lock" message. Third, lets clean the package cache, update the software list cache and upgrade.

Solution 2:

To start you need to recreate your /var/lib/dpkg/status file. You should probably have a backup at /var/backups/dpkg.status.0

So first we create the dpkg folder and then copy /var/backups/dpkg.status.0 to /var/lib/dpkg/status as follows

 mkdir /var/lib/dpkg
 cp /var/backups/dpkg.status.0 /var/lib/dpkg/
 mv /var/lib/dpkg/dpkg.status.0 /var/lib/dpkg/status

Create a folder called update inside /var/lib/dpkg

 mkdir /var/lib/dkpg/update

Now you Have to reinstall all the installed Applications.

NOTE:

There are extra backups at /var/backups/ namely dpkg.status.1, dpkg.status.2 but are in zipped form. If you want to use it you will have to uncompress it.Better go with the default one as explained above.For extra info see the source below

Source

Solution 3:

When you ran

sudo rm -r /var/lib/dpkg/*

you destroyed many important files and directories used by the dpkg software.

Unfortunately, there is no easy way to get back a working system without a full restore from backup or re-installation. You may be able to restore the missing files manually, one-by-one, but it is going to be no less than a major headache.

When you asked the same question here you were told (in a comment) to re-install or restore from backup. It is still a good idea, and opening a new question won't help you get a better answer.

Edit: I now realise you asked this question before the other question. But you also asked others. Stop creating new questions asking about this same problem.

You see, often when you hose an application, you can repair it by purging and re-installing the relevant package. In this case, the application you've hosed is the very one you would need in order to install and remove packages.