我正在使用 Elementary OS Freya (Ubuntu 14.04)。我已经安装了 DNSMASQ 并运行命令并收到以下错误:
$ sudo service dnsmasq start
* Starting DNS forwarder and DHCP server dnsmasq
dnsmasq: bad command line options: try --help [fail]
在 中/var/log/syslog
,我发现:
Dec 22 10:34:10 Marcelo-PC dnsmasq[3176]: bad command line options: try --help
Dec 22 10:34:10 Marcelo-PC dnsmasq[3176]: FAILED to start up
运行sh -x /etc/init.d/dnsmasq
我得到:
marcelo@Marcelo-PC:~$ sh -x /etc/init.d/dnsmasq start
+ set +e
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+ DAEMON=/usr/sbin/dnsmasq
+ NAME=dnsmasq
+ DESC=DNS forwarder and DHCP server
+ ENABLED=1
+ [ -r /etc/default/dnsmasq ]
+ . /etc/default/dnsmasq
+ ENABLED=1
+ CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
+ [ -r /etc/default/locale ]
+ . /etc/default/locale
+ LANG=en_US.UTF-8
+ export LANG
+ test -x /usr/sbin/dnsmasq
+ [ -f /lib/lsb/init-functions ]
+ . /lib/lsb/init-functions
+ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
+ [ -r /lib/lsb/init-functions.d/01-upstart-lsb ]
+ . /lib/lsb/init-functions.d/01-upstart-lsb
+ unset UPSTART_SESSION
+ _RC_SCRIPT=/etc/init.d/dnsmasq
+ [ -r /etc/init//etc/init.d/dnsmasq.conf ]
+ _UPSTART_JOB=dnsmasq
+ [ -r /etc/init/dnsmasq.conf ]
+ [ -r /lib/lsb/init-functions.d/20-left-info-blocks ]
+ . /lib/lsb/init-functions.d/20-left-info-blocks
+ [ -r /lib/lsb/init-functions.d/50-ubuntu-logging ]
+ . /lib/lsb/init-functions.d/50-ubuntu-logging
+ LOG_DAEMON_MSG=
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ true
+ [ ! ]
+ [ != yes ]
+ [ -x /sbin/resolvconf ]
+ RESOLV_CONF=/var/run/dnsmasq/resolv.conf
+ [ ! ]
+ DNSMASQ_USER=dnsmasq
+ test 1 != 0
+ log_daemon_msg Starting DNS forwarder and DHCP server dnsmasq
+ [ -z Starting DNS forwarder and DHCP server ]
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z ]
+ FANCYTTY=1
+ true
+ /usr/bin/tput xenl
+ /usr/bin/tput cols
+ COLS=169
+ [ 169 ]
+ [ 169 -gt 6 ]
+ /usr/bin/expr 169 - 7
+ COL=162
+ log_use_plymouth
+ [ n = y ]
+ plymouth --ping
+ printf * Starting DNS forwarder and DHCP server dnsmasq
* Starting DNS forwarder and DHCP server dnsmasq + /usr/bin/expr 169 - 1
+ /usr/bin/tput hpa 168
+ printf
+ start
+ [ ! -d /var/run/dnsmasq ]
+ start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/dnsmasq.pid --exec /usr/sbin/dnsmasq --test
+ start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/dnsmasq.pid --exec /usr/sbin/dnsmasq -- -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
dnsmasq: opções inválidas de linha de comando: tente --help
+ return 2
+ log_end_msg 1
+ [ -z 1 ]
+ [ 162 ]
+ [ -x /usr/bin/tput ]
+ log_use_plymouth
+ [ n = y ]
+ plymouth --ping
+ printf \r
+ /usr/bin/tput hpa 162
+ [ 1 -eq 0 ]
+ printf [
[+ /usr/bin/tput setaf 1
+ printf fail
fail+ /usr/bin/tput op
+ echo ]
]
+ return 1
+ exit 1
我无法让 DNSMASQ 工作。 my 中唯一未注释的行dnsmasq.conf
是(您可以看到整个文件这里):
address=/nintendowifi.net/192.168.0.8
我怎样才能看到问题所在?
答案1
该错误是包的问题dns-root-data
。 DNSmasq 不应该需要它,但它确实需要它。按着这些次序:
sudo apt-get purge dnsmasq
sudo apt-get autoremove
sudo apt-get install dnsmasq
不要忘记将您的配置(如果有)重新插入/etc/dnsmasq.conf
如果那不起作用,试试这个(至少适用于 Debian 9 和 Raspian)
sudo nano /etc/init.d/dnsmasq
读到的地方
if [ -f $ROOT_DS ]; then
注释掉下一行(在行首添加#)并将这一行放在其下方
`DNSMASQ_OPTS="$DNSMASQ_OPTS `mawk -- '{ printf " --trust-anchor=.,%d,%d,%d,%s", $5, $6, $7, $8 }' $ROOT_DS`"`
的结构/usr/share/dns/root.ds
发生了变化。字段以前仅用空格分隔,现在用制表符 (\t) 分隔