Restart works, reload fails

Hi - I’m running HAProxy version 2.4.3-4dd5a5a, released 2021/08/17 and am able to run:

systemctl restart haproxy.service

without issue, but when I run:

systemctl reload haproxy.service

The service always fails with the below systemctl status haproxy.service:

haproxy.service - SYSV: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
   Loaded: loaded (/etc/rc.d/init.d/haproxy; bad; vendor preset: disabled)
   Active: failed (Result: signal) since Tue 2021-08-31 18:16:17 UTC; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9849 ExecStop=/etc/rc.d/init.d/haproxy stop (code=exited, status=0/SUCCESS)
  Process: 9994 ExecReload=/etc/rc.d/init.d/haproxy reload (code=exited, status=0/SUCCESS)
  Process: 9908 ExecStart=/etc/rc.d/init.d/haproxy start (code=exited, status=0/SUCCESS)
 Main PID: 10003 (code=killed, signal=KILL)

Aug 31 18:16:09 ip-10-0-6-173.us-west-2.compute.internal systemd[1]: Starting SYSV: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments....
Aug 31 18:16:09 ip-10-0-6-173.us-west-2.compute.internal haproxy[9908]: Starting haproxy: [  OK  ]
Aug 31 18:16:09 ip-10-0-6-173.us-west-2.compute.internal systemd[1]: Started SYSV: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..
Aug 31 18:16:17 ip-10-0-6-173.us-west-2.compute.internal systemd[1]: Reloading SYSV: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..
Aug 31 18:16:17 ip-10-0-6-173.us-west-2.compute.internal systemd[1]: Reloaded SYSV: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..
Aug 31 18:16:17 ip-10-0-6-173.us-west-2.compute.internal systemd[1]: haproxy.service: main process exited, code=killed, status=9/KILL
Aug 31 18:16:17 ip-10-0-6-173.us-west-2.compute.internal systemd[1]: Unit haproxy.service entered failed state.
Aug 31 18:16:17 ip-10-0-6-173.us-west-2.compute.internal systemd[1]: haproxy.service failed.

I’d love to get any guidance. Thanks!

You need to remove the init.d script and install the systemd unit file from contrib/systemd:

1 Like

Thank you - well that set me in the right direction. Here is what I did:

  1. rm /etc/init.d/haproxy
  2. Recompiled haproxy from source using make USE_SYSTEMD=1
  3. cd /root/haproxy-2.4.3/admin/systemd (my haproxy source directly is /root/haproxy-2.4.3) – note that contrib seems to be the old dir name, now the systemd file lives in admin)
  4. Run make – this copies the haproxy.service.in file into haproxy.service and replaces @SBINDIR@ with your local dir (/usr/local)
  5. cp haproxy.service /lib/systemd/system
  6. systemctl daemon-reload
  7. systemctl start haproxy.service
  8. systemctl reload haproxy.service ← and it works!

Thanks :slight_smile:

2 Likes