2

I want to install a package in Ubuntu 14.04, but every time I run the ./configure command it gives me this error:

E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 35%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 70%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 100%
dpkg: error: cannot scan updates directory `/var/lib/dpkg/updates/': No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (2)
4
  • 3
    Which distribution are you using?
    – Nisheet
    Jan 4 '17 at 9:03
  • I am using: DISTRIB_ID=Ubuntu
    – sobia
    Jan 4 '17 at 9:13
  • DISTRIB_RELEASE=14.04, DISTRIB_CODENAME=trusty,DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS", ID_LIKE=debian
    – sobia
    Jan 4 '17 at 9:16
  • 1
    dpkg is complaining that it can't find is directory /var/lib/dpkg/updates/ where it uses that directory to stores status of the installation/update. Question, what did you do before, that causes this error? did you delete anything from the directory /var/lib/dpkg/? Jan 4 '17 at 9:40
5

It seems you have done something terrible to the directory /var/lib/dpkg refer to this posts here to know more about dpkg This and This

Back to your problem, to solve the problem, you should try doing the following,

First Option

Return the dir status only if it was the one messed up.

sudo mkdir /var/lib/dpkg/updates

Then do

sudo apt-get update
sudo apt-get upgrade

Then install the packages as normal

Second Option(This solution assume you have completely messed up with /var/lib/dpkg

Restore a backup of /dpkg/status/ from /var/backups/ or /var/lib/dpkg/ since status holds the database of dpkg,you will probably be able to restore the database and everything will turn back to normal.

In the dir /var/backups/ you will be having a folder like dpkg.status.0 ,and compressed file dpkg.status.1 ,dpkg.status.2 etc,this are the backups we are targeting,we are going to use backup dpkg.status.0 to restore,do the following:

Since you already have dir /var/lib/dpkg
Copy the backup to that dir

sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/

NOTE:The latest backup is dpkg.status.0 file,but If you want to backup from the archive file i.e. dpkg.status.#.gz do

sudo cp /var/backups/dpkg.status.#.gz /var/lib/dpkg/

gunzip -d /var/lib/dpkg/dpkg.status.#.gz

Then rename dpkg.status.# to status i.e. dpkg.status.0

sudo mv /var/lib/dpkg/dpkg.status.0 /var/lib/dpkg/status

Then create the folder update

sudo mkdir /var/lib/dpkg/update

Then sudo apt-get update and sudo apt-get upgrade

After that you can install the softwares as normal!

2
  • I'm curious if /var/lib/dpkg/status-old is also a backup option. Also note there are a total of four /var/lib/dpkg/*-old files. Jan 4 '17 at 11:29
  • @WinEunuuchs2Unix ,Yes ,there are also backups ,the difference is, completely updated backups are in /var/backups/ probably the latest status.0 file. Jan 4 '17 at 13:55
1

What does this mean?

Means your dpkg configuration has got messed up somehow. The package management system has a database which has all information on what packages , system tools or software in general are installed in the system, and when it gets damaged problems like this appear.

What needs to be done?

First, check for issues with PPAs as mentioned in How do I resolve unmet dependencies after adding a PPA?

Secondly, try the advice here: Package system is broken, multiple errors, dpkg cannot process libc6

Step 3: Try running these commands as root

sudo apt-get update
sudo apt-get clean
sudo apt-get install -fy
sudo dpkg -i /var/cache/apt/archives/*.deb
sudo dpkg --configure -a
sudo apt-get install -fy

If nothing works, you might have to take a back-up and re-install Ubuntu

OR

Hack it as mentioned in Problem installing packages

Clean, Update and Dist upgrade apt-get update

sudo apt-get clean
sudo apt-get install -fy
sudo dpkg -i /var/cache/apt/archives/*.deb
sudo dpkg --configure -a
sudo apt-get install -fy
sudo apt-get dist-upgrade

If terminal prompts with questions like Y / N etc... always opt for the default option highlighted in caps; most probably it would be N. Until and unless you are really sure of what you are doing

Stack Overflow Reference

0
sudo apt-get update
sudo apt-get clean
sudo apt-get install -fy
sudo dpkg -i /var/cache/apt/archives/*.deb

if this command (sudo dpkg -i /var/cache/apt/archives/*.deb doesn't work, then try the three following commands)

sudo killall apt-get
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a

then try below

sudo dpkg --configure -a
sudo apt-get install -fy
sudo apt-get update && sudo apt-get upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.