Posted by Vince Wadhwani on Jan 12, 2008

Sometimes Debian packages don't play nice. They install fine but try to upgrade them or remove them and they'll have a fit. It's happened to me on Lighttpd before and it just happened again with Wifi-radar. This time the error on removing the package said:

The following packages will be REMOVED:
  wifi-radar
0 upgraded, 0 newly installed, 1 to remove and 5 not upgraded.
Need to get 0B of archives.
After unpacking 238kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 156000 files and directories currently installed.)
Removing wifi-radar ...
Stopping wifi-radar daemon...invoke-rc.d: initscript wifi-radar, action "stop" failed.
dpkg: error processing wifi-radar (--remove):
 subprocess pre-removal script returned error exit status 255
Starting wifi-radar daemon...Errors were encountered while processing:
 wifi-radar
E: Sub-process /usr/bin/dpkg returned an error code (1) 

Fortunately, the solution I used for Lighttpd seems to work here too. Head over to /var/lib/dpkg/info and find the package in question. There should be a file with .prerm at the end of it. In the case of wifi-radar the file is called wifi-radar.prerm. Edit the file and change it's contents so it just says

set -e

Save and exit. After that you should be able to remove it or upgrade safely!

PS: If you happen to use Sidux, Ceni seems to work better anyway! ;o)