Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    HAProxy service error

    Scheduled Pinned Locked Moved pfSense Packages
    4 Posts 2 Posters 3.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cwelinder
      last edited by

      Hi,
      After installing HAProxy I couldn't start the service.
      When trying manually I quickly found out why it didn't work, but have no clue how to repair it and how it got this messed up.
      I had installed the package earlier but removed it again, that might be related…
      Grateful for advise!

      This is what I found:

      
      [2.1-RELEASE][admin@host.domain.se]/usr(70): /usr/local/etc/rc.d/haproxy start                                                  
      Cannot 'start' haproxy. Set haproxy_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'.                        
      [2.1-RELEASE][admin@host.domain.se]/usr(71): /usr/local/etc/rc.d/haproxy onestart                                               
      /usr/local/etc/rc.d/haproxy: WARNING: /usr/pbi/haproxy-i386/etc/haproxy.conf is not readable.                                  
      /usr/local/etc/rc.d/haproxy: WARNING: failed precmd routine for haproxy                                                        
      [2.1-RELEASE][admin@host.domain.se]/usr(72): cat /etc/rc.conf                                                                   
      cat: /etc/rc.conf: No such file or directory                                                                                   
      [2.1-RELEASE][admin@host.domain.se]/usr(73): cat /usr/pbi/haproxy-i386/etc/haproxy.conf                                         
      cat: /usr/pbi/haproxy-i386/etc/haproxy.conf: No such file or directory                                                         
      [2.1-RELEASE][admin@host.domain.se]/usr(74): find / -name haproxy\*                                                             
      /usr/local/man/man1/haproxy.1.gz                                                                                               
      /usr/local/www/haproxy_frontends.php                                                                                           
      /usr/local/www/haproxy_frontends_edit.php                                                                                      
      /usr/local/www/haproxy_global.php                                                                                              
      /usr/local/www/haproxy_servers.php                                                                                             
      /usr/local/www/haproxy_servers_edit.php                                                                                        
      /usr/local/pkg/haproxy.xml                                                                                                     
      /usr/local/pkg/haproxy.inc                                                                                                     
      /usr/local/pkg/haproxy_sync.xml                                                                                                
      /usr/local/etc/rc.d/haproxy                                                                                                    
      /usr/local/etc/rc.d/haproxy.sh                                                                                                 
      /usr/local/share/licenses/haproxy-1.4.24                                                                                       
      /usr/pbi/haproxy-i386                                                                                                          
      /usr/pbi/haproxy-i386/etc/rc.d/haproxy                                                                                         
      /usr/pbi/haproxy-i386/sbin/haproxy                                                                                             
      /usr/pbi/haproxy-i386/share/licenses/haproxy-1.4.24                                                                            
      /usr/pbi/haproxy-i386/.sbin/haproxy                                                                                            
      /usr/pbi/haproxy-i386/.sbin/haproxy.pbiopt                                                                                     
      /usr/pbi/haproxy-i386/.sbin/haproxy.ldhints                                                                                    
      /var/etc/haproxy.cfg                                                                                                           
      /var/db/pbi/installed/haproxy-1.4.24-i386                                                                                      
      /var/db/pbi/.hashqueue/haproxy-1.4.24-i386                                                                                     
      /tmp/haproxy.info                                                                                                              
      /tmp/haproxy-full.info                                                                                                         
      [2.1-RELEASE][admin@host.domain.se]/usr(75): cat /var/etc/haproxy.cfg                                                           
      global                                                                                                                         
              maxconn                 500                                                                                            
              uid                     80                                                                                             
              gid                     80                                                                                             
              nbproc                  1                                                                                              
              chroot                  /var/empty                                                                                     
              daemon                                                                                                                 
      
      [2.1-RELEASE][admin@host.domain.se]/usr(76): cat /usr/local/etc/rc.d/haproxy.sh                                                 
      #!/bin/sh                                                                                                                      
      
      # PROVIDE: haproxy                                                                                                             
      # REQUIRE: LOGIN                                                                                                               
      # KEYWORD: FreeBSD                                                                                                             
      
      . /etc/rc.subr                                                                                                                 
      
      name="haproxy"                                                                                                                 
      rcvar=`set_rcvar`                                                                                                              
      command="/usr/local/bin/haproxy"                                                                                               
      haproxy_enable=${haproxy-"YES"}                                                                                                
      
      start_cmd="haproxy_start"                                                                                                      
      stop_postcmd="haproxy_stop"                                                                                                    
      
      load_rc_config $name                                                                                                           
      
      haproxy_start () {                                                                                                             
              echo "Starting haproxy."                                                                                               
              /usr/bin/env \                                                                                                         
              PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \                                                    
                      /usr/local/bin/php -q -d auto_prepend_file=config.inc <<endoff   ="" <br="">require_once("globals.inc");                                                                           
                              require_once("functions.inc");                                                                         
                              require_once("haproxy.inc");                                                                           
                              haproxy_configure();                                                                                   
                      ?>                                                                                                             
      ENDOFF                                                                                                                         
      }                                                                                                                              
      
      haproxy_stop () {                                                                                                              
              echo "Stopping haproxy."                                                                                               
              killall haproxy                                                                                                        
      }                                                                                                                              
      
      run_rc_command "$1"</endoff > 
      
      1 Reply Last reply Reply Quote 0
      • P
        PiBa
        last edited by

        Hi cwelinder,

        Try running this command: "haproxy -f /var/etc/haproxy.cfg -c"

        It will probably tell you there are no frontends/listeners backends/servers configured.

        You might also want to give haproxy-devel a try, i'm currently maintaining/improving it.. So if you find issues in that package send me a message ;).

        1 Reply Last reply Reply Quote 0
        • C
          cwelinder
          last edited by

          Ok, so adding servers first is required to start service?
          Possible to add a error-msg to the Service tab?

          I installed your devel build and it started up fine.
          Will keep you posted on any issues or such! :)

          edit.1 - Help section on the GUI, does it exist?

          edit.2 - Maybe off-topic and newbish question, but does the web UI override changes made manually when starting service?
          I'm running HAProxy on a Synology Diskstation, and copied the major part of the haproxy.cfg. Only to see it replaced by former config. Any work-around? Or even cooler, a function to import configuration files! =)

          1 Reply Last reply Reply Quote 0
          • P
            PiBa
            last edited by

            • No help section available currently, sorry.

            • Every time the configuration is applied all existing configuration options are overwritten. (as is the case with most config files that are managed through pfSense gui.)

            -import option, i don't think its easily possible to implement such a feature..

            • As a workaround you could probably put major parts of the old config file into the Setting page under: "Global Advanced pass thru" including listen/frontend/backend sections. Though that way it wont be 'nicely' visible in the webgui..

            • the haproxy-devel build uses some default options like a 'unix socket' that might be sufficient for haproxy to startup, instead of the almost 'empty' config you showed. Also when applying haproxy-devel settings if an error is detected in the config file it will show that at the top of the page.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.