Help: I am currently running 2.8.2 and upgraded and built 2.9.6. HAPROXY runs as expected with no problems on 2.8.2 but fails when starting 2.9.x. I am a little lost as to why or what would cause the application not to start the service.
Starting on 2.9.6
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/usr/lib/systemd/system/haproxy.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2024-02-29 17:45:48 EST; 12min ago
Docs: man:haproxy(1)
Feb 29 17:45:48 ha01 systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Feb 29 17:45:48 ha01 systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Feb 29 17:45:48 ha01 systemd[1]: Stopped HAProxy Load Balancer.
Feb 29 17:45:48 ha01 systemd[1]: haproxy.service: Start request repeated too quickly.
Feb 29 17:45:48 ha01 systemd[1]: haproxy.service: Failed with result ‘exit-code’.
Feb 29 17:45:48 ha01 systemd[1]: Failed to start HAProxy Load Balancer.
Starting on 2.8.2
[root@ha01]# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/usr/lib/systemd/system/haproxy.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2024-02-29 17:58:03 EST; 2s ago
Docs: man:haproxy(1)
Process: 2521698 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=0/SUCCESS)
Main PID: 2521701 (haproxy)
Status: “Ready.”
Tasks: 3 (limit: 47707)
Memory: 22.2M
CGroup: /system.slice/haproxy.service
├─2521701 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
└─2521703 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
Feb 29 17:58:03 ha01 systemd[1]: Starting HAProxy Load Balancer…
Feb 29 17:58:03 ha01 haproxy[2521701]: [NOTICE] (2521701) : New worker (2521703) forked
Feb 29 17:58:03 ha01 haproxy[2521701]: [NOTICE] (2521701) : Loading success.
Feb 29 17:58:03 ha01 systemd[1]: Started HAProxy Load Balancer.
Ran it manually and see if an error shows up:
systemctl stop haproxy
killall haproxy
/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg
killall haproxy
That is interesting. Running it manually seems to run fine but fails if I run it through systemctl.
[root@ha01 haproxy]# ps -ef |grep haproxy
99 3426902 1 0 18:13 ? 00:00:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg
root 3427281 3391818 0 18:13 pts/0 00:00:00 grep --color=auto haproxy
[root@ha01 haproxy]# killall haproxy
[root@ha01 haproxy]# systemctl start haproxy
Job for haproxy.service failed because the control process exited with error code.
See “systemctl status haproxy.service” and “journalctl -xe” for details.
[root@ha01 haproxy]# /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg
jbrahy
March 24, 2024, 8:52am
4
Did you look at the output of those commands?
Here is one of the outputs.
ha01 ~]# systemctl status haproxy.service
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/usr/lib/systemd/system/haproxy.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2024-03-15 18:27:28 EDT; 1 weeks 3 days ago
Docs: man:haproxy(1)
Process: 3436939 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=1/FAILURE)
Mar 15 18:27:28 ha01 systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Mar 15 18:27:28 ha01 systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Mar 15 18:27:28 ha01 systemd[1]: Stopped HAProxy Load Balancer.
Mar 15 18:27:28 ha01 systemd[1]: haproxy.service: Start request repeated too quickly.
Mar 15 18:27:28 ha01 systemd[1]: haproxy.service: Failed with result ‘exit-code’.
Mar 15 18:27:28 ha01 systemd[1]: Failed to start HAProxy Load Balancer.
jbrahy
March 26, 2024, 7:53pm
6
try this command to check syntax
haproxy -c -f /etc/haproxy/haproxy.cfg
let me know the output
jbrahy
March 26, 2024, 7:54pm
7
This tells me that you need to run this command
systemctl enable haproxy
sam7
May 15, 2024, 8:58pm
8
I have the same issue on Rocky Linux 8. This is caused by the following in systemd file:-
ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS
where “EXTRAOPTS=-S /run/haproxy-master.sock”
This works fine on 2.8 but not 2.9.
Changing to this resolves the problem:-
ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q -P $EXTRAOPTS