Debian – How to remove a bunch of ancient packages on debian

debianpackage-managementuninstall

I'm running sid, and in the course of trying to cross-grade my system from i386 to amd64 I came across some ancient packages that I couldn't remove. Some background: I've had this system since potato, or maybe earlier.

There are about a hundred packages like this, so I'd like a generic or scriptable answer. Here's one example:

bminton:/var/cache/apt/archives# dpkg --purge libstdc++2.10-dev
(Reading database ... 1352516 files and directories currently installed.)
Removing libstdc++2.10-dev (1:2.95.4-27) ...
install-info: No dir file specified; try --help for more information.
dpkg: error processing package libstdc++2.10-dev (--purge):
 subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
 libstdc++2.10-dev

The prerm script `/var/lib/dpkg/info/libstdc++2.10-dev.prerm script contains the following:

#! /bin/sh -e



install-info --quiet --remove iostream-2.95

Manually running install-info --quiet --remove iostream-2.95 gives the following error:

install-info: No dir file specified; try --help for more information.

Best Answer

dpkg used to have its own install-info script which was used in place of the GNU one. An email about the change gives a suggestion for packages (formatting added):

These packages should just drop their info files in /usr/share/info, and call the update-info-dir script if present (postinst and prerm). They could suggest/recommend the info package.

So, what I'd suggest you do is edit (yes, edit) /var/lib/dpkg/info/libstdc++2.10-dev.prerm and comment out the install-info ... line. Do the same for other packages with that failure. Once you're done purging the packages, manually run update-info-dir.

BTW: In the future, after doing a upgrade, you should check the list of obsolete/local packages on your system and purge them if not needed. Otherwise, you wind up with very outdated maintainer scripts left lying around.

Related Question