Главная
   Документация
      Asterisk
      CentOS
      Debian
      Docker
      FreeBSD
      openHAB
      PostgreSQL
      Raspberry Pi
      Ubuntu
      WWW
      Разное




Главная Документация Raspberry Pi › Ошибка: Unit nss-lookup.target has failed при запуске dnsmasq

Ошибка Unit nss-lookup.target has failed при запуске dnsmasq.

Автор:

Статья написана 2018-07-07 00:11:47
Последние правки 2018-07-07 00:11:47

С недавних пор после обновления Raspbean Jessie перестал запускаться dnsmasq, "Job for dnsmasq.service failed. See 'systemctl status dnsmasq.service' and 'journalctl -xn' for details.". При выполнении journalctl -xn узнаем, что "Unit nss-lookup.target has failed."

Raspbean Jessie

Ошибка запуска dnsmasq:
# systemctl restart dnsmasq
Job for dnsmasq.service failed. See 'systemctl status dnsmasq.service' and 'journalctl -xn' for details.
# journalctl -xn
-- Logs begin at Fri 2018-07-06 22:35:25 MSK, end at Fri 2018-07-06 23:33:21 MSK. --
Jul 06 23:33:21 pi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
-- Subject: Unit dnsmasq.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit dnsmasq.service has begun starting up.
Jul 06 23:33:21 pi dnsmasq[2958]: dnsmasq: syntax check OK.
Jul 06 23:33:21 pi dnsmasq[2961]: dnsmasq: junk found in command line
Jul 06 23:33:21 pi dnsmasq[2961]: junk found in command line
Jul 06 23:33:21 pi dnsmasq[2961]: FAILED to start up
Jul 06 23:33:21 pi systemd[1]: dnsmasq.service: control process exited, code=exited status=1
Jul 06 23:33:21 pi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
-- Subject: Unit dnsmasq.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit dnsmasq.service has failed.
-- 
-- The result is failed.
Jul 06 23:33:21 pi systemd[1]: Dependency failed for Host and Network Name Lookups.
-- Subject: Unit nss-lookup.target has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nss-lookup.target has failed.
-- 
-- The result is dependency.
Jul 06 23:33:21 pi systemd[1]: Unit dnsmasq.service entered failed state.

Проблема в следующем: в системе есть файл /etc/share/dns/root.dns, в котором поменялся формат, из-за чего dnsmasq при запуске не может его прочитать.


Решение. Редактируем /etc/init.d/dnsmasq. Ищем:
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
и меняем
DNSMASQ_OPTS="$DNSMASQ_OPTS `sed -e s/". IN DS "/--trust-anchor=.,/ -e s/" "/,/g $ROOT_DS | tr '\n' ' '`"
на:
DNSMASQ_OPTS="$DNSMASQ_OPTS `sed -e s/".*IN[[:space:]]DS[[:space:]]"/--trust-anchor=.,/ -e s/"[[:space:]]"/,/g $ROOT_DS | tr '\n' ' '`"
После чего запускаем dnsmasq:
# systemctl start dnsmasq


Связанные странички:
Raspbian, установка FastCGI для Perl и настройка под nginx
OpenHAB2 - установка на Raspbian
Raspberry Pi, установка Raspbian
Ставим squid3 на Raspbian Jessie.
Ростелеком. Raspbian Jessie в качестве роутера.
Raspberry Pi, Raspbian, nginx
Raspberry Pi, Raspbian, mysql
Raspberry Pi, Raspbian, Wi-Fi