You should be able to work with a previous known good status file and update from there. Every time you do an install or a update, the status file is saved to a gzipped backup under /var/backups. Doing an ls -l dpkg * on the directory shows:
-rw-r--r-- 1 root root 2266732 2010-09-30 08:35 dpkg.status.0
-rw-r--r-- 1 root root 624182 2010-09-29 08:49 dpkg.status.1.gz
-rw-r--r-- 1 root root 623844 2010-09-28 08:55 dpkg.status.2.gz
-rw-r--r-- 1 root root 620358 2010-09-24 11:04 dpkg.status.3.gz
-rw-r--r-- 1 root root 619021 2010-09-23 15:34 dpkg.status.4.gz
-rw-r--r-- 1 root root 619013 2010-09-23 08:03 dpkg.status.5.gz
-rw-r--r-- 1 root root 618968 2010-09-21 08:33 dpkg.status.6.gz
There's also a backup of the file created in the /var/lib/dpkg/ directory named status-old. Doing an ls -l status* on the directory shows:
-rw-r--r-- 1 root root 2266732 2010-09-30 08:35 status
-rw-r--r-- 1 root root 2267191 2010-09-30 08:35 status-old
So, to recover from a corruption, you should be able to do the following:
1. Make a backup of the corrupt status file:
mv /var/lib/dpkg/status /var/lib/dpkg/status_bkup
2. Copy an recent dpkg status file into place from either of the sources above:
either
cp /var/lib/dpkg/status-old /var/lib/dpkg/status
or
cp /var/backups/dpkg.status.#.gz /var/lib/dpkg/
gunzip -d /var/lib/dpkg/dpkg.status.#.gz
mv /var/lib/dpkg/dpkg.status.# /var/lib/dpkg/status
3. Then run apt-get update:
sudo apt-get update
That should do it.
status
file: it's a primary source of information, and while a lot of it is redundant, not all of it is. However it's probably possible to repair the file manually. Post a chunk of the file around the problematic line, say 20–40 lines including at least onePackage:
line before and after line 15945.apt-get
,dpkg
and friends still work correctly, and what is erroring out is auto-completion?