Showing posts with label dpkg status. Show all posts
Showing posts with label dpkg status. Show all posts

12 December 2012

289. /var/lib/dpkg/status error and fix

The problem:
e.g.
sudo apt-get install ncurses-bin -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ncurses-bin is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? 
dpkg: error: parsing file '/var/lib/dpkg/status' near line 16892 package 'smbclient':
 `Depends' field, reference to `libtdb1': version contains ` '
E: Sub-process /usr/bin/dpkg returned an error code (2)

The solution:
Open /var/lib/dpkg/status in e.g. vim and remove the extra space: change from

16892 Depends: samba-common (= 2:3.6.6-3), libc6 (>= 2.10), libcap2 (>= 2.10), libcomerr2 (>= 1.01), libgssapi-krb5-2 (>= 1.10+dfsg~), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.10+dfsg~), libldap-2.4-2 (>= 2.4.7), libpopt0 (>= 1.14),       libreadline6 (>= 6.0), libtalloc2 (>= 2.0.4~git20101213), libtdb1 (>= 1.2.7+git201 1214), libtinfo5, libwbclient0 (>= 2:3.6.0~pre3), zlib1g (>= 1:1.1.4)
to
16892 Depends: samba-common (= 2:3.6.6-3), libc6 (>= 2.10), libcap2 (>= 2.10), libcomerr2 (>= 1.01), libgssapi-krb5-2 (>= 1.10+dfsg~), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.10+dfsg~), libldap-2.4-2 (>= 2.4.7), libpopt0 (>= 1.14),       libreadline6 (>= 6.0), libtalloc2 (>= 2.0.4~git20101213), libtdb1 (>= 1.2.7+git2011214), libtinfo5, libwbclient0 (>= 2:3.6.0~pre3), zlib1g (>= 1:1.1.4)

You can now continue as normal.

What not to do:

sudo rm /var/lib/dpkg/status

because it gives (if you do touch /var/lib/dpkg/status)


sudo apt-get install ncurses-bin 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gcc-4.7-base libc-bin libc6 libgcc1 libtinfo5 multiarch-support
Suggested packages:
  glibc-doc debconf debconf-2.0 locales

etc.
In other words, suddenly no packages are registered as being installed anymore.

To fix it
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status

And then edit the file as shown above.