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!

  • 3
    This works out of the box if you install the standard OS. No way of knowing what you have done. – joan Feb 18 '23 at 20:32
  • well its an imaged system set up, specific to our astronomy lab, so I think the "imager" forgot to add the time modules, in fact I know they did. They said something like, "did I forget to add that?" a few weeks ago. Hmm, maybe I can just wipe my SD card and start over and then add the layers that the "imager" has put together for observing. Hmm. Thank you so much for responding this helps a lot to know this. I did mistake the RAM, most are 2GB , I splurged an 8 MB, luckily and now I can take large sets of data, where the 2MB need to chunk or up or crash. Any more tips plz! Ty! – strange_octopi Feb 18 '23 at 20:46
  • Time would be wonderful, its for a time stamp on observations and for coordination. We're doing interferometry with them next month. I'd like to try SSH to them, to try remote observing and I'm afraid the time being off might trigger our University firewall or something? New lab equipment includes ~twenty 2GB Rasp Pis. By imaging the whole data taking environment at the start of semester, deploying it on the RaspPis. Lab class hopes to look at increasing reproducibility in observations, They've been great data takers better if we can get them to update time. – strange_octopi Feb 18 '23 at 20:54
  • yes if a distro is an image that we flashed into all the new SD cards out of the box. – strange_octopi Feb 18 '23 at 20:55
  • currently we are using our phones to record the time and date, but yes, I think getting time going may be needed before long. – strange_octopi Feb 18 '23 at 20:57
  • If I follow yr comment, someone in your lab built a "customised" distro - correct?? Leaving the timekeeping bits out wasn't a great idea obviously, but in their defence there have been numerous changes wrt timekeeping over the years. FWIW, if you have occasional network outages that preclude NTP access, consider adding a Realtime Clock using the DS3231 – Seamus Feb 18 '23 at 20:59
  • DO NOT add details in Comments. If you want anyone to read your question EDIT your Question. – Milliways Feb 18 '23 at 21:27
  • great links thank you! – strange_octopi Feb 18 '23 at 21:34
  • "we have internet access .... the NTP and it just keeps saying no time servers available" -> That's a bit of a disjunction, ala, "We can access the internet but we can't access the internet", so you might want to drill down there by asking a more detailed question about the NTP client software you are using and the context in general. However, you are certainly best off by just adding an RTC if reasonably (but not millisecond precise) timing is important. – goldilocks Feb 18 '23 at 22:11
  • Oooh! RTC is a piece of hardware! With a battery! Thank you So much. Thank you! Thank you. Thank you! We do have internet, sorry about that I said the I did and didn't in the same sentence! – strange_octopi Feb 18 '23 at 23:11
  • This might help: https://raspberrypi.stackexchange.com/questions/130705/pico-pi-rtc-interrupt/140932#140932 – tlfong01 Feb 19 '23 at 02:41

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,301
  • 10
  • 19
  • 28
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
  • 59,890
  • 31
  • 101
  • 209