During a server bootstrap process, I want to explicitly run ntpdate
rather than rely on the ntp
daemon. However, the clock can be severely skewed at this point in time, which causes an error when executing sudo ntpdate address.of.ntp.server
. I noticed that after running this command multiple times, it eventually works, possibly due to a number of samples accumulating with the same date, however I can't find this specification. What I want is to just take one sample, force ntpdate
to accept the response, and then start ntp via sudo service ntp start
. How can I do this?
EDIT: I tried sudo ntpd -g -q
as suggested, but I still get the following error in /var/log/syslog
:
Sep 26 12:14:29 jd-0922-node1 ntpd[22239]: ntpd 4.2.6p5@1.2349-o Wed Oct 9 19:08:06 UTC 2013 (1)
Sep 26 12:14:29 jd-0922-node1 ntpd[22239]: proto: precision = 0.115 usec
Sep 26 12:14:29 jd-0922-node1 kernel: [173176.189773] type=1400 audit(1411758869.717:48): apparmor="DENIED" operation="open" profile="/usr/sbin/ntpd" name="/usr/local/sbin/" pid=22239 comm="ntpd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Sep 26 12:14:29 jd-0922-node1 kernel: [173176.189779] type=1400 audit(1411758869.717:49): apparmor="DENIED" operation="open" profile="/usr/sbin/ntpd" name="/usr/local/bin/" pid=22239 comm="ntpd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Sep 26 12:14:29 jd-0922-node1 ntpd[22239]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Sep 26 12:14:29 jd-0922-node1 ntpd[22239]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING