← Back to team overview

touch-packages team mailing list archive

[Bug 1125726] Re: boot-time race between /etc/network/if-up.d/ntpdate and "/etc/init.d/ntp start"

 

The fix for 246203 was wrong: http://bazaar.launchpad.net/~ubuntu-
branches/ubuntu/karmic/ntp/karmic/revision/23

The issue is that the ntp init script is started inside the ntpdate ifup
script BEFORE the lock file is unlocked. That init script then blocks
because the lock is taken. The correct fix is to unlock before starting
the init script.

The lock is supposed to be shared because both services cannot run at
the same time, otherwise one of them will fail to start. ntpd usually
wins right now because it gets started more times, but we have
encountered a fairly easy to reproduced scenario where ntpdate fails to
step the clock at boot, resulting in wildly inaccurate system times. I
have attached a patch which fixes the problem here.

** Attachment added: "patch"
   https://bugs.launchpad.net/ubuntu/+source/ntp/+bug/1125726/+attachment/4505280/+files/patch

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ntp in Ubuntu.
https://bugs.launchpad.net/bugs/1125726

Title:
  boot-time race between /etc/network/if-up.d/ntpdate and
  "/etc/init.d/ntp start"

Status in ntp package in Ubuntu:
  Confirmed

Bug description:
  We're seeing a race between if-up.d/ntpdate and the ntp startup
  script.

  1) if-up.d/ntpdate starts.
  2) if-up.d/ntpdate acquires the lock "/var/lock/ntpdate-ifup".
  3) if-up.d/ntpdate stops the ntp service [which isn't running anyway].
  4) if-up.d/ntpdate starts running ntpdate, which bids UDP *.ntp
  5) /etc/init.d/rc 2 executes "/etc/rc2.d/S20ntp start"
  6) /etc/init.d/ntp acquires the lock "/var/lock/ntpdate".
  7) /etc/init.d/ntp starts the ntp daemon.
  8) The ntp daemon logs an error, complaining that it cannot bind UDP *.ntp.
  9) if-up.d/ntpdate now starts the ntp service.

  The result is a weird churn, though ntpd does end up running at the
  end.

  Should these not be using the same lock file?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ntp/+bug/1125726/+subscriptions