For archives.
Works on debian etch and ubuntu 7.10
So, in a moment of carelessness you screwed up a config file. Or a freak accident (where I was the freak) caused a package to be in a state of fubar. You decide you need to remove said package and re install same.
You go to the command line and enter...apt-get remove *package*. The system does it's thing and you say 'ok let's re install'. apt-get install *package*. Then the bad news. The remove command didn't get all of it out of the system. You can't install because part of the package is still there. Now what?
First try dpkg -P *package*. That will work most of the time. However, there are cases where it doesn't work.
Here is your last effort before a complete flush-and-reinstall of the server. This is not recommended for a beginner as this command (rm -r) can cause real problems. I'll use dovecot in this example 'cause it was my culprit.
First find what the apt-get remove didn't get:
# whereis dovecot
# dovecot: /usr/sbin/dovecot /etc/dovecot /usr/lib/dovecot /usr/lib64/dovecot /usr/include/dovecot /usr/share/dovecot /usr/share/man/man1/dovecot.1.gz
#
Now get rid of those items:
rm -r /usr/sbin/dovecot
rm -r /etc/dovecot
rm -r /usr/lib/dovecot
rm -r /usr/lib64/dovecot
rm -r /usr/include/dovecot
rm -r /usr/share/dovecot
rm -r /usr/share/man/man1/dovecot.1.gz
run this:
dpkg --force-all --purge dovecot-common
dpkg --force-all --purge dovecot-pop3d
dpkg --force-all --purge dovecot-imapd
That will have your system cleaned of all traces of dovecot. Then it's a matter of apt-get install *package*
What a mess. Gotta keep the freak from having accidents.
