Problem installing HAProxy

Hi! Installing HAProxy v.2.3 on Ububntu:
make TARGET = linux-glibc
sudo make install

Installation log:

'haproxy' -> '/usr/local/sbin/haproxy'
install: creating directory '/usr/local/share/man/man1'
'doc/haproxy.1' -> '/usr/local/share/man/man1/haproxy.1'
install: creating directory '/usr/local/doc'
install: creating directory '/usr/local/doc/haproxy'
'doc/configuration.txt' -> '/usr/local/doc/haproxy/configuration.txt'
'doc/management.txt' -> '/usr/local/doc/haproxy/management.txt'
'doc/proxy-protocol.txt' -> '/usr/local/doc/haproxy/proxy-protocol.txt'
'doc/seamless_reload.txt' -> '/usr/local/doc/haproxy/seamless_reload.txt'
'doc/architecture.txt' -> '/usr/local/doc/haproxy/architecture.txt'
'doc/peers-v2.0.txt' -> '/usr/local/doc/haproxy/peers-v2.0.txt'
'doc/regression-testing.txt' -> '/usr/local/doc/haproxy/regression-testing.txt'
'doc/cookie-options.txt' -> '/usr/local/doc/haproxy/cookie-options.txt'
'doc/lua.txt' -> '/usr/local/doc/haproxy/lua.txt'
'doc/WURFL-device-detection.txt' -> '/usr/local/doc/haproxy/WURFL-device-detection.txt'
'doc/linux-syn-cookies.txt' -> '/usr/local/doc/haproxy/linux-syn-cookies.txt'
'doc/SOCKS4.protocol.txt' -> '/usr/local/doc/haproxy/SOCKS4.protocol.txt'
'doc/network-namespaces.txt' -> '/usr/local/doc/haproxy/network-namespaces.txt'
'doc/DeviceAtlas-device-detection.txt' -> '/usr/local/doc/haproxy/DeviceAtlas-device-detection.txt'
'doc/51Degrees-device-detection.txt' -> '/usr/local/doc/haproxy/51Degrees-device-detection.txt'
'doc/netscaler-client-ip-insertion-protocol.txt' -> '/usr/local/doc/haproxy/netscaler-client-ip-insertion-protocol.txt'
'doc/peers.txt' -> '/usr/local/doc/haproxy/peers.txt'
'doc/close-options.txt' -> '/usr/local/doc/haproxy/close-options.txt'
'doc/SPOE.txt' -> '/usr/local/doc/haproxy/SPOE.txt'
'doc/intro.txt' -> '/usr/local/doc/haproxy/intro.txt'

Config is correct:

global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
        stats timeout 30s
        user haproxy
        group haproxy
        daemon

        # Default SSL material locations
#        ca-base /etc/ssl/certs
#        crt-base /etc/ssl/private

        # Default ciphers to use on SSL-enabled listening sockets.
        # For more information, see ciphers(1SSL). This list is from:
        #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
        # An alternative list with additional directives can be obtained from
        #  https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
#        ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
#        ssl-default-bind-options no-sslv3
        ## Add the line below
#        tune.ssl.default-dh-param 2048

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout client  50000
        timeout server  50000
#        errorfile 400 /etc/haproxy/errors/400.http
#        errorfile 403 /etc/haproxy/errors/403.http
#        errorfile 408 /etc/haproxy/errors/408.http
#        errorfile 500 /etc/haproxy/errors/500.http
#        errorfile 502 /etc/haproxy/errors/502.http
#        errorfile 503 /etc/haproxy/errors/503.http
#        errorfile 504 /etc/haproxy/errors/504.http
frontend http
    bind *:8000
    default_backend servers

backend servers
    server server 127.0.0.1:81

Startup error:

systemd[1]: haproxy.service: Can't open PID file /var/run/haproxy.pid (yet?) after start: No such file or directory
Dec 14 10:31:48 hapserv systemd[1]: haproxy.service: Failed with result 'protocol'.
Dec 14 10:31:48 hapserv systemd[1]: Failed to start SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..

Please help with the problem

Starting up how? What was the procedure that you used to install the systemd unit?

Please show the output of systemctl status haproxy as well as cat the entire systemd unit file.

1 Like

systemctl start haproxy

nothing

hapuser@hap_server:~$ sudo systemctl status haproxy
â—Ź haproxy.service - SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
   Loaded: loaded (/etc/init.d/haproxy; generated)
   Active: failed (Result: protocol) since Mon 2020-12-14 11:32:56 UTC; 39s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1742 ExecStart=/etc/init.d/haproxy start (code=exited, status=0/SUCCESS)

Dec 14 11:32:56 hap_server systemd[1]: Starting SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments....
Dec 14 11:32:56 hap_server systemd[1]: haproxy.service: Can't open PID file /var/run/haproxy.pid (yet?) after start: No such file or directory
Dec 14 11:32:56 hap_server systemd[1]: haproxy.service: Failed with result 'protocol'.
Dec 14 11:32:56 hap_server systemd[1]: Failed to start SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..
Dec 14 11:43:10 hap_server sudo[2016]: pam_unix(sudo:session): session closed for user root
Dec 14 11:43:34 hap_server sudo[2035]:  hapuser : TTY=tty1 ; PWD=/home/hapuser ; USER=root ; COMMAND=/bin/systemctl restart haproxy
Dec 14 11:43:34 hap_server sudo[2035]: pam_unix(sudo:session): session opened for user root by hapuser(uid=0)
Dec 14 11:43:34 hap_server systemd[1]: Starting SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments....
Dec 14 11:43:34 hap_server systemd[1]: haproxy.service: Can't open PID file /var/run/haproxy.pid (yet?) after start: No such file or directory
Dec 14 11:43:34 hap_server systemd[1]: haproxy.service: Failed with result 'protocol'.
Dec 14 11:43:34 hap_server systemd[1]: Failed to start SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..

Then you do not have a consistent installation. This init.d file is probably from an old installation that has not been properly removed. Now you have an old startup script, a new executable which won’t work.

Refer to the following post to fix your startup script issue:

1 Like