Running 12.04LTS for a while now. When we reboot, the server comes on with the time 46 minutes slow. nearly every reboot. We installed ntp (apt-get install ntp) so the time does auto-correct after 4-5 minutes, but that 4-5 minutes of incorrect time is very bad for us. we tried putting @reboot root ntpdate -u pool.ntp.org as a crontab entry but that didn't help.
1 Answer
Actually the package you may need care of is ntpdate
. It have 2 hook to run after:
- network interface is up:
/etc/network/if-up.d/ntpdate
- dhcp client exit:
/etc/dhcp/dhclient-exit-hooks.d/ntpdate
So check system log, may be you have problem with network
~$ grep ntp /var/log/syslog
Jul 8 10:04:57 BlueSkies ntpdate[3634]: name server cannot be used: Temporary failure in name resolution (-3)
Jul 8 10:05:02 BlueSkies dnsmasq[3777]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 8 10:05:02 BlueSkies dnsmasq[3777]: forwarded ntp.ubuntu.com to 192.168.1.1
Jul 8 10:05:02 BlueSkies dnsmasq[3777]: query[AAAA] ntp.ubuntu.com from 127.0.0.1
Jul 8 10:05:02 BlueSkies dnsmasq[3777]: forwarded ntp.ubuntu.com to 192.168.1.1
Jul 8 10:05:02 BlueSkies dnsmasq[3777]: reply ntp.ubuntu.com is 91.189.94.4
Jul 8 10:05:02 BlueSkies dnsmasq[3777]: reply ntp.ubuntu.com is 91.189.89.199
Jul 8 10:05:02 BlueSkies dnsmasq[3777]: reply ntp.ubuntu.com is 2001:67c:1560:8003::c7
Jul 8 10:05:08 BlueSkies ntpdate[3908]: adjust time server 91.189.89.199 offset 0.069675 sec
Jul 8 10:05:20 BlueSkies dnsmasq[3777]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 8 10:05:20 BlueSkies dnsmasq[3777]: forwarded ntp.ubuntu.com to 192.168.1.1
Jul 8 10:05:20 BlueSkies dnsmasq[3777]: query[AAAA] ntp.ubuntu.com from 127.0.0.1
Jul 8 10:05:20 BlueSkies dnsmasq[3777]: forwarded ntp.ubuntu.com to 192.168.1.1
Jul 8 10:05:20 BlueSkies dnsmasq[3777]: reply ntp.ubuntu.com is 91.189.94.4
Jul 8 10:05:20 BlueSkies dnsmasq[3777]: reply ntp.ubuntu.com is 91.189.89.199
Jul 8 10:05:20 BlueSkies dnsmasq[3777]: reply ntp.ubuntu.com is 2001:67c:1560:8003::c7
Jul 8 10:05:21 BlueSkies systemd-timesyncd[800]: Synchronized to time server 91.189.94.4:123 (ntp.ubuntu.com).
Also I would recommend changing the default ntp server name to IP which removes another layer of failure (DNS resolving). See /etc/default/ntpdate
The above log is from a Ubuntu 16.04 machine, that's why there was a 3rd sync request from a systemd unit systemd-timesyncd
.