Page 1 of 2

NTP

PostPosted: Tue Aug 09, 2022 9:01 pm
by nlatl
Hi, I am running version 17-0. Since possibly a week (or longer?) the device restarts with date 01.01.2018. Time sync is active. When I deactivate/activate the NTP sync manually in installation, the date will sync ok. How can I fix it.
Thank you and greetings.
Norbert

Re: NTP

PostPosted: Tue Aug 09, 2022 9:30 pm
by nlatl
Just found:
dmesg|grep clock
sched_clock: 32 bits at 133MHz, resolution 7ns, wraps every 32212ms
Switching to clocksource orion_clocksource
rtc-ds1307 0-0068: hctosys: unable to read the hardware clock

dmesg|grep rtc
rtc-ds1307 0-0068: SET TIME!
rtc-ds1307 0-0068: rtc core: registered ds1338 as rtc0
rtc-ds1307 0-0068: 56 bytes nvram
rtc-ds1307 0-0068: hctosys: unable to read the hardware clock

Re: NTP

PostPosted: Tue Aug 09, 2022 9:53 pm
by fvdw
probably the capacitor or battery enabling the device to keep time is broken. To solve it they need to be replaced
I do not use the spd8020 anymore so I am sorry but I cannot help you with it how to do it.
I suggest you set time after boot manually as you described. You could add a post boot script to perform deactivating/activating time after reboot

Re: NTP

PostPosted: Tue Aug 09, 2022 11:02 pm
by nlatl
Thank you for your quick answer. I found another workaround. I activated the NTP-Server of the device. That seems to force a lookup on a "real" NTP-server. It works for now.
Regards Norbert

Re: NTP

PostPosted: Wed Aug 10, 2022 7:17 am
by Jocko
Hi

As a spd has tiny memory, it would be better to stop ntp server after booting (as fvdw's suggestion). So set a cron job at booting using this command
Code: Select all
killall ntpd
(Please to note a cron booting job does not start the cron server, so no impact on the free memory)

Re: NTP

PostPosted: Wed Aug 10, 2022 10:16 am
by nlatl
Hi. Thank you. I have a cron-boot folder on fvdw. But I am not very confident about creating a boot job. I do not completely understand the information on the help page. I can submit the command in the command line (Remmina).

Re: NTP

PostPosted: Wed Aug 10, 2022 12:49 pm
by Jocko
nlatl wrote:I have a cron-boot folder on fvdw.
So I assume you use the button "Set up Boot jobs" and now you just have to create a new file (for example kill-ntp.sh) with this content
Code: Select all
#!/bin/sh
killall ntpd

Enable the option "Boot jobs" (or reload the menu if it is already enabled) and then your file should be listed in the boot job table. Here select the related line (check its box "at the next booting") and save "the boot jobs table".

After setting it, than means at each nas booting, the firmware will abort the ntpd service when the booting is complete (and nothing else)

Note: maybe ntpd won't yet succeed to update the time when booting is complete. In this case you have to add a sleep line like this
Code: Select all
#!/bin/sh
sleep 120
killall ntpd
(it waits 2 minutes before aborting ntpd service)

Re: NTP

PostPosted: Wed Aug 10, 2022 12:50 pm
by fvdw
@jocko I think after creating the file it must be set to have executable rights? Or is this done by web interface

Re: NTP

PostPosted: Wed Aug 10, 2022 1:01 pm
by Jocko
Indeed this is done by the firmware. So no need the user set run permissions on its boot script files

Re: NTP

PostPosted: Wed Aug 10, 2022 7:47 pm
by nlatl
Hi, thank you so much. It works!
I do not need the delay of 120. I thought the webinterface is slow but the cron jobs are even slower ;) .

At first there was 2018 again. No cron protocol
But after a minute it changed to 2022.
cron protocol now: "crond: time disparity of 2422583 minutes detected."

Best regards
Norbert

By the way I am using the SPD8020 at least since 2008 still with the first harddisk. I remember I helped to correct an error in one of your early releases (2009?).