I can't restart my dnsmasq service, so my fog server won't work

Stephen Fig Roll Smith picture Stephen Fig Roll Smith · Jun 5, 2013 · Viewed 15.7k times · Source

I have a fog server set up in work, every now and then our useless internet fails and I have to reset the dnsmasq to get it working again, (don't have a dhcp server set up and can't modify the hubs settings so won't be doing this). Whenever I try sudo dnsmasq restart, I get the message:

junk found in command line.

First of all, can some please explain to me in simple terms what this actually means? As I am no Linux expert and nobody seems to have a simple explanation as to what this is...

Secondly, I have always used the command posted on another the fog forum to correct this error.

sudo /etc/init.d/dnsmasq restart

This always worked perfectly however now when I try to run this command I get the message:

command not found`.

Answer

Marcos Tischer Vallim picture Marcos Tischer Vallim · Jun 5, 2017

Edit your /etc/init.d/dnsmasq

My linux distribution is Debian 9 (stretch)

Change this line :

ROOT_DS="/usr/share/dns/root.ds"

if [ -f $ROOT_DS ]; then
   DNSMASQ_OPTS="$DNSMASQ_OPTS `sed -e s/". IN DS "/--trust-anchor=.,/ -e s/" "/,/g $ROOT_DS | tr '\n' ' '`" 
fi

To :

ROOT_DS="/usr/share/dns/root.ds"

if [ -f $ROOT_DS ]; then
   DNSMASQ_OPTS="$DNSMASQ_OPTS `sed -e s/".*IN[[:space:]]DS[[:space:]]"/--trust-anchor=.,/ -e s/"[[:space:]]"/,/g $ROOT_DS | tr '\n' ' '`" 
fi

This problem occurs due to updating the dns-root-data package, more precisely in the file /usr/share/dns/root.ds.

The structure of this file was changed, the fields were separated only by spaces, now they were changed by tabs (\t)