Yet another Wrong Date & Time issue

I’m running HA version: 2023.3.4 on a raspberrypi3-64 and, following an update this afternoon, the RPI time is now 6hr 21mins behind the current time. RPI Timezone is London +0.00 GMT.
This is the 2nd time this has happened following an update ( suspect there are issues with the update process). The 1st time I resolved it by reinstalling HA and I do not wish to do that again. Has anyone got any ideas on how to resolve it (again).

Background info
I successfully followed the RPI installation from : Raspberry Pi - Home Assistant

Current date&time on Windows Laptop - 14 Mar 2023 @ 21:05
Current date&time on RPI - 2023-03-14 14:43:13.827142+00:00
A difference of 6hr 21mins (not a timezone issue as it’s 21 mins out)

HA Template output:
{{now()}} 2023-03-14 14:43:13.827142+00:00
{{utcnow()}} 2023-03-14 14:43:13.827142+00:00

I’ve tried to set the date&time on the RPI Bash shell but get :
[core-ssh ~]$ date -s 21:07
date: can’t set date: Operation not permitted
Tue Mar 14 21:07:00 GMT 2023
[core-ssh ~]$ date
Tue Mar 14 14:45:04 GMT 2023

I’ve also tried to check that NTP is working but the tool datetimectl does not exist.

The default NTP server is available:
[core-ssh ~]$ ping time.cloudflare.com
PING time.cloudflare.com (162.159.200.123): 56 data bytes
64 bytes from 162.159.200.123: seq=0 ttl=56 time=8.661 ms
64 bytes from 162.159.200.123: seq=1 ttl=56 time=18.585 ms
64 bytes from 162.159.200.123: seq=2 ttl=56 time=8.805 ms
64 bytes from 162.159.200.123: seq=3 ttl=56 time=8.423 ms
64 bytes from 162.159.200.123: seq=4 ttl=56 time=8.552 ms

Current Setup
[core-ssh ~]$ ha core info
arch: aarch64
audio_input: null
audio_output: null
boot: true
image: ghcr.io/home-assistant/raspberrypi3-64-homeassistant
ip_address: 172.30.32.1
machine: raspberrypi3-64
port: 8123
ssl: false
update_available: false
version: 2023.3.4
version_latest: 2023.3.4
watchdog: true

[core-ssh ~]$ ha supervisor info
addons:

  • icon: true
    name: ESPHome
    repository: 5c53de3b
    slug: 5c53de3b_esphome
    state: started
    update_available: false
    version: 2023.2.4
    version_latest: 2023.2.4
  • icon: true
    name: Studio Code Server
    repository: a0d7b954
    slug: a0d7b954_vscode
    state: started
    update_available: false
    version: 5.5.3
    version_latest: 5.5.3
  • icon: true
    name: Samba share
    repository: core
    slug: core_samba
    state: started
    update_available: false
    version: 10.0.0
    version_latest: 10.0.0
  • icon: true
    name: deCONZ
    repository: core
    slug: core_deconz
    state: started
    update_available: false
    version: 6.18.0
    version_latest: 6.18.0
  • icon: true
    name: Terminal & SSH
    repository: core
    slug: core_ssh
    state: started
    update_available: false
    version: 9.6.1
    version_latest: 9.6.1
  • icon: true
    name: Samba Backup
    repository: 15d21743
    slug: 15d21743_samba_backup
    state: started
    update_available: false
    version: 5.2.0
    version_latest: 5.2.0
    addons_repositories:
  • name: Local add-ons
    slug: local
  • name: ‘Home Assistant Add-on: Zigbee2MQTT’
    slug: 45df7312
  • name: ESPHome
    slug: 5c53de3b
  • name: Tom’s Home Assistant Add-ons
    slug: 15d21743
  • name: Official add-ons
    slug: core
  • name: Home Assistant Community Add-ons
    slug: a0d7b954
    arch: aarch64
    auto_update: true
    channel: stable
    debug: false
    debug_block: false
    diagnostics: false
    healthy: true
    ip_address: 172.30.32.2
    logging: info
    supported: true
    timezone: Etc/GMT
    update_available: false
    version: 2023.03.1
    version_latest: 2023.03.1
    wait_boot: 5
    [core-ssh ~]$

[core-ssh ~]$ ha os info
board: rpi3-64
boot: A
data_disk: /dev/mmcblk0p8
update_available: false
version: “9.5”
version_latest: “9.5”

[core-ssh ~]$ ha network info
docker:
address: 172.30.32.0/23
dns: 172.30.32.3
gateway: 172.30.32.1
interface: hassio
host_internet: true
interfaces:

  • connected: false
    enabled: false
    interface: eth0
    ipv4:
    address: []
    gateway: null
    method: disabled
    nameservers: []
    ready: false
    ipv6:
    address: []
    gateway: null
    method: disabled
    nameservers: []
    ready: false
    primary: false
    type: ethernet
    vlan: null
    wifi: null
  • connected: true
    enabled: true
    interface: wlan0
    ipv4:
    address:
    • 192.168.1.152/24
      gateway: 192.168.1.1
      method: auto
      nameservers:
    • 192.168.1.68
      ready: true
      ipv6:
      address:
    • fe80::8da8:2bae:XXXX:XXXX/64
      gateway: null
      method: disabled
      nameservers: []
      ready: true
      primary: true
      type: wireless
      vlan: null
      wifi:
      auth: wpa-psk
      mode: infrastructure
      signal: 61
      ssid: BTHub3-XXXX
      supervisor_internet: true

Any help would be appreciated as I do not know where to look next.

1 Like

Have you tried rebooting?

Did you issue a search? Search results for 'date time os' - Home Assistant Community

Chrony add-on will set the system time on boot in HAOS. Just select your favorite NTP server, as well this gives the added bonus of you can. Use this NTP in your router config, and across your network so every device matches time on your network.

1 Like

Further info.
I’ve found the S6-Networking commands show some useful info as follows:

[core-ssh etc]$ s6-sntpclock 162.159.200.123 | s6-clockview
before: 2023-03-15 16:23:52.766213668
after: 2023-03-15 22:46:41.612651891

This highlights the precise issue I am having. The ‘before’ date/time is the current system time, whilst the ‘after’ is the actual time from the time.cloudflare.com NTP server. Why is there a difference? How do I correct this?

If I try to adjust the system time as follows I get an error…

[core-ssh etc]$ s6-sntpclock 162.159.200.123 | s6-clockadd -f
s6-clockadd: warning: time discrepancy bigger than 2000 milliseconds
s6-clockadd: fatal: unable to sysclock_set: Operation not permitted

Can anyone shed any details on why this operation is not permitted?

PS
sudo does not exist

[core-ssh etc]$ sudo
bash: sudo: command not found

Because you are in a container. The ssh add on is just ssh to the HA container, not the system.

You need to enable ssh and upload keys to open port 22222 to ssh as root to get system level access to your host.

Or you could install chrony add-on and make sure set system clock is enabled in the add on, and be done with the issue…

@Deckoz2302 Thank you for your help. After a reboot the time is now correct. :slight_smile:

2 Likes

Hi @kevintedder , can you please mark this topic as solved?
That way it could help others and/or there is not time/energy wasted by still trying to help you.

1 Like