Basically the title. I'm working on upgrading our existing haproxy from 1.5 to the latest version. Because of that, I'm setting up a test case to ensure our old setup can work on it. However, when I try to run it, I get the following error:
[NOTICE] (28948) : haproxy version is 2.4.1-1ce7d49
[NOTICE] (28948) : path to executable is /home/user/test/usr/local/sbin/haproxy
[ALERT] (28948) : parsing [test.cfg:22]: Missing LF on last line, file might have been truncated at position 68.
[ALERT] (28948) : Error(s) found in configuration file : test.cfg
[ALERT] (28948) : Fatal errors found in configuration.
I've tried looking it up, but I cannot find anything on the error. I've already checked my config file, and it is using the correct Unix format. Also, my test config works for the older version of HAProxy.
global
stats timeout 30s
user root
group root
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend http_front
bind *:9090
default_backend http_back
backend http_back
balance roundrobin
server test.server.com 127.0.0.1:8000
In addition, I did the following to install haproxy:
tar xvf haproxy-2.4.1.tar.gz
cd haproxy-2.4.1
#vi to Makefile and set PREFIX to PREFIX = /home/user/test/usr/local
make TARGET=linux-glibc
make install
Is there anything that sticks out regarding my config file? Or did I miss something in the installation process?
Most likely you truncated your config file somehow. It looks ok.
I wasn't testing it on 2.4, but i found reference to it: https://www.mail-archive.com/haproxy@formilux.org/msg37698.html and was able to reproduce it on 2.2 (it was warning in 2.2, became error in 2.3 as described by haproxy message) with this simple config:
defaults
timeout connect 5000
timeout client 50000
timeout server 50000
frontend http_front
bind *:80
mode http
http-request deny
This config is valid:
# haproxy -c -f test.conf
Configuration file is valid
Now i will truncate it by one byte to reproduce it:
# wc -c test.conf
149 test.conf
# dd if=test.conf of=test2.conf bs=1 count=148
148+0 records in
148+0 records out
148 bytes copied, 0.00267937 s, 55.2 kB/s
# hexdump -C test.conf
00000000 64 65 66 61 75 6c 74 73 0a 20 20 20 74 69 6d 65 |defaults. time|
00000010 6f 75 74 20 63 6f 6e 6e 65 63 74 20 35 30 30 30 |out connect 5000|
00000020 0a 20 20 20 74 69 6d 65 6f 75 74 20 63 6c 69 65 |. timeout clie|
00000030 6e 74 20 35 30 30 30 30 0a 20 20 20 74 69 6d 65 |nt 50000. time|
00000040 6f 75 74 20 73 65 72 76 65 72 20 35 30 30 30 30 |out server 50000|
00000050 0a 0a 66 72 6f 6e 74 65 6e 64 20 68 74 74 70 5f |..frontend http_|
00000060 66 72 6f 6e 74 0a 20 20 20 62 69 6e 64 20 2a 3a |front. bind *:|
00000070 38 30 0a 20 20 20 6d 6f 64 65 20 68 74 74 70 0a |80. mode http.|
00000080 20 20 20 68 74 74 70 2d 72 65 71 75 65 73 74 20 | http-request |
00000090 64 65 6e 79 0a |deny.|
00000095
# hexdump -C test2.conf
00000000 64 65 66 61 75 6c 74 73 0a 20 20 20 74 69 6d 65 |defaults. time|
00000010 6f 75 74 20 63 6f 6e 6e 65 63 74 20 35 30 30 30 |out connect 5000|
00000020 0a 20 20 20 74 69 6d 65 6f 75 74 20 63 6c 69 65 |. timeout clie|
00000030 6e 74 20 35 30 30 30 30 0a 20 20 20 74 69 6d 65 |nt 50000. time|
00000040 6f 75 74 20 73 65 72 76 65 72 20 35 30 30 30 30 |out server 50000|
00000050 0a 0a 66 72 6f 6e 74 65 6e 64 20 68 74 74 70 5f |..frontend http_|
00000060 66 72 6f 6e 74 0a 20 20 20 62 69 6e 64 20 2a 3a |front. bind *:|
00000070 38 30 0a 20 20 20 6d 6f 64 65 20 68 74 74 70 0a |80. mode http.|
00000080 20 20 20 68 74 74 70 2d 72 65 71 75 65 73 74 20 | http-request |
00000090 64 65 6e 79 |deny|
00000094
# haproxy -c -f test2.conf
[WARNING] 193/184514 (10725) : parsing [test2.conf:9]: Missing LF on last line, file might have been truncated at position 21. This will become a hard error in HAProxy 2.3.
Warnings were found.
Configuration file is valid
Note the missing 0a
at the end. Check your config with hexdump -C