sys clock still set by network with time sync mode disabled

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

sys clock still set by network with time sync mode disabled

Post by Gord_W »

Something is setting the system clock from network time when I boot the rpi3 with dietpi V143 even though setting time should be disabled.

I'm expecting the system time and date to be 1970 something or something random, but it is the true date and time to within a few ms of atomic time. Disabling in Dietpi-config has no effect. :(

I have set Time sync mode : Disabled in dietpi-config > advanced

I have removed fake-hwclock and removed hwclock.sh links from rc0.d, rc6.d and rcS.d

I think that it is something in the bowels of systemd in dbus-org.freedesktop.timedate1.service that is syncing the time with network time.

I have installed a rtc ds3231 and want to have the system time set from that *only* regardless of whether there is an internet connection. And I don't want the system clock to be written to the hwclock behind my back! In the rc.local script I will have a line hwclock -s to set the syst clock from the hwclock.

I need to sync the rpi with other timing equipment and therefore don't want it to sync with network time across boots.

What is the best way to stop the rpi from syncing with network time?

Thanks,
Gordon Williams
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: sys clock still set by network with time sync mode disab

Post by Gord_W »

Some further information:

I see the time being changed (twice!) on boot (rtc ds3231 not installed) by ntpdate (I have that installed, but I haven't asked it to set the time for me as far as I know.)

root@FinCam:~# journalctl

-- Logs begin at Wed 1969-12-31 19:00:02 EST, end at Mon 2017-02-20 17:23:37 EST. --
Dec 31 19:00:02 FinCam systemd-journal[114]: Runtime journal is using 6.0M (max allowed 48.6M, trying to leave 72.9M free of 480.3M available → current limit 48.6M).
Dec 31 19:00:02 FinCam systemd-journal[114]: Runtime journal is using 6.0M (max allowed 48.6M, trying to leave 72.9M free of 480.3M available → current limit 48.6M).
Dec 31 19:00:02 FinCam kernel: Booting Linux on physical CPU 0x0
Dec 31 19:00:02 FinCam kernel: Initializing cgroup subsys cpuset
...
Dec 31 19:00:07 FinCam netdata[854]: 1969-12-31 19:00:07: netdata: INFO: Listen socket [0.0.0.0]:19999 opened.
Dec 31 19:00:08 FinCam apps.plugin[902]: started on pid 902
Dec 31 19:00:09 FinCam dropbear[771]: Password auth succeeded for 'root' from 192.168.1.19:36095
Dec 31 19:00:10 FinCam kernel: ip_tables: (C) 2000-2006 Netfilter Core Team
Dec 31 19:00:10 FinCam kernel: nf_conntrack version 0.5.0 (15569 buckets, 62276 max)
Dec 31 19:00:15 FinCam systemd[1]: Got automount request for /proc/sys/fs/binfmt_misc, triggered by 874 (netdata)
Dec 31 19:00:15 FinCam systemd[1]: Mounting Arbitrary Executable File Formats File System...
Dec 31 19:00:15 FinCam systemd[1]: Mounted Arbitrary Executable File Formats File System.
Feb 20 17:23:23 FinCam systemd[1]: Time has been changed <<<< systemd gets notified
Feb 20 17:23:23 FinCam ntpdate[502]: step time server 192.99.2.8 offset 1487629387.491478 sec <<<< first time set by something
Feb 20 17:23:25 FinCam apps.plugin[1745]: started on pid 1745
Feb 20 17:23:37 FinCam ntpdate[1747]: adjust time server 132.246.11.238 offset -0.001696 sec <<<<<< second time set by something
...

so I wonder where this occurs.
Gordon
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: sys clock still set by network with time sync mode disab

Post by Gord_W »

For manual system and hwclock operation, this is what I did to get the system clock from being updated from network time and the hwclock from being reset behind my back from system time.

Seems like things need to be tweeked all over the place as there is both legacy and systemd stuff causing problems.
From my notes:
Use this to get rid of hwclock.sh in /etc/rc0.d ... rc6.d
update-rc.d -n hwclock.sh remove

in /etc/rcS.d remove link to hwclock.sh

Things in Systemd that need to be addressed
/etc/systemd/system/reboot.target.wants/hwclock-save.service << for writing hwclock
/etc/systemd/system/poweroff.target.wants/hwclock-save.service << for writing hwclock
/etc/systemd/system/halt.target.wants/hwclock-save.service << for writing hwclock

/etc/network/if-up.d/ntpdate << runs ntpdate on interface startup


root@FinCam:~# systemctl list-unit-files | grep clock
hwclock-save.service enabled <<< this sets the hwclock need to mask
hwclock.service masked
hwclockfirst.service masked
root@FinCam:~# systemctl list-unit-files | grep time
dbus-org.freedesktop.timedate1.service static <<< interface to some timezone,settime,ntp things
systemd-timedated.service static <<< mechanism to change the system clock and timezone, as well as to enable/disable NTP time synchronization
systemd-timesyncd.service disabled <<< synchronize the local system clock with a remote Network Time Protocol server.

root@FinCam:~# systemctl mask hwclock-save.service
root@FinCam:~# systemctl mask dbus-org.freedesktop.timedate1.service
root@FinCam:~# systemctl mask systemd-timedated.service
root@FinCam:~# systemctl mask systemd-timesyncd.service

Regards,
Gordon Williams
Post Reply