Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 628986

Summary: net-proxy/haproxy fails to start: cannot bind UNIX socket
Product: Gentoo Linux Reporter: Carlos Konstanski <ckonstanski>
Component: Current packagesAssignee: Christian Ruppert (idl0r) <idl0r>
Status: RESOLVED INVALID    
Severity: normal CC: arthur
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Carlos Konstanski 2017-08-26 18:45:26 UTC
Every time I try to start haproxy I have to first manually create the /run/haproxy directory so that the socket file can be created. This directory gets destroyed on haproxy shutdown and not recreated by the init script.

root@os:~ # /etc/init.d/haproxy start
 * Checking /etc/haproxy/haproxy.cfg ...                                                                         [ ok ]
 * Starting haproxy ...
[ALERT] 237/122115 (3994) : Starting frontend GLOBAL: cannot bind UNIX socket [/run/haproxy/admin.sock]
 * start-stop-daemon: failed to start `/usr/bin/haproxy'
 * Failed to start haproxy                                                                                       [ !! ]
 * ERROR: haproxy failed to start
Comment 1 Carlos Konstanski 2017-08-26 18:46:11 UTC
Version: net-proxy/haproxy-1.6.11-r1
Comment 2 zless 2018-04-27 07:59:50 UTC
Either configure haproxy to create the socket directly under /run or
create a /etc/tmpfiles.d/haproxy.conf file (I hear they are supported in OpenRC too) with:

D /run/haproxy 0750 root haproxy
Comment 3 Christian Ruppert (idl0r) gentoo-dev 2018-07-16 11:32:25 UTC
haproxy does not come with a default config and thus you'll have to create all files/directories that are required by your setup on your own. It is easily possible to hook the init scripts by extending the conf.d file or like zless mentioned perhaps. Does this work for you?
Comment 4 Carlos Konstanski 2018-07-16 14:48:01 UTC
I already do this:

    test -d /run/haproxy || mkdir /run/haproxy
    /etc/init.d/haproxy start

/run/haproxy disappears after every shutdown; this must be done for every startup.

I'll look into the /etc/conf.d method. It's weak sauce though. The PID directory ought to be managed by the daemon. I suppose I need to take this up with upstream.