3

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?

Steve Robillard
  • 34,988
  • 18
  • 106
  • 110
Railsana
  • 151
  • 1
  • 1
  • 3

3 Answers3

2

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.

Sitron_NO
  • 186
  • 5
0

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.

Railsana
  • 151
  • 1
  • 1
  • 3
-1

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`"
RPiAwesomeness
  • 3,021
  • 4
  • 31
  • 52