[Bug 581193] Re: ntp init script fails to start ntpd
Dyna
dyn_ares at yahoo.com
Mon May 17 14:27:30 BST 2010
Hi,
It's for 9.04, don't know if it's still present in 9.10 or 10.04 haven't
checked yet.
Cheers Dyna
----- Original Message ----
From: Chuck Short <chuck.short at canonical.com>
To: dyn_ares at yahoo.com
Sent: Mon, May 17, 2010 1:22:01 PM
Subject: [Bug 581193] Re: ntp init script fails to start ntpd
Thanks for the patch which version is this for?
chuck
** Changed in: ntp (Ubuntu)
Importance: Undecided => Low
** Changed in: ntp (Ubuntu)
Status: New => Incomplete
--
ntp init script fails to start ntpd
https://bugs.launchpad.net/bugs/581193
You received this bug notification because you are a direct subscriber
of the bug.
Status in “ntp” package in Ubuntu: Incomplete
Bug description:
Binary package hint: ntp
In /etc/init.d/ntp you sync with the ntp servers with this line:
/usr/sbin/ntpdate -s -b $NTPDATE_OPTIONS $tickers &>/dev/null
After that the script starts ntpd with this line
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas
$DAEMON -- -p $PIDFILE -u $UGID $NTPD_OPTS
What happens is that. ntp will not start since port 123 (ntp) is already in use.
/* from strace:
bind(16, {sa_family=AF_INET, sin_port=htons(123), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
*/
The reason is that, ntpdate is running in the background and if it
doesn't sync fast it will still use port 123 when ntp is trying to start
a few lines down the script.
Here is a patch :) -- and yes you have to strart ntpdate in the
foreground otherwise you have a race!!
--- ntp.old 2010-05-16 08:04:53.000000000 +0100
+++ ntp 2010-05-16 07:59:44.000000000 +0100
@@ -54,7 +54,7 @@
tickers=$(awk '$1=="peer"||$1=="server"{print $2}' /etc/ntp.conf | fgrep -v 127.127.1.0)
echo "Synchronizing with time server: "
- /usr/sbin/ntpdate -s -b $NTPDATE_OPTIONS $tickers &>/dev/null
+ /usr/sbin/ntpdate -s -b $NTPDATE_OPTIONS $tickers >/dev/null
log_daemon_msg "Starting NTP server" "ntpd"
Cheers Dyna
To unsubscribe from this bug, go to:
https://bugs.launchpad.net/ubuntu/+source/ntp/+bug/581193/+subscribe
--
ntp init script fails to start ntpd
https://bugs.launchpad.net/bugs/581193
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to ntp in ubuntu.
More information about the Ubuntu-server-bugs
mailing list