Remove nginx from Ubuntu Fiesty Fawn (7.04)

The original 2007 fix for a packaging bug that broke removing nginx via aptitude on Ubuntu Feisty Fawn, restored from the Wayback Machine.

Published by Sudhanshu on Sep 30, 2007

Recovered from a dead backlink. Restored from a 2009 Wayback Machine snapshot, close to verbatim.


Remove nginx from Ubuntu Fiesty Fawn (7.04)

Posted 30 September 2007

I was trying my hand at ruby the other day, and decided to try it out with nginx. However, after the initial trial, I decided to get rid of nginx. But aptitude failed to get rid of it, and returned the following error message:

root@linox: ~# aptitude remove nginx
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
  nginx
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives.
After unpacking 582kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database … 78227 files and directories currently installed.)
Removing nginx …
Stopping nginx: nginx.
Stopping nginx: invoke-rc.d: initscript nginx, action "stop" failed.
dpkg: error processing nginx (–remove):
 subprocess pre-removal script returned error exit status 1
Starting nginx: nginx.
Errors were encountered while processing:
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

After a lot of searching found this fix: Edit /var/lib/dpkg/info/nginx.prerm and comment out the line with invoke-rc.d, which gives the stop statement for nginx. Then try uninstalling again: aptitude remove nginx, and it works.

Somebody is already working on this issue, and it should get fixed soon. It was reported on the 8th of August 2007, so we should expect it to be gone by the next dist-upgrade. I'm just sitting tight for the next version of Ubuntu to come along.