Short of rebuilding the whole server from the ground up (which I'm working on anyway), any ideas how to fix this problem on an old debian etch box? Its annoying to not be able to apt-get things...
# apt-get install dpkg
<<snip>>
Preparing to replace dpkg 1.13.25 (using .../archives/dpkg_1.13.26_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/dpkg_1.13.26_i386.deb (--unpack):
unable to install updated status of `dpkg': No such file or directory
<< hangs here - need to ctrl-c >>
# dpkg -C
The following packages are in a mess due to serious problems during
installation. They must be reinstalled for them (and any packages
that depend on them) to function properly:
dpkg package maintenance system for Debian
Okay, this is going to be fun. Your box is fairly screwed, so the worst problem is that you screw it harder, but I take no responsibility for you doing that following this advice. The problem is either that the dpkg package didn't install correctly, or the metadata is corrupt.
Let's deal with the first problem. Debian packages are just an ar file of two tar files. You can extract them by hand if you really need to. Try the following:
This should extract the files from the package and install them on the system. We should probably tell dpkg that the package is installed. Find the /var/lib/dpkg/status file, and find a line that says:
Then edit the Status line to say:
and change the version to say:
Hopefully now, dpkg should be working. If it is, I would reinstall dpkg, so dpkg knows what files the dpkg package has installed.
If it's a metadata file that's become corrupt, they're just plain text files, so you can edit them. I would suggest using dpkg in debug more or strace to see if you can find out which file in particular is broken.
(Check out dpkg --debug=help to find out what 2001 means)
If the status file is corrupt, there is a status-old file you could use as a backup.
I suspect I might try manually re-downloading the dpkg deb using something like wget or curl and then manually extracting the contents of the package onto your filesystem.
It would be wise to have a backup of your system before you try this.
apt-get depends on dpkg for operation...thus if your dpkg is messed up, apt-get will not be able to install anything (including dpkg itself).