See updates below.
I’m hoping I can get some assistance working through an issue I’ve been having on my Ubuntu server. I’m running the desktop version of 16.04 as a server and occasionally I have noticed that the system time gets out of sync/stops updating. Typically this precedes total loss of remote access and requires a restart to fix. Here is the output of systemctl status systemd-timesyncd.service:
systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled Drop-In: /lib/systemd/system/systemd-timesyncd.service.d └─disable-with-time-daemon.conf Active: active (running) since Fri 2018-10-19 00:17:02 PDT; 2 days ago Docs: man:systemd-timesyncd.service(8) Main PID: 642 (systemd-timesyn) Status: "Synchronized to time server 18.104.22.168:123 (ntp.ubuntu.com)." CGroup: /system.slice/systemd-timesyncd.service └─642 /lib/systemd/systemd-timesyncd Oct 19 00:17:02 eric-SFF systemd: Starting Network Time Synchronization... Oct 19 00:17:02 eric-SFF systemd: Started Network Time Synchronization. Oct 19 00:37:24 eric-SFF systemd-timesyncd: Synchronized to time server 22.214.171.124:123 (ntp Oct 19 10:19:00 eric-SFF systemd-timesyncd: Timed out waiting for reply from 126.96.36.199:123 Oct 19 10:19:00 eric-SFF systemd-timesyncd: Synchronized to time server 188.8.131.52:123 (n
And here is the output of timedatectl:
~$ timedatectl Failed to query server: Connection timed out
The system time at this point was off by about 12 hours (reporting time of yesterday ~ 7pm when it is actually ~ 11am the following day). Time zone is correct.
I have also noticed that my cron jobs stop running when this happens, as I have a cron job that checks internet connection on regular intervals and reports its output to a log file. This log file stops updating around the same time that the time gets out of sync. I also have a cron job that backs up certain directories, and these backups are not up-to-date.
Please let me know if any additional information would be helpful. I’m still a relative novice to Ubuntu.
@Damocles Thanks for your suggestion. Yes, the computer has a working network connection. I did not have any firewall rules set to allow NTP (port 123) through UFW or my firewall on my Ubiquiti router. However, it would still work for a while (sometimes weeks at a time) before bugging out. Could this still be a firewall issue?
I went ahead and added the ufw rule and added a firewall exception and NAT translation in my router and rebooted the server. It syncs for now, but my firewall did not seem to be in the way because the traffic count for that rule did not increase.
Is there anything else that could be blocking this connection? Perhaps something that would allow it to work at first, but cause a dropped/blocked NTP access down the line?
I also found this command to check time sync status, but it returns and unknown operation error:
:~$ timedatectl timesync-status Unknown operation timesync-status
New Update 11/1/18
I installed chrony as suggested, but still getting the same issue, within 24 hours. Something is definitely wrong. And ~16 hours after a fresh boot and chrony installed, here is the output of some chrony commands:
:~$ chronyc sources 210 Number of sources = 11 MS Name/IP address Stratum Poll Reach LastRx Last sample =========================================================================== ^? up2.com 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? 216-228-47-167.midrivers. 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? blue.1e400.net 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? 184.108.40.206 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? lithium.constant.com 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? clock.xmission.com 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? ha81.smatwebdesign.com 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? srcf-ntp.stanford.edu 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? time1.plumdev.net 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? SunSITE.icm.edu.pl 0 6 377 10y +0ns[ +0ns] +/- 0ns ^? time.no-such-agency.net 0 6 377 10y +0ns[ +0ns] +/- 0ns :~$ chronyc sourcestats 210 Number of sources = 11 Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev ============================================================================ up2.com 0 0 0 +0.000 2000.000 +0ns 4000ms 216-228-47-167.midrivers. 0 0 0 +0.000 2000.000 +0ns 4000ms blue.1e400.net 0 0 0 +0.000 2000.000 +0ns 4000ms 220.127.116.11 0 0 0 +0.000 2000.000 +0ns 4000ms lithium.constant.com 0 0 0 +0.000 2000.000 +0ns 4000ms clock.xmission.com 0 0 0 +0.000 2000.000 +0ns 4000ms ha81.smatwebdesign.com 0 0 0 +0.000 2000.000 +0ns 4000ms srcf-ntp.stanford.edu 0 0 0 +0.000 2000.000 +0ns 4000ms time1.plumdev.net 0 0 0 +0.000 2000.000 +0ns 4000ms SunSITE.icm.edu.pl 0 0 0 +0.000 2000.000 +0ns 4000ms time.no-such-agency.net 0 0 0 +0.000 2000.000 +0ns 4000ms
I believe the “Reach” being nonzero means it’s getting past the firewall, so I don’t think that’s the issue. Also, these commands returned normal output at first.
I'm assuming you have an active network connection that works. The logs of timedatectl state it is unable to connect to the default ubuntu timeserver at 18.104.22.168:123 and is timing out. This is most likely a firewall issue on your end, the first thing to do would to check if NTP is allowed through on Port 123 by UFW, Ubuntu's firewall.
sudo ufw allow ntp
This will allow traffic out and in on port 123, if you are still getting timeouts from the server after this I would suggest disabling UFW temporarily for testing, using the command.
sudo Ufw disable
Then check the status and see if it is still timing out. Make sure to re-enable the ufw after this test.
If this fails, it is likely that your traffic is being blocked upstream by a router on your network. If you have access to this, consult the documentation on how to whitelist ports or ask your system admistrator too. It's not unheard of for networks to block all NTP traffic out/in except to a dedicated internal NTP server.
Answered by Damocles on December 15, 2020
2 Asked on December 21, 2020 by gianluca-micchi
1 Asked on December 20, 2020 by alex-kh
1 Asked on December 20, 2020 by pablo-bianchi
1 Asked on December 20, 2020 by user209405
2 Asked on December 19, 2020 by flipjacob
0 Asked on December 19, 2020 by nicholas-saunders
0 Asked on December 18, 2020
1 Asked on December 18, 2020 by pa-gw
0 Asked on December 18, 2020 by divinew99
4 Asked on December 17, 2020 by flimm
0 Asked on December 17, 2020 by chaitrali-palasdeokar
0 Asked on December 17, 2020 by sam-klein
0 Asked on December 17, 2020 by iampython
1 Asked on December 17, 2020 by jeff-wilkerson
Get help from others!