Fresh Installation of Home Assistant OS on RPI4 fails due to time sync problem

I’ve flashed HA OS to SD and successfully booted apart from a [Wait until Kernel Time Synchronized Error] which times out after 90 seconds. But the boot proceeds and the CLI is presented. This RPI has a LAN cable connection to the network.

Accessing http://homeassistant.local:8123/ from another PC on the network gets stuck on “preparing”, seemingly due to this error. Here are some extracts from that log. HA OS think it’s in March (it’s June), and SSL fails because it’s before the validity date on the certificate:

22-03-11 09:35:32 WARNING (MainThread) [supervisor.utils.codenotary] rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: x509: certificate has expired or is not yet valid: current time 2022-03-11T07:35:31Z is before 2022-05-30T08:23:09Z"

This is followed a few lines down with:

22-03-11 09:35:34 ERROR (MainThread) [supervisor.store.git] Can't clone https://github.com/home-assistant/addons repository: Cmd('git') failed due to: exit code(128)
  cmdline: git clone -v --recursive --depth=1 --shallow-submodules https://github.com/home-assistant/addons /data/addons/core
  stderr: 'Cloning into '/data/addons/core'...
fatal: unable to access 'https://github.com/home-assistant/addons/': SSL certificate problem: certificate is not yet valid

Ultimately, the preparing process ends up in an infinite loop:

22-03-11 09:35:55 ERROR (SyncWorker_2) [supervisor.docker.interface] Can't install ghcr.io/home-assistant/raspberrypi4-homeassistant:2022.6.1: 404 Client Error for http+docker://localhost/v1.41/images/ghcr.io/home-assistant/raspberrypi4-homeassistant:2022.6.1/json: Not Found ("no such image: ghcr.io/home-assistant/raspberrypi4-homeassistant:2022.6.1: No such image: ghcr.io/home-assistant/raspberrypi4-homeassistant:2022.6.1")
22-03-11 09:35:55 WARNING (MainThread) [supervisor.homeassistant.core] Error on Home Assistant installation. Retry in 30sec

Any ideas as to how to get HA to sync time correctly on boot?

This is using the current 8.1 images. It’s the same for 64 and 32 bit versions of the OS.

Would you have rules on your LAN preventing the RPI to access an internet NTP server (UDP/123)?

Thanks for the suggestion, but no, devices on the LAN have unrestricted access to the internet. If I put a newly flashed Raspbian SD in the same Pi, it sets the time correctly on boot. I did this thinking that maybe the March 22 date might be stored somewhere in the Pi’s NVRAM (the date corresponds to roughly when last that Pi was operational with Raspbian), and hoping that an orderly Raspbian shutdown might update it. Alas, after booting Raspbian and then HA OS, it’s still stuck on the date in March… :face_with_raised_eyebrow: