balena-io-modules / device-diagnostics

on-device diagnostics tool
9 stars 8 forks source link

Fix timedate error handling and error message #296

Open rmorillo24 opened 2 years ago

rmorillo24 commented 2 years ago

Observed behavior The device's diagnostics page is showing the following error message:

Error!An error occurred while querying checks data: main: line 125: 69 69: syntax error in expression (error token is "69") Failed to query server: Failed to activate service 'org.freedesktop.timedate1': timed out (service_start_timeout=25000ms)

The device in which it's happening is having some issues at that moment (apparently HW failure or SD card corruption), and it has shown the following error in the console:

root@8a6c0d3:~# timedatectl
Failed to query server: Failed to activate service 'org.freedesktop.timedate1': timed out (service_start_timeout=25000ms)

The check_timesync diagnostic is correctly showing a Failed check and a Time is not being synchronized via NTP message. however, since the problem appears to be a wrong error handling, it could not be accurate in other situations.

Expected behavior The dashboard should show a message that the diagnostic failed, and optionally the reason for the failure if it can be captured. In this case, it could check if the service is running before trying to use timedatectl.