Thursday 4 June 2009

Exterminating debian packages that wont uninstall

Darn it,
you've install shiny package X that didn't come through the relatively QA'd Ubuntu package archive, you don't want it anymore and try and uninstall, and it all goes south. It doesn't uninstall cleanly and every 10minutes you get an update window telling you that only a partial update is posssible.

I ignored this for a few days but my annoyance grew. In my case, the package in question was db2, which Ive kind of moved away from to Postgres due to simple 'just work dammit' reasons.

Removing with the various dpg optons had no effect. Surgery required.

Scalpel in hand and a probable guess that the dpk 'installed packages' file was in /lib somewhere, I did the following:

find /var -exec grep -H db2exc {} \;

This little beuty scans every file for a substring match and prints the matching filename / line. bingo

Sure enough, the file was /var/lib/dpkg/status, a flick of the scalpel and db2exc was history.

I could have done it properly and fixed the uninstall script, but I was feeling ruthless, one of those rm -rf moments.

No comments: