1

My raspberry Pi 2 has a wrong date and it is not a timezone problem since UTC time right now is (6:53 PM Thursday, June 2, 2016) and running:

pi@raspberrypi2:~ $ date -u
mié jun  1 14:13:45 UTC 2016

Also, see this:

pi@raspberrypi2:~ $ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ntp.copaco.com. .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 190.15.128.72   .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 c.ntp.br        .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 234.229.33.186. .INIT.          16 u    - 1024    0    0.000    0.000   0.000

What i get from tha output is that, apparently, since the offset is 0 then raspbian thinks its time is perfect and it doesn't change it to the right value.

Any clues here? Thanks!

EDIT1: I do have interent connection, I can ping servers and get responses, also DNS is properly configured, I can sucessfully use nslookup

3
  • Are you sure you have an internet connection? Normally it will display a + or * in the first column for the peers. Commented Jun 2, 2016 at 19:24
  • @SteveRobillard yes it does have internet access. I can ping those servers and get a response
    – seed_87
    Commented Jun 3, 2016 at 14:14
  • As your own answer confirms, in the above output from ntpq -p the second column suggests that the connections to the listed servers have not been fully set up (and in your case blocked). You might like to note that when ntpd is up and running it tracks the last 20-odd periodic packets from each peer and the status of those is indicated in the "when" column (which contains an incrementing count of, usually seconds since the last packet/poll) "poll" is the interval between those poll attempts and "reach" is a two and a half octal digit bitmap of those 20 packets obtained: 377 good, 0 bad!
    – SlySven
    Commented Jun 20, 2016 at 12:10

2 Answers 2

3

Turns out my ISP blocked port 125.

I followed this guide: HOWTO: Run Your Own NTP Server When Your ISP Blocks Ports

Which explains how to use ntpdate on a non blocked port.

Thanks @Karim and @SteveRobillard

2

If your Raspberry is running Ubuntu you can run this command

ntpdate ntp.ubuntu.com

and it will update the time automatically according to ubuntu time server, However if you want Ubuntu to update the time after each reboot

create a file /etc/cron.daily/ntpdate that contain

#!/bin/sh
ntpdate ntp.ubuntu.com

Make sure that you make this new file executable:

sudo chmod 755 /etc/cron.daily/ntpdate

And thats it.

7
  • Can this command be changed for other OS's?
    – sir_ian
    Commented Jun 2, 2016 at 23:19
  • This command is included with so many linux distributions so it should work for other OS's.
    – Karim H
    Commented Jun 2, 2016 at 23:22
  • What i meant was more like if i did use a different OS would i still use ntp.ubuntu.com or some other place?
    – sir_ian
    Commented Jun 2, 2016 at 23:57
  • that should work fine or you can go to NTP Website and chose the one that suits you
    – Karim H
    Commented Jun 3, 2016 at 0:00
  • The raspberryPi is headless, running the latest raspbian jessie lite (From May 2016), it doesnt seem to have that ntpdate command :(
    – seed_87
    Commented Jun 3, 2016 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.