I am using Raspberry PI Model B with Raspbian, installed by NOOBS, upgraded to the latest version. The NTP server is automatically started in the boot process.

When I boot my RPI, the time is always wrong — about 15 minutes in the past. Even if I wait for several hours, it's incorrect.

I run

/etc/init.d/ntp restart

manually and it sets the correct time within seconds, sometimes it needs two restarts.

I define several servers in the ntp.conf:

 server ntp1.t-online.de iburst prefer

 server 0.de.pool.ntp.org iburst
 server 1.de.pool.ntp.org iburst
 server 2.de.pool.ntp.org iburst
 server 3.de.pool.ntp.org iburst
 ...

Does anyone have an idea how to fix this?

Are you using DHCP or static IP?

If you use DHCP then it will read /var/lib/ntp/ntp.conf.dhcp, not /etc/ntp.conf

If you use a static IP, remove /var/lib/ntp/ntp.conf.dhcp if it exist.

Either way, check if ntp is running after a reboot with ps aux | grep ntp If it is, then run ntpq -p to check if it has started to sync with the timeservers. This can take some time, sometime it needs 2-3 pulls, each taking about 60 seconds. Just rerun ntpq -p to see the status.

  • Thanks for your quick reply! I checked everything you wrote and I am using DHCP indeed, but my config file is definitely in /etc/ntp.conf. – Railsana Oct 23 '13 at 22:16
  • NTP is running after booting, but it doesn't connects to any servers. When I restart the NTP server, a log file is written and everything works fine. – Railsana Oct 23 '13 at 22:22
  • What is the output of ntpq -p after boot, and after restart of ntp? – Sitron_NO Oct 24 '13 at 6:24
  • Sorry, I only get this: localhost: timed out, nothing received ***Request timed out – Railsana Oct 27 '13 at 22:23
  • /var/log/ntpstats/peerstats is full of this: 56592 48260.308 192.53.103.108 9024 2201.124660904 0.224497746 7.937502637 0.000000954 – Railsana Oct 27 '13 at 22:26

I don't know what exactly went wrong, but something messed up the whole setup. I reinstalled Raspbian (via NOOBS) and all NTP settings worked fine again.

Here is a script that you can set to run on boot to fix your time

#!/bin/bash
#Visit www.timeapi.org to find the correct url for your timezone. Then 
replace the url in the first line

time=$(wget http://www.timeapi.org/utc/in+two+hours?format=%25d%20%25b%20%25Y%20%25I:%25M:%25S -q -O -)
echo "Time set to:"
sudo date -s "\`echo $time`"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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