Stephane Bortzmeyer
2014-Oct-18 13:57 UTC
[nsd-users] Starting NSD on Debian with systemd fails
Since I moved to Debian "jessie" which forces the usage of systemd, NSD no longer starts when the machine boots. However, if I log in immediately, and issue a "systemctl start nsd", it starts fine. Otherwise, I get the message: % sudo systemctl status -l nsd ? nsd.service - Name Server Daemon Loaded: loaded (/lib/systemd/system/nsd.service; enabled) Active: failed (Result: start-limit) since Sat 2014-10-18 13:48:19 UTC; 2min 5s ago Process: 2799 ExecStart=/usr/sbin/nsd -d -c $CONFFILE (code=exited, status=1/FAILURE) Process: 2793 ExecStartPre=/bin/sh -c /bin/chown "$(/usr/sbin/nsd-checkconf -o username $CONFFILE)" "$(dirname "$(/usr/sbin/nsd-checkconf -o database $CONFFILE)")" (code=exited, status=0/SUCCESS) Process: 2786 ExecStartPre=/bin/sh -c /bin/mkdir -p "$(dirname "$(/usr/sbin/nsd-checkconf -o database $CONFFILE)")" (code=exited, status=0/SUCCESS) Process: 2779 ExecStartPre=/bin/sh -c /bin/chown "$(/usr/sbin/nsd-checkconf -o username $CONFFILE)" "$(dirname "$(/usr/sbin/nsd-checkconf -o pidfile $CONFFILE)")" (code=exited, status=0/SUCCESS) Process: 2774 ExecStartPre=/bin/sh -c /bin/mkdir -p "$(dirname "$(/usr/sbin/nsd-checkconf -o pidfile $CONFFILE)")" (code=exited, status=0/SUCCESS) Main PID: 2799 (code=exited, status=1/FAILURE) Oct 18 13:48:19 mononoke.bortzmeyer.org systemd[1]: Unit nsd.service entered failed state. Oct 18 13:48:19 mononoke.bortzmeyer.org nsd[2799]: [2014-10-18 13:48:19.151] nsd[2799]: error: can't bind udp socket: Cannot assign requested address Oct 18 13:48:19 mononoke.bortzmeyer.org nsd[2799]: [2014-10-18 13:48:19.151] nsd[2799]: error: server initialization failed, nsd could not be started Oct 18 13:48:19 mononoke.bortzmeyer.org systemd[1]: nsd.service holdoff time over, scheduling restart. Oct 18 13:48:19 mononoke.bortzmeyer.org systemd[1]: Stopping Name Server Daemon... Oct 18 13:48:19 mononoke.bortzmeyer.org systemd[1]: Starting Name Server Daemon... Oct 18 13:48:19 mononoke.bortzmeyer.org systemd[1]: nsd.service start request repeated too quickly, refusing to start. Oct 18 13:48:19 mononoke.bortzmeyer.org systemd[1]: Failed to start Name Server Daemon. Oct 18 13:48:19 mononoke.bortzmeyer.org systemd[1]: Unit nsd.service entered failed state. I assume there is some dependency which is missing in the systemd configuration files. May be NSD tries to start before the network? Any NSD expert here?
On 2014-10-18 15:57, Stephane Bortzmeyer wrote: [..]> Oct 18 13:48:19 mononoke.bortzmeyer.org nsd[2799]: [2014-10-18 13:48:19.151] nsd[2799]: error: can't bind udp socket: Cannot assign requested addressAre you binding to a specific IP address? As you might be racing the system if the network is not fully up yet (hence, the address you are binding to is missing). Seems distributions do not understand the concept that programs that use network functions like it when there actually is a network. You might want to set net.ipv4.ip_nonlocal_bind = 1 in sysctl (which is also valid for IPv6 according to rumors). That way nsd can bind to the IP it wants even if it is not local yet. or put a "ip addr show >>/tmp/nsdboot.log" into "/usr/sbin/nsd-checkconf" to see what is up or not at that time. Greets, Jeroen
Stephane Bortzmeyer
2014-Oct-18 14:21 UTC
[nsd-users] Starting NSD on Debian with systemd fails
On Sat, Oct 18, 2014 at 04:16:53PM +0200, Jeroen Massar <jeroen at massar.ch> wrote a message of 22 lines which said:> Are you binding to a specific IP address?Yes.
On Sat, 18 Oct 2014, Stephane Bortzmeyer wrote:> Since I moved to Debian "jessie" which forces the usage of systemd, > NSD no longer starts when the machine boots. However, if I log in > immediately, and issue a "systemctl start nsd", it starts fine.Does the nsd.service file contain: [Unit] After=network-online.target Note this is different from "After=network" Paul