Raspberry PI 4 without RTC - delayed start

432 views
Skip to first unread message

pli...@googlemail.com

unread,
Feb 4, 2021, 8:21:16 AM2/4/21
to weewx-user
Hello!

I am about to install weewx on a Raspberry Pi 4.
The Raspberry has no RTC, but synchronization using systemd-timesyncd

A note on the delayed start of weewx after timesync is stored in the wiki.

<note>
Added 25-Nov-2019.
The article How can I delay the startup of systemd services until the datetime is set
(no RTC on the Raspberry Pi) has some very useful hints on a more elegant solution
https://raspberrypi.stackexchange.com/questions/94635/how-can-i-delay-the-startup-of-systemd-services-until-the-datetime-is-set-no-rt
</note>

Does anyone have that going?
Is it stable and reliable with this method to delay the start of weewx to avoid incorrect timestamps?

Thank you for your answers
Pline

wfs...@gmail.com

unread,
Feb 7, 2021, 9:48:32 AM2/7/21
to weewx-user
Thanks for pointing this out.  It looks like it is working for me.  I switched over to systemd control of weewx following the directions in the Wiki: systemd,  and I had to enable the systemd-time-wait-sync service on my Pi: ($sudo systemctl enable systemd-time-wait-sync).  I shut down my Pi and turned off my network, waited a few minutes, booted the Pi without the network, waited another couple of minutes, then turned on the network.  The log shows Weewx did not start until the time was updated to the correct time.  Partial log attached.

One new message I haven't seen before:
Feb  7 07:56:27 raspberrypi2 systemd[1]: weewx.service: Supervising process 598 which is not our child. We'll most likely not notice when it exits.

I am on Raspbian GNU/Linux 10 (buster).  Weewx is about the only real work my Pi does.  I guess there is a question about holding up other processes too when you enable time-wait-sync.

I did omit the Requires=time-sync.target command in the service file based on the comment in the Stackexchange link ("...use After= but don't "Pull it in".).

Walt
Log Feb 07.txt
Message has been deleted
Message has been deleted

Pline Pa

unread,
Feb 9, 2021, 11:21:23 AM2/9/21
to weewx...@googlegroups.com
Thanks for your Feedback!
I will try this method with systemd in near future.
Greetings 
Plinepa

kilo...@gmail.com

unread,
Feb 9, 2021, 7:04:14 PM2/9/21
to weewx-user
Like WFS... I also created a systemd service so that I could add the  Requires=time-sync.target, which worked to delay the start but then caused problems during upgrading of weewx with apt.  So I figured out how to do this with the default init.d script.

1.  $sudo systemctl enable systemd-time-wait-sync
2.  Add time-sync.target to your default /etc/init.d/weewx script like I show below.

### BEGIN INIT INFO
# Provides:          weewx
# Required-Start:    $local_fs $remote_fs $syslog systemd-time-wait-sync

3.   $sudo systemctl daemon-reload

Works exactly like you want and no problems during upgrade.  
Reply all
Reply to author
Forward
0 new messages