Behavior when importing data from an old emonSD

Dear community,

I know that the old account/profile as well as the database are imported from the “Import from USB drive”, but what about previous configuration?

I recently updated my EmonPi with the 20Nov23 image. I followed the process to import data from the old SD card, everything went smoothly.

=== Emoncms import complete! ===

However, all my feeds were 11min late compared to the real time.
When checking the following commands, I notice that the pi was indeed 11 min late:

pi@emonpi:~ $ date
Tue 29 Oct 09:49:12 GMT 2024
pi@emonpi:~ $ timedatectl status
               Local time: Tue 2024-10-29 09:49:03 GMT
           Universal time: Tue 2024-10-29 09:49:03 UTC
                 RTC time: n/a
                Time zone: Europe/London (GMT, +0000)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no
pi@emonpi:~ $ timedatectl
               Local time: Tue 2024-10-29 09:49:10 GMT
           Universal time: Tue 2024-10-29 09:49:10 UTC
                 RTC time: n/a
                Time zone: Europe/London (GMT, +0000)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

And most importantly, that the synchronization was not active.

I tried to stop and start timesyncd

pi@emonpi:~ $ sudo systemctl disable --now systemd-timesyncd
Removed /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service.
Removed /etc/systemd/system/dbus-org.freedesktop.timesync1.service.


pi@emonpi:~ $ sudo systemctl enable --now systemd-timesyncd
Created symlink /etc/systemd/system/dbus-org.freedesktop.timesync1.service → /lib/systemd/system/systemd-timesyncd.service.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service → /lib/systemd/system/systemd-timesyncd.service.

But it did not solve the issue. I tried to reset the timezone of the pi through

sudo raspi-config

But still no synchronization.

Try to update the FallBack NTP via

sudo nano /etc/systemd/timesyncd.conf

Still no luck. In my case, the only way to have synchronization is to change DNS information in /etc/resolv-conf/ and restarting timesyncd.

pi@emonpi:~ $ sudo systemctl disable --now systemd-timesyncd
Removed /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service.
Removed /etc/systemd/system/dbus-org.freedesktop.timesync1.service.
pi@emonpi:~ $ sudo systemctl enable --now systemd-timesyncd
Created symlink /etc/systemd/system/dbus-org.freedesktop.timesync1.service → /lib/systemd/system/systemd-timesyncd.service.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service → /lib/systemd/system/systemd-timesyncd.service.
pi@emonpi:~ $ timedatectl status
               Local time: Tue 2024-10-29 10:03:04 GMT
           Universal time: Tue 2024-10-29 10:03:04 UTC
                 RTC time: n/a
                Time zone: Europe/London (GMT, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Therefore, just to confirm for future import, “Import from USB drive” will only load database and user information, right? Any configuration or modification needs to be restored by users (with which I have no problem, just want to confirm).

Yes this is correct:

Only the following items are copied over:

  • SQL emoncms database
  • PHPFina and PHPTimeSeries data files
  • emonhub.conf
1 Like

@TrystanLea Thank you for the confirmation !

The issue is that, if the time is too far out, the timesyncd unit will not resync (by design).

You need to stop the unit, manually set the time so it is close to correct and then restart it.

timesyncd will then sync correctly.

Force systemd timesyncd to sync time with NTP server immediately - Server Fault

One of the comments on the posts above suggests

sudo timedatectl set-ntp false; sudo timedatectl set-ntp true

will fix it. @TrystanLea, perhaps it might help adding this to the import script and possibly also check time is being synced correctly before importing?

A simple, this machine thinks the time is XX - is this correct? - type question. Might also solve/prompt locale issues to be fixed before import.

1 Like

@borpin Thank you for these additional information.

sudo timedatectl set-ntp false; sudo timedatectl set-ntp true

I will test it and report the results later on.

2 Likes

I’ve added this as a github issue Check time sync · Issue #77 · emoncms/backup · GitHub.