3

I am building a raspbian-based distro (FullPageOS), and it seems like on boot of the latest Jessie sntp service is running, internet connection is established, but sntp is not updating the clock to the current date. This is particularly annoying because all the https certificates become invalid because of this.

I know that running this fixes the issue from the commandline:

sudo sntp -stime.nist.gov But running it on X autostart does not seem to have the same effect, I assume because the internet is not ready yet.

What would be the best way around this?

EDIT: I understand systemd uses systemd-timesyncd, how would I make sure it updated on boot when internet starts up?

2 Answers 2

2

I did some research and fixed the problem for Pidora as follow:

Raspberry PI doesn't have internal hardware clock so NTP synchronization is really important. Unfortunately current Pidora messed up with NTP services, perhaps they are trying to migrate from NTPD deamon to chrono. So if time synchronization didn't happen you need manually configure and enable NTP service.

Edit /etc/ntp.config first. Use Nano, VIM or WebFolder web text editor for the task.

  • Add server pool.ntp.org (other server entries can be commented out)
  • Uncomment line restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap (you may need to change IP to your network base)

Now you can enable NTP service

root>systemctl enable ntpd.service

And then start it

root>systemctl start ntpd.service

And check configuration

root>ntpq -p

Source of the tips: http://tjws.sourceforge.net/arch-raspi-java8.html

0
sudo crontab -e

Add the lines below into your crontab. Essentially what it does is try to ping up to 60 times on every boot, with 1 second wait between until the first success, then proceed to next command.

# Wait until Internet connection is available then update time
@reboot for i in {1..60}; do ping -c1 -W1 8.8.8.8 &> /dev/null && break; done && sntp -stime.nist.gov

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.