From f99d5f5f99f88c8a482b7a05455a89fbe27a8834 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Thu, 17 Aug 2023 23:46:39 +0200 Subject: [PATCH] let ntpd fork and work in the background, and also retry regularly i have witnessed a situation where opkg update didn't work due to "Connection error: Invalid SSL certificate", which was in turn due to wrong time on the router. hopefully this will fix this situation for good. --- image-extras/common/root/autoprovision-stage2.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/image-extras/common/root/autoprovision-stage2.sh b/image-extras/common/root/autoprovision-stage2.sh index 95f52db..dc1062b 100755 --- a/image-extras/common/root/autoprovision-stage2.sh +++ b/image-extras/common/root/autoprovision-stage2.sh @@ -12,6 +12,8 @@ installPackages() do log "opkg update failed. No internet connection? Retrying in 15 seconds..." sleep 15 + # Initiate a synchronous time update. + ntpd -d -q -n -p openwrt.pool.ntp.org done signalAutoprovisionWorking @@ -50,8 +52,9 @@ autoprovisionStage2() else signalAutoprovisionWorking - echo Updating system time using ntp; otherwise the openwrt.org certificates are rejected as not yet valid. - ntpd -d -q -n -p 0.openwrt.pool.ntp.org + log "Starting ntpd to update system time; otherwise the openwrt.org certificates are rejected as not yet valid." + # Added -l hoping that it may help against ntpd quitting. + ntpd -l -N -p openwrt.pool.ntp.org # CUSTOMIZE: with an empty argument it will set a random password and only ssh key based login will work. # please note that stage2 requires internet connection to install packages and you most probably want to log in