3

Does anyone know how to get network time for collecting data using Raspberry pis with no backup battery. Regular googling has gotten me things that do not work. They are Pi 4B with 4GB or 8 GB of RAM each with SD cards of 32 to 128 GB each. we have plenty of places to store data and we have internet access there are web browsers installed. Everything works great except the clocks. I have tried installing the NTP and it just keeps saying no time servers available.

We need them to ping a time server on start -up , or at all, I can't even force a time update. All I can do is manually set the time by reading my phone, and it erases each time the Pi is turned off or unplugged which is generally right after taking data.

Thanks for any help its been so frustrating. I have googled it a lot, to no avail, nothing I find works. Maybe the platform just isn't popular enough yet? I'm trying this link next and I will let people know what I find too! Thank you! https://netfuture.ch/2021/12/transparent-trustworthy-time-with-ntp-and-nts/

If you help me you help an entire lab of tired astronomy students, and their exhausted professors and TAs. We are all pretty frustrated. Thank you!

2 Answers2

3

You can run systemd-timesyncd as @Milliways has documented or you can switch back to the old ntpd. Support for this was dropped by Raspbian/RaspiOS a few years ago.

To switch first you need to disable everything to do with systemd-timesyncd as it will prevent you running ntpd. systemctl disable systemd-timesyncd will do that.

Install ntpd with sudo apt update; sudo apt install ntpd and it will just work.

Note: I run a master ntpd on one of my Raspberry Pis and run a slave ntpd on all the other systems. That's a special configuration that isn't an answer for this question.

Dougie
  • 5,381
  • 11
  • 22
  • 30
2

Raspberry Pi OS uses timesyncd to synchronise time. This is a simplified ntp client (SNTP) (which of course needs network access).

systemctl status systemd-timesyncd.service will show status and if it is running.

If it is not running you could try enabling it.

Milliways
  • 62,573
  • 32
  • 113
  • 225