[RPi4] How to Fix Wrong Time

  • Don't know if it's possible to unset thread resolved?

    It turns out whenever the Raspberry is shut down, the clock will stop. Regardless of the time of shutdown, at boot the time is set to 18:26.

    I don't have wired network, it runs on wifi, and on each boot I have to go Settings > LibreELEC > Connections > MyNetwork > Connect to get internet and correct time.

    So,

    1. Is it possible to set system time manually?

    2. How do I get automatic connection to wifi at boot?

    In Settings > LibreELEC > Network > Wireless networks is set to active while Wired networks is set inactive.

    Thankful for any input!

  • RPi boards have no real-time clock (RTC) chip so on boot the kernel log will start from the date/time of the libc release that's being used (one of the more obtuse kernel oddities). Then once the network is up, NTP (assuming it succeeds) will update the system clock to current time .. until the next reboot (rinse/repeat). You can set the time manually from the SSH console using the "date" command. NB: It's cheap and simple to add an RTC chip to an RPi board.

    No idea why the network is not connecting automatically. It normally only happens with cheap USB dongles where the MAC changes on each boot: the Connection Manager (ConnMan) keys connections against the MAC so if this keeps changing, on each boot there's no stored connection and you need to enter the passcode again. That doesn't sound exactly like what you're seeing though?

  • NB: It's cheap and simple to add an RTC chip to an RPi board.

    Thank you for this suggestion!

    That doesn't sound exactly like what you're seeing though?

    You're right. It connects to my wifi, but for some reason just doesn't update the time. Interestingly, I tried running Ultramarine Linux on the Pi, getting the exact same problem: connecting just fine to the network, but failing to update the time until I force it to. Looks like it's a hardware problem and not a problem with LibreElec, then. I didn't try cabled network, though.

    So I'm going to order an rtc chip and cross my fingers.

  • Normal behavior of ntpd is to ignore time servers which are more than 1000 seconds away from the current time, maybe this has some influence in your situation.

  • It doesn't explain it because in LE the NTP request comes from ConnMan not "ntpd" and there is no issue with the boot date/time starting in May and then being corrected to current time; unless the configured NTP server(s) fail to respond. Unless you explicitly define servers for a ConnMan service, it will use ntp.org servers. Some ISPs and network routers block requests to ntp.org (no idea why, but it does happen) and some routers will set themselves as the time source via DHCP. If you look at the systemd journal it will show requests being made, where they were made, and what the outcome was.