/usr/local/etc/rc.d/haproxy: WARNING: failed to start haproxy

Hello world!

I’m trying to start haproxy, however unable to do so:

# haproxy -v
HAProxy version 2.9.6-9eafce5 2024/02/26 - https://haproxy.org/
Status: stable branch - will stop receiving fixes around Q1 2025.
Known bugs: http://www.haproxy.org/bugs/bugs-2.9.6.html
Running on: FreeBSD 14.0-RELEASE-p6 FreeBSD 14.0-RELEASE-p6 #0: Tue Mar 26 20:26:20 UTC 2024     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
# service haproxy start
Starting haproxy.

I don’t see any messages in /var/log/messages, and meanwhile service is still trying to start…

haproxy.conf, :

# cat /usr/local/etc/haproxy.conf
# generated 2024-05-12, Mozilla Guideline v5.7, HAProxy 2.9.6, OpenSSL 3.0.12, modern configuration
# https://ssl-config.mozilla.org/#server=haproxy&version=2.9.6&config=modern&openssl=3.0.12&guideline=5.7
global
    # modern configuration
    ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
    ssl-default-bind-options prefer-client-ciphers no-sslv3 no-tlsv10 no-tlsv11 no-tlsv12 no-tls-tickets

    ssl-default-server-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
    ssl-default-server-options no-sslv3 no-tlsv10 no-tlsv11 no-tlsv12 no-tls-tickets

defaults
    log global
    mode http
    option httplog
    timeout connect 10s
    timeout client 30s
    timeout server 30s

frontend ft_66
    mode    http
    bind    :443 ssl crt /usr/local/etc/...pem alpn h2,http/1.1
#    bind    :80
    redirect scheme https code 301 if !{ ssl_fc }
	default_backend be_66

    # HSTS (63072000 seconds)
    http-response set-header Strict-Transport-Security max-age=63072000

backend be_66
	mode	http
	server	apache24	localhost:80	check

# 

Please advise)
Thanks in advance!

Stop haproxy, make sure there are no haproxy processes left otherwise kill them.

Then start haproxy manually in foreground mode:

haproxy -f /usr/local/etc/haproxy.conf -db

or in debug mode (still foreground):

haproxy -f /usr/local/etc/haproxy.conf -d

I don’t know anything about the init.d system in FreeBSD, so that’s my only advise to find out if there is any issue with starting haproxy itself.

yeah, that’s exactly what I end up doing it…

# grep ^haproxy /etc/rc.conf
haproxy_enable="YES"
haproxy_flags="-D -q -f /usr/local/etc/haproxy.conf -p /var/run/haproxy.pid"
# service haproxy start
Starting haproxy.
# service haproxy status
haproxy is running as pid 34116.
#

looks like a bug :crazy_face:

thanks!