Aha! I've found the issue.

/etc/network/if-up.d/ntpdate is called when each network interface comes
up.  This happens before network.target is reached, so it happens before
ntp.service would normally be automatically started by systemd.

/etc/network/if-up.d/ntpdate calls `invoke-rc.d ntp stop`, then it runs
ntpdate, then it calls `invoke-rc.d ntp start`.

`invoke-rc.d ntp stop` runs `systemctl stop ntp.service`, which causes
systemd to cancel the ntp.service start task that was automatically
scheduled to happen after network.target.

`invoke-rc.d ntp start` calls `/sbin/runlevel` to determine the current
runlevel so that it can verify the existence of a /etc/rc?.d/S??ntp
symlink for the current runlevel.  However, `/sbin/runlevel` returns
"unknown" because systemd has not reached multi-user.target yet.
Therefore, invoke-rc.d determines that the appropriate /etc/rc?.d/S??ntp
symlink does not exist, so it does not call `systemctl start
ntp.service` to start ntp.

Changing /etc/network/if-up.d/ntpdate so that it calls `systemctl start
ntp.service` instead of `invoke-rc.d ntp start` fixes the problem.

However, I think I would consider this to be a bug in invoke-rc.d and
not ntpdate, since invoke-rc.d simply does not work properly when
systemd is being used and invoke-rc.d is called at boot time.  At the
very least, I would think invoke-rc.d should document that this is
unsupported, and it should detect and report this condition if invoke-
rc.d is called at boot time (rather than just silently failing).

** Also affects: init-system-helpers (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1577596

Title:
  ntpd not started when using ntpdate

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/init-system-helpers/+bug/1577596/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to