Server is 14.04
My timedatectl status
www-data@Mercury:$ timedatectl status
Local time: Fri 2017-08-04 14:34:31 SGT
Universal time: Fri 2017-08-04 06:34:31 UTC
Timezone: Asia/Singapore (SGT, +0800)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
When I run ntpq I get connection refused. I have googled around but none of the solution works for me.
www-data@Mercury:$ sudo ntpq -p
ntpq: read: Connection refused
This is my /etc/ntp.conf
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com
Took me a year, but I now finally understood the issue. The server I was working on is situated in an internal network that restrict to only certain NTP servers.
Here's a list of useful steps to troubleshoot for Ubuntu 14.04 headless server
How to fix system clock drift
How to check current datetime
timedatectl status
you should see
How to see whether can access NTP servers
ntpq -p
If you see all showing
.INIT.
in refid means NOT connected to NTP server. Ask your network admin for NTP servers. This was my issue initially. If you seerefid
correctly pointing to some IP address, your NTP service is correctly connecting to the NTP servers.How to update NTP servers
As
root
, go tovim /etc/ntp.conf
Change this then
service ntp restart
How to force ntp system time update
Even if you update to the correct ntp server, the system clock might still be wrong. So you need to force the NTP update.
Stop the ntp service
Force the update with
ntpd -gq
Then start the ntp service again
It should look like this:
This should work
How to check if ntp service is running
Use
service ntp status
Even if you get that the service is running, that does not mean that the NTP service is correctly connecting to the NTP servers. Check
ntpq -p
command to be sureConnection refused means the ntp service isn't running
Try starting it with
sudo service ntp start