2

I'm using a Raspberry 1B and I have reset the timezone with

sudo dpkg-reconfigure tzdata

I want to use Europe/Paris. It say it works correctly, the time is said to be CEST but it is totally wrong I should have 18:44 (or 6:44pm but I wish to have 18:44) but I have 3:24 right now...

I have tried to change the NTP server but it does nothing. What should I check and do?

Here is my /etc/network/interfaces :

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid myssid
wireless-mode managed

I have tried with Wi-fi and with Ethernet on boot.

4

I have noticed that for ntp to work correctly, the Pi needs to have a working internet connection from boot onwards. When I connected the Pi to a WiFi network after boot, it would not refresh the date/time on the Pi and basically start with the time as it was when the Pi was last shut down. I recommend you try restarting your Pi after you have configured the network to autoconnect to either Ethernet or a known WiFi network.

  • 1
    You're comment is really helpfull because I do use Wi-fi via a Wi-fi adaptater, I have tried to boot with the RJ45 on but I still have the problem... – Julien Kosinski Jun 18 '15 at 10:20
  • 1
    It should come on if you have a connection within a reasonable period of time (ethernet). Try stopping and restarting it when you are sure (sudo service ntpd restart). It is one of those pieces of software who's designers I'd like to throttle for general unfriendliness. – goldilocks Jun 18 '15 at 18:26
  • $ sudo service ntpd restart ntpd: unrecognized service But, $ sudo service ntp restart [ ok ] Stopping NTP server: ntpd. [ ok ] Starting NTP server: ntpd. But, this does not fix anything. – Julien Kosinski Jun 22 '15 at 11:34
4

There may be two issues going on here: NTP and timezone misconfiguration.

Check that the NTP daemon is running:

ps auxwww | grep ntp

If it is installed and running verify that it is in sync:

ntpq -p | egrep "^\*|jitter"

It should show that it's in sync with a remote server. For example:

$ ntpq -p | egrep "^\*|jitter"
     remote           refid      st t when poll reach   delay   offset  jitter
*gatekeeper.tss. 204.123.2.72     2 u   10   64    3   42.324    5.973   1.017 

If ntp isn't installed install it and make sure it's running:

apt-get install ntp
service ntp start

After the daemon is started it will take a while for it to get in sync with a remote server, so wait a few minutes before checking it with ntpq -p


If you still have issues with it displaying the wrong time zone:

Verify '/etc/localtime' has the correct data:

ls -la /etc/localtime
ls -la /usr/share/zoneinfo/Europe/Paris

or

md5sum /etc/localtime
md5sum /usr/share/zoneinfo/Europe/Paris

If they don't match replace it:

cp -p /usr/share/zoneinfo/Europe/Paris /etc/localtime

Then verify with the date command that the correct timezone is set.

  • 1
    The problem is it does not sync : $ ntpq -p | egrep "^*|jitter" displays no server. – Julien Kosinski Jun 18 '15 at 10:18
3

To overcome the problem of time synchronisation not working when you don't have an internet connection at boottime, just let the device boot then go to the terminal (SSH or something similar) then type at the prompt:
sudo sntp -s [timeserver]
where in the above command [timeserver] is the address of a timeserver.
Remember: if the timedifference between the actual time and the time the RPi is set to is too big then NTP just refuses to synchronize the time, this could also be the problem in your case. The command mentioned above will synchronize no matter how big the difference is.

  • I don't understand what's going on here... ~$ sudo sntp -s 0.fr.pool.ntp.org 17 Jun 08:41:10 sntp[3079]: Started sntp 17 Jun 08:41:10 sntp[3079]: kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod – Julien Kosinski Jun 22 '15 at 11:32
  • To avoid the previous bug I had to redefine my DNS server. But, now, the command just display a wrong time... – Julien Kosinski Jun 22 '15 at 12:14
  • What does the date command display? – wie5Ooma Jun 22 '15 at 12:21
  • Thing is it does not really sync. ~$ sudo sntp -s 0.fr.pool.ntp.org 17 Jun 09:54:57 sntp[3451]: Started sntp (Wrong date and hour) $ date Wed Jun 17 09:57:18 CEST 2015. ntpq -p is always like that : pastebin.com/chBRpHyW – Julien Kosinski Jun 22 '15 at 12:47
  • Well, may be the timeserver is wrong. Please try this: sudo /usr/sbin/sntp -s pool.ntp.org – wie5Ooma Jun 22 '15 at 19:10

Your Answer

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

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