codedecoder

breaking into the unknown…

System start/stop links for /etc/init.d/nginx already exist

4 Comments

I have been trying to install nginx with passenger. Things worked fine untill, I copied the nginx init.d script to /etc/init.d. and tried to update update-rc.d file, I got this terrible message  System start/stop links for /etc/init.d/nginx already exist .

This is the command to update-rc.d

$ sudo /usr/sbin/update-rc.d -f nginx defaults
 System start/stop links for /etc/init.d/nginx already exist.

SOLUTION: remove the already existing link… simple 🙂

I know, what is happening here. Actually, I have tried  to install nginx from source code few month back, but get into some problem and so, uninstalled it. But I think some how , System start/stop links for /etc/init.d/nginx remain there. which is now causing the problem.Well, then how to remove, the old link. As usual, to know more about any command, run it will –help option, and it will give you good amount of information, see it yourself below.

$ sudo /usr/sbin/update-rc.d –help
usage: update-rc.d [-n] [-f] <basename> remove
       update-rc.d [-n] <basename> defaults [NN | SS KK]
       update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] […] .
       update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
        -n: not really
        -f: force

So, the first line give the syntax to remove any file from update-rc.d, in our case it is the nginx file

$ sudo update-rc.d -f nginx remove # -f option will remove the link forcefully
 Removing any system startup links for /etc/init.d/nginx …
   /etc/rc0.d/K20nginx
   /etc/rc1.d/K20nginx
   /etc/rc2.d/S20nginx
   /etc/rc3.d/S20nginx
   /etc/rc4.d/S20nginx
   /etc/rc5.d/S20nginx
   /etc/rc6.d/K20nginx

Now, we have get rid of the old nginx link, Let us update with the new one

$ sudo /usr/sbin/update-rc.d -f nginx defaults
 Adding system startup for /etc/init.d/nginx …
   /etc/rc0.d/K20nginx -> ../init.d/nginx
   /etc/rc1.d/K20nginx -> ../init.d/nginx
   /etc/rc6.d/K20nginx -> ../init.d/nginx
   /etc/rc2.d/S20nginx -> ../init.d/nginx
   /etc/rc3.d/S20nginx -> ../init.d/nginx
   /etc/rc4.d/S20nginx -> ../init.d/nginx
   /etc/rc5.d/S20nginx -> ../init.d/nginx

Well, it work fine…So we are done 🙂

Author: arunyadav4u

over 10 years experience in web development with Ruby on Rails.Involved in all stage of development lifecycle : requirement gathering, planing, coding, deployment & Knowledge transfer. I can adept to any situation, mixup very easily with people & can be a great friend.

4 thoughts on “System start/stop links for /etc/init.d/nginx already exist

  1. I was having a similar issue and it turned out to be malformed bash in my script. It didn’t throw any errors during the update-rc.d process but it would throw a “env: /etc/init.d/myscript: No such file or directory” error. I thought I’d mention it in case anyone else had a similar problem. Thanks for the post mate!

  2. Pingback: How to update an init script | Question and Answer

  3. Thanks Arun. I had a similar problem with Apache. I had to remove my startup links and reconfigure. It works now. Thank you for helping me understand.

  4. Thank you for a good post. I had the same problem with Apache 2 server and it make possible to fix it.

Leave a comment