My clock is off, so I would like to synchronize it using ntpdate. I tried several different NTP servers, but for some reason I always get the following error message:

$ sudo ntpdate ntp.ubuntu.com 4 Mar 12:27:35 ntpdate[1258]: no server suitable for synchronization found $ sudo ntpdate pool.ntp.org 4 Mar 12:27:50 ntpdate[1267]: no server suitable for synchronization found $ sudo ntpdate de.pool.ntp.org 4 Mar 12:28:01 ntpdate[1273]: no server suitable for synchronization found $ sudo ntpdate us.pool.ntp.org 4 Mar 12:28:12 ntpdate[1276]: no server suitable for synchronization found 

Related questions

I have looked through related questions, but none solve my problem:

Things I have tried

I installed the ntp package

...and tried using the ntpd daemon instead of the ntpdate utility. It won't sync my time either; the daemon starts fine, but my clock remains off. I even tried using the exact /etc/ntp.conf from the accepted answer in the latter post, and restarting the daemon. No go. Anyway, I don't want to use the daemon. I am perfectly aware that ntpdate is considered "deprecated", and it is advised to use ntpd -q instead. Also see here:

But since ntpd doesn't work for me either, the problem lies elsewhere. And I find that I would prefer not having to install any extra packages just for synchronizing the clock. ntpdate comes pre-installed with Ubuntu, and it should work just fine. So I uninstalled the ntp package again.

Maybe port 123 is blocked?

From this post:

...I got the idea that port 123 may be blocked from my computer / network at my work place. Indeed,

$ sudo nmap -p123 -sU -P0 localhost ... PORT STATE SERVICE 123/udp closed ntp ... $ sudo ufw allow 123/udp Rules updated Rules updated (v6) $ sudo nmap -p123 -sU -P0 localhost ... PORT STATE SERVICE 123/udp open ntp ... 

But still:

$ sudo ntpdate ntp.ubuntu.com 4 Mar 13:06:16 ntpdate[4361]: no server suitable for synchronization found 

Even with the -u option, which tells ntpdate to use an unprivileged port for syncing (instead of port 123) which is certainly not blocked from my work place:

$ sudo ntpdate -u ntp.ubuntu.com 4 Mar 13:06:28 ntpdate[4427]: no server suitable for synchronization found 

Maybe the strata are too high?

Lastly, from this post over at serverfault:

...I thought that maybe the strata from the NTP servers are too high. They aren't, though. Let's see a little more debugging info:

$ sudo ntpdate -dv ntp.ubuntu.com 4 Mar 13:12:24 ntpdate[4523]: ntpdate 4.2.6p5@1.2349-o Wed Oct 9 19:08:07 UTC 2013 (1) Looking for host ntp.ubuntu.com and service ntp host found : golem.canonical.com transmit(91.189.89.199) transmit(91.189.94.4) transmit(91.189.89.199) transmit(91.189.94.4) transmit(91.189.89.199) transmit(91.189.94.4) transmit(91.189.89.199) transmit(91.189.94.4) transmit(91.189.89.199) transmit(91.189.94.4) 91.189.89.199: Server dropped: no data 91.189.94.4: Server dropped: no data server 91.189.89.199, port 123 stratum 0, precision 0, leap 00, trust 000 refid [91.189.89.199], delay 0.00000, dispersion 64.00000 transmitted 4, in filter 4 reference time: 00000000.00000000 Mon, Jan 1 1900 1:00:00.000 originate timestamp: 00000000.00000000 Mon, Jan 1 1900 1:00:00.000 transmit timestamp: d6c041ae.e6166441 Tue, Mar 4 2014 13:12:30.898 filter delay: 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 filter offset: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 delay 0.00000, dispersion 64.00000 offset 0.000000 server 91.189.94.4, port 123 stratum 0, precision 0, leap 00, trust 000 refid [91.189.94.4], delay 0.00000, dispersion 64.00000 transmitted 4, in filter 4 reference time: 00000000.00000000 Mon, Jan 1 1900 1:00:00.000 originate timestamp: 00000000.00000000 Mon, Jan 1 1900 1:00:00.000 transmit timestamp: d6c041af.1948fc50 Tue, Mar 4 2014 13:12:31.098 filter delay: 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 filter offset: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 delay 0.00000, dispersion 64.00000 offset 0.000000 4 Mar 13:12:33 ntpdate[4523]: no server suitable for synchronization found 

Pfeeewww... this was a long one, sorry for that. I'm stumped. Any clues?

Update: additional infos

No matter whether an NTP server HOSTNAME figures in /etc/ntp.conf, and no matter whether the ntpd service is running or not, whenever I run sudo ntpdate -u HOSTNAME, I get no server suitable for synchronization found. Same thing when the ntpd service is not running and I omit the -u option. When the ntpd service is running and I omit the -u option, I instead get the NTP socket is in use, exiting.

Also:

$ timedatectl status Local time: Wed 2014-03-05 13:11:54 CET Universal time: Wed 2014-03-05 12:11:54 UTC Timezone: Europe/Berlin (CET, +0100) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: no Last DST change: DST ended at Sun 2013-10-27 02:59:59 CEST Sun 2013-10-27 02:00:00 CET Next DST change: DST begins (the clock jumps one hour forward) at Sun 2014-03-30 01:59:59 CET Sun 2014-03-30 03:00:00 CEST 

But the UTC time is not correct here. Right now UTC time is 11:11, not 12:11.

And:

$ sudo hwclock --show Wed 05 Mar 2014 01:11:56 PM CET -0.625627 seconds 
4

5 Answers

Your hosting provider is blocking ntp packets. This heavy handed approach has been implemented by some ISPs in response to the DDoS attacks. You can see that ntpdate is sending the packets fron the ntpdate -vd :

transmit(91.189.94.4) transmit(91.189.89.199) transmit(91.189.94.4) transmit(91.189.89.199) 

I would contact your ISP and ask if they are blocking external ntp requests and if they have a local server that you can use for time sync.

There are a couple more obscure possibilities but it is tough to rule them out since you have not posted any logs from syslog.

11

This is not an ntp answer, however...

sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" 

this and the curl version here.

6

Use htpdate

If ntp transmission is blocked in your network, install htpdate. It syncs time over http protocol. Accuracy will be withing 0.5 secs, according to man page.

sudo apt-get install htpdate sudo htpdate -a google.com 

htpdate service will start when you install the package. Time will be update immediately if there is internet connection.

4

I had the same issue and this is how I solved it. I have give a detailed answer from top to bottom. You might want to skip to middle of my answer or just refer the screenshots below for understanding it in a glance.

First install ntpdate(Obviously you have done this)

sudo apt-get install ntpdate 

NEXT You need to configure ntp with servers as follows:

You should at least set following parameter in /etc/ntp.conf config file: server

For example, open /etc/ntp.conf file using nano text editor:

sudo nano /etc/ntp.conf 

Locate server parameter and if it is empty set it as follows:

server pool.ntp.org 

But usually In ubuntu already some servers are prewritten which might be

server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org 

enter image description here

Then Save the file and restart the ntpd service:

sudo /etc/init.d/ntpd start 

You can synchronize the system clock to an NTP server immediately with following command:

sudo ntpdate pool.ntp.org 

or just run already servers are defined

sudo ntpdate 0.ubuntu.pool.ntp.org 

or other servers that are defined using server

generally

sudo ntpdate <one of the servername in /etc/ntp.conf> 

BUT after that there is a chance you get the Error NTP socket in use as shown below:

enter image description here

In that case just run

ntpdate -u pool.ntp.org 

to update when ntp deamon is running

OR just stop the deamon,update and start it again as follows:

sudo ntpdate pool.ntp.org sudo service ntp stop sudo ntpdate pool.ntp.org sudo service ntp start 

and you will get

enter image description here

7

Similar to Alex's answer, this worked for me for getting around the ntp port being firewalled:

sudo date -s "$(curl -v 2>&1 | \ grep "Date: " | awk '{ print $3 " " $5 " " $4 " " $7 " " $6 " GMT"}')" 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy