Page 1 of 1

NTP not working - sync failure over LAN

Posted: Fri Mar 24, 2017 12:29 pm
by kubanc
I have a problem with Ubuntu Mate and synchronization.
my ntp does not work, even if I did
sudo apt purge ntp*
sudo apt install ntp

after restar I get this error:

Code: Select all

‚óŹ ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since pet 2017-03-24 13:24:13 CET; 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2092 ExecStart=/etc/init.d/ntp start (code=exited, status=5)

mar 24 13:24:13 tnmtv3 systemd[1]: Starting LSB: Start NTP daemon...
mar 24 13:24:13 tnmtv3 systemd[1]: ntp.service: Control process exited, code=exited status=5
mar 24 13:24:13 tnmtv3 systemd[1]: Failed to start LSB: Start NTP daemon.
mar 24 13:24:13 tnmtv3 systemd[1]: ntp.service: Unit entered failed state.
mar 24 13:24:13 tnmtv3 systemd[1]: ntp.service: Failed with result 'exit-cod
This is my /etc/ntp.conf, where X.X.X.X is my NTP server (in this case Sophos UTM). Calling NTP server from Windwos OS works fine.

Code: Select all

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See for
# more information.
#pool iburst
#pool iburst
#pool iburst
#pool iburst
pool X.X.X.X iburst

# Use Ubuntu's ntp server as a fallback.

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <>
# might also be helpful.
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict ::1
# Needed for adding pool entries
restrict source notrap nomodify noquery

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict mask notrust

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth

#Changes recquired to use pps synchonisation as explained in documentation:

#server mode 135 prefer    # Meinberg GPS167 with PPS
#fudge time1 0.0042        # relative to PPS for my hardware

#server                   # ATOM(PPS)
#fudge flag3 1            # enable PPS API
Raspberry PI will not be connected to the Internet, so It cannot update time from other servers besides the one's that are on LAN.
Nevertheless, If I put it to internet it synchronizes time.

Any idea what to do?

Re: NTP not working - sync failure over LAN

Posted: Fri Mar 24, 2017 3:07 pm
by DougieLawson

Code: Select all

server burst iburst maxpoll 11
server burst iburst maxpoll 11
server burst iburst maxpoll 11
server burst iburst maxpoll 11

Code: Select all

with the addresses of your LAN NTP server(s).

Check it's working with ntpq -pn

Code: Select all

     remote           refid      st t when poll reach   delay   offset  jitter
*  ppp.qqq.rrr.sss  3 u   11  512  377    0.832    0.236   0.461
+  sss.rrr.qqq.ppp  3 u  491  512  377    0.927    0.537   0.411

Re: NTP not working - sync failure over LAN

Posted: Fri Nov 09, 2018 11:05 pm
by patricktokeeffe
Please excuse the necro-posting.. I experienced this exact behavior and wanted to offer a solution.

As of Ubuntu 16.04, the ntp service has been replaced by a native systemd service named systemd-timesyncd. On MATE, that service is named prefer-timesyncd and it is running by default.

If you just want an NTP-synced clock, leave things as-is and use timedatectl status to check status:

Code: Select all

[email protected]:~$ timedatectl status
      Local time: Fri 2018-11-09 14:16:52 PST
  Universal time: Fri 2018-11-09 22:16:52 UTC
        RTC time: n/a
       Time zone: America/Los_Angeles (PST, -0800)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no
And if NTP is not synchronized, try issuing sudo timedatectl set-ntp on to turn it on.

For an NTP server (not just client), you will either need to replace timedatectl with ntpd or install chrony (recommended).

Read more here: