ntpd not started when using ntpdate
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
init-system-helpers (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned | ||
ntp (Ubuntu) |
Won't Fix
|
High
|
Unassigned |
Bug Description
After updating from 14.04 to 16.04 on a number of my systems, ntpd no longer starts at boot on any of those systems.
`systemctl status ntp` shows:
ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-
May 02 19:10:14 host systemd[1]: Stopped LSB: Start NTP daemon.
May 02 19:10:17 host systemd[1]: Stopped LSB: Start NTP daemon.
Manually starting it using `systemctl start ntp` works fine. However, systemd does not seem to want to start it automatically at boot time.
As best as I can tell based on trial and error, there is something special about the combination of the service being named "ntp.service" and the service depending on network.target. However, I haven't been able to identify exactly what is causing this.
If I copy the init script to any other name, everything works fine:
cp /etc/init.d/ntp /etc/init.d/ntpd
Edit /etc/init.d/ntpd and change "Provides: ntp" to "Provides: ntpd"
systemctl enable ntpd
# After a reboot, ntpd.service is started, but ntp.service is not.
If I remove "$network" from the "# Required-Start: $network $remote_fs $syslog" line in /etc/init.d/ntp, then systemd starts it automatically ... But of course it is started before the network comes up, so it fails.
If I replace /etc/init.d/ntp with a file containing only the following, systemd won't try to start it automatically at boot:
#!/bin/sh
### BEGIN INIT INFO
# Provides: ntp
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Start NTP daemon
### END INIT INFO
echo "script was run" >> /ntp.log
If I rename that same dummy script to /etc/init.d/ntp2, it is started automatically at boot.
However, grepping the systemd source code and my systemd config files for ntp doesn't seem to find anything that might cause this behavior:
/etc/systemd# grep -iR ntp *
timesyncd.
timesyncd.
/lib/systemd# grep -R ntp *
system/
system/
Binary file systemd-networkd matches
Binary file systemd-timedated matches
Binary file systemd-timesyncd matches
What else can I do to debug this further?
Changed in ntp (Ubuntu): | |
importance: | Undecided → High |
summary: |
- ntpd not started by systemd + ntpd not started when using ntpdate |
no longer affects: | systemd (Ubuntu) |
tags: | added: sts |
I came across a box that was running Ubuntu 15.10 with ntpd. systemd was automatically starting ntpd on boot on that system: sysv-generator( 8) slice/ntp. service
# systemctl status ntp
ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp)
Active: active (running) since Sun 2016-04-24 14:48:26 EDT; 1 weeks 1 days ago
Docs: man:systemd-
CGroup: /system.
└─849 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 106:115
Apr 24 14:44:41 host systemd[1]: Starting LSB: Start NTP daemon...
Apr 24 14:44:41 host ntp[894]: * Starting NTP server ntpd
Apr 24 14:48:26 host ntp[894]: lockfile creation failed: exceeded maximum number of lock attempts
Apr 24 14:48:26 host ntp[894]: ...done.
Apr 24 14:48:26 host systemd[1]: Started LSB: Start NTP daemon.
After updating to 16.04 (ntp:amd64 1:4.2.6. p5+dfsg- 3ubuntu8. 2 -> 1:4.2.8p4+ dfsg-3ubuntu5, systemd:amd64 225-1ubuntu9.1 -> 229-4ubuntu4, systemd-sysv:amd64 225-1ubuntu9.1 -> 229-4ubuntu4), systemd no longer starts ntpd on boot: sysv-generator( 8)
# systemctl status ntp
ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-
May 02 23:22:37 host systemd[1]: Stopped LSB: Start NTP daemon.
May 02 23:22:37 host systemd[1]: Stopped LSB: Start NTP daemon.