Article 512KB RPi4 (Sarpi) - rc.local ntpdate "hack" fails to update date/time

RPi4 (Sarpi) - rc.local ntpdate "hack" fails to update date/time

by
eduardr
from LinuxQuestions.org on (#512KB)
Currently am without an RTC module (waiting to receive a RasClock RTC module), so my new RPi4 Sarpi setup is using the ntpdate "hack" which runs ntpdate via rc.local.

I noticed that the date/time does not get set after boot (stays at default 1969 value), but there was no message or warning. So I changed the line in /etc/rc.d/rc.local -

from:

Code:ntpdate 0.pool.ntp.org > /dev/null 2>&1to:

Code:ntpdate 0.pool.ntp.orgIn order to see whatever warnings/errors are generated.

I see this when I boot:

Code:Exiting, name server cannot be used: Temporary failure in name resolution (-3) 3 ...But when I run rc.local manually after boot, then it updates the time properly.

My system is set to use Network Manager to configure networking, using the WiFi connection via DHCP/auto. After boot, /etc/resolv.conf contains the expected entries, and name resolution works fine.

Blind guess as to what might be going on:
* Maybe the WiFi connection bring-up/DHCP is still in progress when rc.local runs during boot, and the name servers are not yet configured in /etc/resolv.conf

In case this possibility might bite others, maybe would make sense to remove the > /dev/null 2>&1 piece from rc.local in sarpi hacks? This way at least if the ntpdate fails the user would get to see the error.

Once I receive my RTC module I will avoid having to figure out what's really going on. :)latest?d=yIl2AUoC8zA latest?i=TWq-CqY0DVo:LwNQ-slAriU:F7zBnMy latest?i=TWq-CqY0DVo:LwNQ-slAriU:V_sGLiP latest?d=qj6IDK7rITs latest?i=TWq-CqY0DVo:LwNQ-slAriU:gIN9vFwTWq-CqY0DVo
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments