21

When I try to install any software, I encounter this error, and therefore I cannot update.

Preconfiguring packages ...
dpkg: error: parsing file '/var/lib/dpkg/status' near line 51245 package 'oracle-xe':
 mixed non-coinstallable and coinstallable package instances present
N: Ignoring file 'gcl' in directory '/etc/apt/sources.list.d/' as it has no filename extension
N: Ignoring file 'gcl' in directory '/etc/apt/sources.list.d/' as it has no filename extension
E: Sub-process /usr/bin/dpkg returned an error code (2)

1 Answer 1

40

Lucky you! You have backups! And even more, they are made daily without you knowing! So, to restore the files just run:

sudo rm /var/lib/dpkg/status
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
sudo apt-get update

Done!

If you need even older files there are more to choose from:

ls /var/backups/dpkg.status*
/var/backups/dpkg.status.0     /var/backups/dpkg.status.4.gz
/var/backups/dpkg.status.1.gz  /var/backups/dpkg.status.5.gz
/var/backups/dpkg.status.2.gz  /var/backups/dpkg.status.6.gz
/var/backups/dpkg.status.3.gz

Just uncompress them using gunzip:

gunzip -c /var/backups/dpkg.status.6.gz > /var/lib/dpkg/status

If the backups are no good, another way is doing a list of the doc directory contents:

sudo -i
ls /usr/share/doc | \
      grep -v [A-Z] | \
      grep -v '^texmf$' | \
      grep -v '^debian$' | \
      awk '{print $1 " install"}' | \
      dpkg --set-selections

http://www.debianhelp.co.uk/debianproblem.htm

1
  • 5
    thank god I have another status-old to do the recovery. After cp it to the right, enter sudo dpkg --configure -a fix all problem! Thanks!
    – Robert
    Jan 10, 2014 at 7:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .