Fix 'timedatectl fails when RTC has invalid time'

When RTC has invalid time (i.e., after a power loss if no battery is present), timedatectl status fails with the error

$ timedatectl status
Failed to query server: Failed to read RTC: Invalid argument

I see that a fix (i.e., handle this situation gracefully) for this failure should be available in systemctl - see here
Running

systemctl --version

in Torizon OS 6 returns

systemd 250 (250.5+)

and so I think the fix is not available (it has been reported on 254.9 in Github).

Is it possible to have this fixed in Torizon OS 6?
Is this fixed in Torizon OS 7?

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

The issue you’re encountering with timedatectl failing to read the RTC due to an invalid time is indeed linked to the version of systemd in use. As you correctly noted, the fix for this issue is available starting from systemd version 254.9.

Currently, Torizon OS 6 includes systemd version 250, which does not have this fix. For Torizon OS 7, I recommend checking the specific systemd version included in your installation, as it may have been updated to include the fix.

If upgrading to a version of Torizon OS with the necessary systemd version is not immediately feasible, you might consider a temporary workaround. You can create a startup script that sets the RTC to a valid time after a power loss. This script could check the RTC time and set it to a default value if it detects an invalid time.

I hope this helps address your issue. If you have any more questions, feel free to ask.

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

Problem with starting systemd-timedated.

Greetings @vix,

As we build Torizon OS using yocto we use the systemd recipe provided by openembedded-core since systemd is a standard recipe. In Torizon OS 6, we use yocto Kirkstone and the version of this recipe can be seen here (250.5): systemd_250.5.bb « systemd « recipes-core « meta - openembedded-core - OpenEmbedded Core layer

For Torizon OS 7, we use Scarthgap and the version is 255.13: systemd_255.13.bb « systemd « recipes-core « meta - openembedded-core - OpenEmbedded Core layer

Therefore my expectation is that the fix should be available then in 7. We probably won’t change the version on 6 as we would only do so, due to critical/breaking issues. Changing the version of a standard recipe like this would introduce additional maintenance burden as well as other unforeseen issues due to deviating from the standard yocto recipe. Which is why we would only like to do so if absolutely necessary.

Best Regards,
Jeremias

Hi @jeremias.tx

I understand this and I agree.
When I’ll start my Torizon OS 7 test I see what happens and I’ll handle the differences with Torizon OS 6 (if needed).

Good to hear. Glad I was able to help clarify.

Best Regards,
Jeremias