23

I tried so much different things of installing ntpq or other stuff but nothing works.

I dont can change it to yes. I hope someone can help here.

I had Ubuntu 16.04 This is my terminal output of the Command timedatectl

      Local time: Tue 2017-06-27 20:52:45 CEST
  Universal time: Tue 2017-06-27 18:52:45 UTC
        RTC time: n/a
       Time zone: Europe/Berlin (CEST, +0200)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

Also tried this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-16-04

But when i make sudo timedatectl set-ntp on it only changes Network time on: yes/no.

Also installed ntp. But from the command sudo ntpq -p i get this error

ntpq: read: Connection refused
3
  • It seems ntpd is not started after installation. Try running sudo ntpd -n to see if it starts running and the configuration file is OK (option -n means not to fork and to log to the calling terminal).
    – ridgy
    Commented Jun 28, 2017 at 11:31
  • Addition: There is nothing wrong with the output of timedatectl. If ntpdis not installed, NTP synchronized: no is OK (see help.ubuntu.com/lts/serverguide/NTP.html#timesyncd)
    – ridgy
    Commented Jun 28, 2017 at 12:25
  • Do you have VirtualBox Guest Additions installed?
    – Diego V
    Commented Jun 26, 2018 at 16:51

2 Answers 2

31

When the clock is too much desincronized (more than 3 seconds?) it won't get update automatically. In order to force it manually:

sudo service ntp stop
sudo ntpd -gq ← here you can see it's getting sync
sudo service ntp start

Confirm everything's ok
timedatectl
Better explanation and all the credit here

4
  • 1
    Yes !!! Finally a working solution. I'm on ubuntu 18.04 (ubuntu-minimal)
    – realtebo
    Commented Aug 15, 2018 at 0:27
  • 1
    this worked for raspbian stretch for rpi2 too! thanks
    – Aswn
    Commented Sep 16, 2018 at 5:50
  • Worked for Raspberry pi 3 with stretch too. Commented Feb 20, 2019 at 7:40
  • 4
    for my install of 18.04 there is no ntp and should not be. What worked was simply to restart the service sudo systemctl restart systemd-timesyncd
    – DKebler
    Commented May 2, 2019 at 14:14
7

After installing ntp

sudo apt install ntp

in the output of timedatectl

NTP synchronized: yes

the time is immediately automatically synchronized.

2
  • 1
    I still had to reboot after installing ntp
    – sreimer
    Commented Apr 23, 2018 at 13:39
  • 1
    following this for 18.04 and beyond is a bad idea things have changed. see my comment above to restart the systemd service
    – DKebler
    Commented May 2, 2019 at 14:14

Not the answer you're looking for? Browse other questions tagged .