ntpd does not restart after failing to start upon boot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ntp (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
For some reason ntpd failed to start upon boot on my machine:
Jun 16 16:35:56 dokku-ovh1-003 ntpd[1242]: Listening on routing socket on fd #23 for interface updates
Jun 16 16:35:57 dokku-ovh1-003 ntpd[1242]: Soliciting pool server 212.83.160.142
Jun 16 16:35:58 dokku-ovh1-003 ntpd[1242]: Soliciting pool server 5.196.192.58
Jun 16 16:35:58 dokku-ovh1-003 ntpd[1242]: Soliciting pool server 178.33.111.47
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: Soliciting pool server 149.202.200.140
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: Soliciting pool server 91.121.167.54
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: Soliciting pool server 2001:4b98:
Jun 16 16:35:59 dokku-ovh1-003 ntp[1310]: * Stopping NTP server ntpd
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: ntpd exiting on signal 15 (Terminated)
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: 212.83.160.142 local addr 188.165.207.172 -> <null>
Jun 16 16:35:59 dokku-ovh1-003 ntp[1310]: ...done.
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: 5.196.192.58 local addr 188.165.207.172 -> <null>
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: 178.33.111.47 local addr 188.165.207.172 -> <null>
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: 91.121.167.54 local addr 188.165.207.172 -> <null>
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: 149.202.200.140 local addr 188.165.207.172 -> <null>
Jun 16 16:35:59 dokku-ovh1-003 ntpd[1242]: 2001:4b98:
Jun 16 16:36:00 dokku-ovh1-003 ntp[1566]: * Starting NTP server ntpd
Jun 16 16:36:00 dokku-ovh1-003 ntpd[1601]: ntpd 4.2.8p4@1.3265-o Wed Apr 5 13:28:07 UTC 2017 (1): Starting
Jun 16 16:36:00 dokku-ovh1-003 ntpd[1601]: Command line: /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 110:118
Jun 16 16:36:00 dokku-ovh1-003 ntp[1566]: ...done.
Jun 16 16:36:00 dokku-ovh1-003 ntpd[1608]: proto: precision = 0.064 usec (-24)
Jun 16 16:36:00 dokku-ovh1-003 ntpd[1608]: unable to bind to wildcard address :: - another process may be running - EXITING
Jun 16 16:36:12 dokku-ovh1-003 ntpdate[1383]: step time server 178.33.227.201 offset -0.000537 sec
but then I have found out that systemd failed to restart it despite being completely aware that there are no running tasks, until I manually did /etc/init.d/ntp stop. There was stale PID file, but removing it didn't helped, until I called /etc/init.d/ntp stop and /etc/init.d/ntp start NTP was dead.
root@dokku-
[ ok ] Starting ntp (via systemctl): ntp.service.
root@dokku-
● ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
Active: active (exited) since Fri 2017-06-16 16:36:00 CEST; 3 weeks 2 days ago
Docs: man:systemd-
Process: 1310 ExecStop=
Process: 1566 ExecStart=
Tasks: 0
Memory: 0B
CPU: 0
Jun 16 16:36:00 dokku-ovh1-003 systemd[1]: Starting LSB: Start NTP daemon...
Jun 16 16:36:00 dokku-ovh1-003 ntp[1566]: * Starting NTP server ntpd
Jun 16 16:36:00 dokku-ovh1-003 ntp[1566]: ...done.
Jun 16 16:36:00 dokku-ovh1-003 systemd[1]: Started LSB: Start NTP daemon.
Jun 16 16:36:00 dokku-ovh1-003 ntpd[1608]: proto: precision = 0.064 usec (-24)
Jun 16 16:36:13 dokku-ovh1-003 systemd[1]: Started LSB: Start NTP daemon.
Jul 10 15:36:16 dokku-ovh1-003 systemd[1]: Started LSB: Start NTP daemon.
Jul 10 15:44:46 dokku-ovh1-003 systemd[1]: Started LSB: Start NTP daemon.
Jul 10 15:57:19 dokku-ovh1-003 systemd[1]: Started LSB: Start NTP daemon.
Jul 10 15:59:00 dokku-ovh1-003 systemd[1]: Started LSB: Start NTP daemon.
root@dokku-
21691 pts/0 S+ 0:00 grep --color=auto ntp
root@dokku-
[ ok ] Stopping ntp (via systemctl): ntp.service.
root@dokku-
[ ok ] Starting ntp (via systemctl): ntp.service.
root@dokku-
● ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
Active: active (running) since Mon 2017-07-10 15:59:16 CEST; 2s ago
Docs: man:systemd-
Process: 21714 ExecStop=
Process: 21822 ExecStart=
Tasks: 2
Memory: 756.0K
CPU: 32ms
CGroup: /system.
└─21836 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 110:118
Jul 10 15:59:16 dokku-ovh1-003 ntpd[21836]: Listen normally on 54 veth8a7f590 [fe80::
Jul 10 15:59:16 dokku-ovh1-003 ntpd[21836]: Listen normally on 55 veth1286611 [fe80::
Jul 10 15:59:16 dokku-ovh1-003 ntpd[21836]: Listen normally on 56 veth4200099 [fe80::
Jul 10 15:59:16 dokku-ovh1-003 ntpd[21836]: Listen normally on 57 veth4d4460f [fe80::
Jul 10 15:59:16 dokku-ovh1-003 ntpd[21836]: Listen normally on 58 vethf4265f8 [fe80::
Jul 10 15:59:16 dokku-ovh1-003 ntpd[21836]: Listen normally on 59 vethb45cd16 [fe80::
Jul 10 15:59:16 dokku-ovh1-003 ntpd[21836]: Listening on routing socket on fd #76 for interface updates
Jul 10 15:59:17 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 149.202.97.123
Jul 10 15:59:18 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 163.172.28.46
Jul 10 15:59:18 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 94.23.0.110
root@dokku-
● ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
Active: active (running) since Mon 2017-07-10 15:59:16 CEST; 4s ago
Docs: man:systemd-
Process: 21714 ExecStop=
Process: 21822 ExecStart=
Tasks: 2
Memory: 764.0K
CPU: 37ms
CGroup: /system.
└─21836 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 110:118
Jul 10 15:59:17 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 149.202.97.123
Jul 10 15:59:18 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 163.172.28.46
Jul 10 15:59:18 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 94.23.0.110
Jul 10 15:59:19 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 37.187.18.4
Jul 10 15:59:19 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 212.83.179.156
Jul 10 15:59:19 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 2001:41d0:
Jul 10 15:59:20 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 2001:bc8:
Jul 10 15:59:20 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 91.121.181.58
Jul 10 15:59:20 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 62.210.244.146
Jul 10 15:59:20 dokku-ovh1-003 ntpd[21836]: Soliciting pool server 212.129.9.36
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: ntp 1:4.2.8p4+
ProcVersionSign
Uname: Linux 4.4.0-59-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.6
Architecture: amd64
Date: Mon Jul 10 16:00:37 2017
InstallationDate: Installed on 2016-01-12 (545 days ago)
InstallationMedia:
KernLog:
[2070085.955078] audit: type=1400 audit(149969380
[2070085.955101] audit: type=1400 audit(149969380
[2071366.354592] audit: type=1400 audit(149969510
[2071366.354606] audit: type=1400 audit(149969510
ProcEnviron:
SHELL=/bin/bash
TERM=xterm-
PATH=(custom, no user)
LANG=en_GB.UTF-8
XDG_RUNTIME_
SourcePackage: ntp
UpgradeStatus: No upgrade log present (probably fresh install)
Thanks for filing this bug in Ubuntu.
The logs you pasted showed ntp failing to run because something else was listening on its socket already.
In xenial, there is a systemd service that also tries to keep the clock accurate, called systemd- timesyncd. service. It has checks, though, to not try to start if ntp is installed:
# systemctl status systemd-timesyncd timesyncd. service - Network Time Synchronization system/ systemd- timesyncd. service; enabled; vendor preset: enabled) system/ systemd- timesyncd. service. d
└─disable- with-time- daemon. conf timesyncd. service( 8)
● systemd-
Loaded: loaded (/lib/systemd/
Drop-In: /lib/systemd/
Active: inactive (dead)
Condition: start condition failed at Ter 2017-07-11 08:55:03 BRT; 7h ago
Docs: man:systemd-
This is what is preventing systemd-timesyncd from running on my system, where I have ntp installed: system/ systemd- timesyncd. service. d/disable- with-time- daemon. conf Executable= !/usr/sbin/ ntpd Executable= !/usr/sbin/ openntpd Executable= !/usr/sbin/ chronyd Executable= !/usr/sbin/ VBoxService
# cat /lib/systemd/
[Unit]
# don't run timesyncd if we have another NTP daemon installed
ConditionFileIs
ConditionFileIs
ConditionFileIs
ConditionFileIs
Do you have that file /lib/systemd/ system/ systemd- timesyncd. service. d/disable- with-time- daemon. conf, and does it have the same content as above?
Can you show the output of "sudo systemctl status systemd- timesyncd. service" ?
Assuming you can reproduce the problem at will, could you please run this command right at the time where ntp has failed to start:
sudo fuser -v 123/udp
Thanks!