0

I have compiled nginx(1.13.6) on my ubuntu server by cloning and installing nginx from git. I want to recompile it with additional modules. When I try to remove nginx using:

sudo service nginx stop
sudo rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx

I get the following output when sudo service nginx status is entered which shows that nginx has not been fully removed.

    ● nginx.service
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:19] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: nginx.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:19] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: nginx.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

How can I remove nginx completely to recompile it from scratch?

Jenny D
  • 27,358
  • 21
  • 74
  • 110
TrickyExplorer
  • 89
  • 1
  • 3
  • 11

1 Answers1

0

You have removed nginx. You have not removed the systemd unit file nor deactivated it.

To deactivate the service, run systemctl disable nginx. To remove the unit file, delete the file /lib/systemd/system/nginx.service.

Jenny D
  • 27,358
  • 21
  • 74
  • 110
  • Thanks a ton! After I removed the systemd file and restarted my server, I was able to recompile nginx. – TrickyExplorer May 21 '18 at 11:00
  • You're welcome! For the future, some programs will have the option to run `make deinstall` or `make uninstall` from the source directory, which should remove all relevant files. This is up to whoever wrote the program, though. – Jenny D May 21 '18 at 12:13