Posts: 1
Joined: Fri Mar 24, 2017 10:16 am

NTP not working - sync failure over LAN

Fri Mar 24, 2017 12:29 pm

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 http://www.pool.ntp.org/join.html for
# more information.
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
pool X.X.X.X iburst

# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# 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?

User avatar
Posts: 38815
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: NTP not working - sync failure over LAN

Fri Mar 24, 2017 3:07 pm


Code: Select all

server 0.ubuntu.pool.ntp.org burst iburst maxpoll 11
server 1.ubuntu.pool.ntp.org burst iburst maxpoll 11
server 2.ubuntu.pool.ntp.org burst iburst maxpoll 11
server 3.ubuntu.pool.ntp.org 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
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Posts: 4
Joined: Thu Apr 13, 2017 9:51 pm

Re: NTP not working - sync failure over LAN

Fri Nov 09, 2018 11:05 pm

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

lar@rv-server:~$ 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: https://help.ubuntu.com/lts/serverguide/NTP.html

Return to “Debian”