The Pi running Raspbian does not have a hardware clock or RTC (serial is being used by XBee) and whenever its turned off and restarted again, the time goes out of wack and we need to SSH in to shutdown ntp, run ntpupdate and restart ntp.

Is there a way to make it automatically sync the time when its started up and an internet connection has been established?

  • 1
    It should be doing this on startup automatically, what type of internet connection are you using ethernet or wireless? You could also add a RTC. Nov 28, 2014 at 7:10
  • At Archlinux ntpd comes pretty well configured and is started during boot-up.
    – Ghanima
    Nov 28, 2014 at 7:35
  • It might take a minute or so to get the network time. Have you considered an I2C RTC?
    – joan
    Nov 28, 2014 at 7:51
  • @joan I'm using SDA and SCL pins for an XBee, guess i cant use the RTC?
    – Nyxynyx
    Nov 28, 2014 at 8:16
  • 1
    I'm not familiar with XBee. Is it an I2C device? If so it should co-exist quite happily with other I2C devices on the same bus. To see if it is an I2C device you could try i2cdetect -y 0 or 1 depending on your Pi version.
    – joan
    Nov 28, 2014 at 8:28

1 Answer 1


The problemis that ntp is refusing to sync upon booting because the time difference between the pi and the remote server is too large (panic threshold exceeded). The best solution is to install fake-hwclock and instruct ntpd to ignore the panic threshold.

You can configure the panic threshold in one of two ways:

  • edit /etc/default/ntp and ensure that the -g option is present.
  • edit /etc/ntp.conf and place tinker panic 0 at the top

Install the fake-hwclock program (debian based):

# apt-get install fake-hwclock

fake-hwclock description from Debian package:

fake-hwclock: Save/restore system clock on machines without working RTC hardware

 Some machines don't have a working realtime clock (RTC) unit, or no
 driver for the hardware that does exist. fake-hwclock is a simple set
 of scripts to save the kernel's current clock periodically (including
 at shutdown) and restore it at boot so that the system clock keeps at
 least close to realtime. This will stop some of the problems that may
 be caused by a system believing it has travelled in time back to
 1970, such as needing to perform filesystem checks at every boot.

 On top of this, use of NTP is still recommended to deal with the fake
 clock "drifting" while the hardware is halted or rebooting.

With fake-hwclock installed your machine will not start up thinking it is 1970 all over again. When your machine boots up it will set its clock to the timestamp fake-hwclock wrote during the last reboot/shutdown. This means you can have a somewhat correct clock in case there are network issues when you boot up.

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.