In my earlier post,
DHCP - does reboot not restart /etc/init.d/network?
I was told that the router's loss of DHCP after a modification of
/etc/config/network was probably due to a syntax error.
I think I found what that error was.
It was in another config file being simultaneously edited, namely,
/etc/config/dhcp, to which I was cutting and pasting blocks of lines (for static leases) from a text document saved with "Line Ending = Windows." (I do this so Window's Notepad can read the document.) This cutting and pasting, I believe, introduced into
/etc/config/dhcp a line break type that OpenWrt could not handle.
When I dropped the blocks first into a text document with "Line Ending = Unix/Linux" and then cut them again from it before pasting into
/etc/config/dhcp, there followed no loss of DHCP.
Question: 1. Is Windows-format line break a "syntax error" to cause OpenWrt to break down? 2. Does cutting and pasting from a text document with such line break introduce it into an OpenWrt config?
My experiments obviously say yes.
I want to make sure I'm not dealing with a fluke (while the real cause goes undetected).
Very likely. OpenWrt is a Linux system and expects the "Line Ending = Unix/Linux" in text files. If you give it Windows style of line ending it will fail to read the text.
Also scripts with this line ending will fail.
If you want to write text for a Linux system from Windows, you need to use a text editor application that can write and read the text file in "Line Ending = Unix/Linux".
A very common free/opensource application for Windows that can do this is Notepad++ https://notepad-plus-plus.org/ but many others also can do this. It is an old difference between Windows vs MacOS/*BSD/Linux.
Windows line endings will definitely be a syntax error in the configuration.
I'm no Windows expert (been on Mac since 2005), but, doesn't turning off Format/Word Wrap in Windows Notepad make the edited text clear of such line ending problems?
Word Wrap is a different thing. It's just a visualization setting that tells Notepad to show you the text in a different way to fit automatically in the window (so you do not have to scroll to the right to see the full line if it is very long). It is not altering the text in the file.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.