From 674d63e212a09b7dd402a1cc8d4effa8e1ec9f6c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Jun 2009 19:40:14 +0000 Subject: [PATCH] * Don't do a separate "ntp -q -g" to reset the system time in the ntp start script. It's probably not necessary, but more importantly, it can hang forever if the network is down. (Actually it will sit in a loop waiting for UDP packets that will never arrive.) This causes the NixOS reboot to hang, since Upstart can't kill jobs stuck in their start script. svn path=/nixos/branches/modular-nixos/; revision=15829 --- modules/services/networking/ntpd.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/services/networking/ntpd.nix b/modules/services/networking/ntpd.nix index f2c8e1a7a3a..c8063092a95 100644 --- a/modules/services/networking/ntpd.nix +++ b/modules/services/networking/ntpd.nix @@ -93,11 +93,16 @@ mkIf config.services.ntp.enable { # Needed to run ntpd as an unprivileged user. ${modprobe}/sbin/modprobe capability || true - ${ntp}/bin/ntpd -q -g ${ntpFlags} + # !!! This can hang indefinitely if the network is down or + # the servers are unreachable. This is particularly bad + # because Upstart cannot kill jobs stuck in the start + # phase. Thus a hanging ntpd job can block system + # shutdown. + # ${ntp}/bin/ntpd -q -g ${ntpFlags} end script - respawn ${ntp}/bin/ntpd -n ${ntpFlags} + respawn ${ntp}/bin/ntpd -g -n ${ntpFlags} ''; }]; };