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 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. The last I had heard, they were expecting to launch it this October. Also, it would bring along with a lot of new functionality, and I can’t wait to get my hands on it.

5 Responses to “Remove nginx from Ubuntu Fiesty Fawn (7.04)”

  1. Arty Says:

    Thx… it saved a lot of time for me

  2. Scott Says:

    Thanks! Same thing happened to me on 7.10 and your “fix” still works.

  3. Paul Selitskas Says:

    Big thanks! But I commented whole last If section (where script starts nginx).

  4. Anonymous Says:

    Amazing man!

    works like a charm on ubuntu JeOS (7.10 I guess)

    thanks!

  5. Ivor Says:

    Thanks, this worked for me. I was on Hardy and had to comment out the entire if statement. Nginx was not running at the time.

Leave a Reply