Debian10 NTPD conflict with systemd-timesyncd

Hi NTP Community, this is my first post. I’m a NTP server operator for quite some time now. Running Ubuntu, haven’t needed to join the forum before today.

I’m trying to add a Debian10 server to the pool but i’m having a problem setting up ntp.

There seems to be a conflict between ntpd and systemd-timesyncd.

Here’s some lines, do you have an idea how I could fix this?

# systemctl status ntp.service
● ntp.service - Network Time Service
   Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enab
   Active: active (running) since Tue 2020-01-21 15:59:12 EST; 1min 43s ago
     Docs: man:ntpd(8)
  Process: 3147 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exited, status=
 Main PID: 3153 (ntpd)
    Tasks: 2 (limit: 4671)
   Memory: 1.6M
   CGroup: /system.slice/ntp.service
           └─3153 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /run/ntp.conf.dhcp -

Jan 21 15:59:12  ntpd[3153]: Listen and drop on 0 v6wildcard [::]:123
Jan 21 15:59:12  ntpd[3153]: Listen and drop on 1 v4wildcard 0.0.0.0:
Jan 21 15:59:12  ntpd[3153]: Listen normally on 2 lo 127.0.0.1:123
Jan 21 15:59:12  ntpd[3153]: Listen normally on 3 ens2 10.68.182.15:1
Jan 21 15:59:12  ntpd[3153]: Listen normally on 4 lo [::1]:123
Jan 21 15:59:12  ntpd[3153]: Listen normally on 5 ens2 [2001:bc8:608:
Jan 21 15:59:12  ntpd[3153]: Listen normally on 6 ens2 [fe80::dc1c:94
Jan 21 15:59:12  ntpd[3153]: Listening on routing socket on fd #23 fo
Jan 21 15:59:12  ntpd[3153]: kernel reports TIME_ERROR: 0x2041: Clock
Jan 21 15:59:12  ntpd[3153]: kernel reports TIME_ERROR: 0x2041: Clock
# systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; disabled; vend
  Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: inactive (dead) since Tue 2020-01-21 15:56:03 EST; 13min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 1755 (code=exited, status=0/SUCCESS)
   Status: "Shutting down..."

Jan 21 13:49:28  systemd[1]: Starting Network Time Synchronization...
Jan 21 13:49:28  systemd[1]: Started Network Time Synchronization.
Jan 21 13:49:28 systemd-timesyncd[1755]: Synchronized to time server
Jan 21 15:56:03  systemd[1]: Stopping Network Time Synchronization...
Jan 21 15:56:03  systemd[1]: systemd-timesyncd.service: Succeeded.
Jan 21 15:56:03  systemd[1]: Stopped Network Time Synchronization.
lines 1-15/15 (END)

---
# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.1.94.8       172.16.34.5      5 u   58   64  377    0.496   -0.248   2.158
 10.1.94.9       .INIT.          16 u    -  256    0    0.000    0.000   0.000
#  systemctl show -p After,Before,Wants,WantedBy,Requres,RequiredBy,Conflicts,ConflictedBy ntp.service systemd-timesyncd.service
Wants=
RequiredBy=
WantedBy=multi-user.target
Conflicts=shutdown.target systemd-timesyncd.service
ConflictedBy=
Before=multi-user.target shutdown.target
After=sysinit.target network.target system.slice systemd-journald.socket basic.t

Wants=time-sync.target
RequiredBy=
WantedBy=
Conflicts=shutdown.target
ConflictedBy=ntp.service
Before=sysinit.target time-sync.target shutdown.target
After=systemd-journald.socket systemd-tmpfiles-setup.service systemd-remount-fs.
#  ps aux | grep "time\|ntp"
ntp       3153  1.1  0.1  77052  4292 ?        Ssl  15:59   0:09 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /run/ntp.conf.dhcp -u 107:113
root      3262  0.0  0.0   6212   884 pts/1    S+   16:12   0:00 grep time\|ntp

Here’s my NTP.conf (/etc/ntp.conf)

root@WWW:~# nano /etc/ntp.conf
  GNU nano 2.9.3                                                                                                   /etc/ntp.conf

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

driftfile /var/lib/ntp/ntp.drift

# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list

# 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.
server ntp3.torix.ca iburst
server tock.usask.ca iburst
(can't show all five servers address because there's a rule on this forum blocking me at 2 url by post)

# 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 127.0.0.1
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 192.168.123.0 mask 255.255.255.0 notrust


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

# 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
#broadcastclient

Don’t run “systemd-timesyncd” as it is only a SNTP service…

Debian 10 you also have your choice of running ntpsec or chrony, either of those would probably be more preferable to the standard NTPD package.

2 Likes

Hi littlejason99,
Thank you for your advice.
I just installed ntpsec which is as easy as ntpd to configure and it is now working like a charm.
Best regards,
MaximeF

1 Like

systemd-timesyncd does not run if you have another NTP daemon installed (see systemctl cat systemd-timesyncd), so there is no conflict there.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.