OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: opncya1 on February 26, 2025, 10:38:54 PM

Title: haxproxy.conf / haxproxy.conf.staging error - Missing LF on last line, truncated
Post by: opncya1 on February 26, 2025, 10:38:54 PM
Disclaimer - I am not positive when this error was present but I believe it may be due to 25.1 as I last updated a setting in haproxy about 2 months ago and I just updated opnsense to 25.1 about a week ago.

Version: 25.1.1

Problem: when going into haproxy to make changes, there is now a warning that reads as follows.  The service starts fine but I can't make any changes and apply it.

There are pending configuration changes that must be applied in order for them to take effect. To review them visit the Config Diff page.



[NOTICE] (60298) : haproxy version is 3.0.8-6036c31
[NOTICE] (60298) : path to executable is /usr/local/sbin/haproxy
[ALERT] (60298) : config : parsing [/usr/local/etc/haproxy.conf.staging:343]: Missing LF on last line, file might have been truncated at position 1.
[ALERT] (60298) : config : Error(s) found in configuration file : /usr/local/etc/haproxy.conf.staging
[ALERT] (60298) : config : Fatal errors found in configuration.



--- /usr/local/etc/haproxy.conf   2025-02-25 23:52:06.878159000 -0500
+++ /usr/local/etc/haproxy.conf.staging   2025-02-26 15:32:14.106746000 -0500
@@ -340,4 +340,4 @@
 
 # remote statistics are DISABLED
 
-
+
\ No newline at end of file




# remote statistics are DISABLED
   
^@^@^



- rebooted the node
- stopping/restarting haproxy
- stopping haproxy and adding a new line to haproxy.conf and haproxy.conf.staging
- also tried adding via 'echo "" >> haproxy.conf.staging'

I don't see anything obscure at a glance in my haproxy section in config.xml -- any ideas about what else I could try to fix this issue? 





Title: Re: haxproxy.conf / haxproxy.conf.staging error - Missing LF on last line, truncated
Post by: cookiemonster on February 27, 2025, 12:28:44 AM
"Missing LF on last line" . There are online posts about it. But my guess is at some point you were manipulating the config file in a MS Windows machine. LF is a Unix line ending, and that is what haproxy expects.
Solution is to add the missing unix type line ending. I'm pretty sure there are editors that can do it in Windows as well.
Title: Re: haxproxy.conf / haxproxy.conf.staging error - Missing LF on last line, truncated
Post by: Patrick M. Hausen on February 27, 2025, 12:31:32 AM
Open in vi and save will put an LF at the end of the last line if missing.
Title: Re: haxproxy.conf / haxproxy.conf.staging error - Missing LF on last line, truncated
Post by: cookiemonster on February 27, 2025, 12:33:59 AM
Ah, of course. I didn't think of an easiest route.
Title: Re: haxproxy.conf / haxproxy.conf.staging error - Missing LF on last line, truncated
Post by: opncya1 on February 27, 2025, 05:28:57 AM
no, I have never modified any haproxy settings outside of using the opnsense gui.  i've already tried adding newline with vi, nano and echo to no avail -- it's why i posted here in case someone else has seen this issue before.

Quote from: cookiemonster on February 27, 2025, 12:28:44 AM"Missing LF on last line" . There are online posts about it. But my guess is at some point you were manipulating the config file in a MS Windows machine. LF is a Unix line ending, and that is what haproxy expects.
Solution is to add the missing unix type line ending. I'm pretty sure there are editors that can do it in Windows as well.
Title: Re: haxproxy.conf / haxproxy.conf.staging error - Missing LF on last line, truncated
Post by: opncya1 on February 27, 2025, 06:10:22 AM
noticed my secondary node didn't have this config issue after forcing a regenerate while it was carp master.

uninstalled the haproxy plugin on primary node and reinstalled -- the error is gone now!