- Taking a Xenial and a Artful VM
- Installing ntp
- Check status of ntp
  - running fine on both systems
- Reboot the VM
- Check status of ntp
  - still ntp service ok on both systems
- install ntpdate
- Check status of ntp
  - still ntp service ok on both systems
- reboot
- Check status of ntp
  - failed for blocked known address being busy on both
- reboot (to check reproducibility)
- Check status of ntp
  - failed for blocked known address being busy on both
- Adding two extra devices in libvirt and configuring it on the guest
- restart
- Check status of ntp
  - failed for blocked known address being busy on both (likely even at a 
higher "risk")

ntp init mechanims:
Xenial: /etc/init.d/ntp locks LOCKFILE=/var/lock/ntpdate
Artful: /usr/lib/ntp/ntp-systemd-wrapper locks nothing at all

This races against the following hook (in both releases):
/etc/network/if-up.d/ntpdate which locks /run/lock/ntpdate

Seems reproducible enough to me, actually much better reproducible than in the 
past.
I checked and our recent cleanup of the mess around debian/ntpdate.if-up fixed 
a lot of things.
Among other it removed an accidential restart of ntp which kind of hid this 
issue here (no regression-update, just an issue existing before now more likely 
to be hit).

But now with things no more that racy the fix is easy and much better
testable.

** Changed in: ntp (Ubuntu Xenial)
       Status: New => Confirmed

** Changed in: ntp (Ubuntu)
       Status: Fix Released => Confirmed

-- 
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/1706818

Title:
  mismatched file locking since 1:4.2.8p4+dfsg-3ubuntu1 causes race
  leaving ntp dead on reboot

Status in ntp package in Ubuntu:
  Confirmed
Status in ntp source package in Xenial:
  Confirmed
Status in ntp source package in Zesty:
  Fix Released
Status in ntp source package in Artful:
  Confirmed
Status in ntp package in Debian:
  Fix Released

Bug description:
  ntpdate and ntp conflict on the NTP well-known-socket. If ntp and
  ntpdate 1:4.2.8p4+dfsg-3ubuntu5.5 are installed on Xenial, and there
  are 2 static interfaces configured, most often we find that ntpd is
  not running after a reboot.

  When the ntp service is started by systemd, ntp fails to bind the NTP
  socket because ntpdate is running in the background. It's intended
  that ntp and ntpdate try to avoid this conflict with a lock file, but
  the locking mechanism was changed in ntpdate.if-up (from lockfile to
  flock), but it was not changed in ntp.init. Previously the file
  locking prevented ntp from trying to start when ntpdate was running.
  Not any more.

  Having multiple interfaces causes a much longer period of the socket
  being unavailable, because the 2 ntpdate processes will get serialized
  by the lock, while the ntp service is looking for a different lock, so
  it just plows right in.  Attempts by netdate.if-up to stop and start
  ntp seem to overlap and when the final start is invoked, systemd seems
  to thing ntp is already running, though it has failed.

  In 1:4.2.8p4+dfsg-3ubuntu1 the following change was made:
    debian/ntpdate.if-up: Drop lockfile mechanism as upstream is using flock 
now.
  Looks like corresponds to rev 371 of debian/ntpdate.if-up from upstream.

  This change diverged locking between ntpdate.if-up and ntp.init. This
  was rectified in rev 451 of ntp.init, to use compatible locking, but
  that doesn't appear in the Ubuntu version.

  
  System Information:

   lsb_release -rd:
     Description:    Ubuntu 16.04.2 LTS
     Release:        16.04

  
   apt-cache policy ntpdate:

     ntpdate:
       Installed: 1:4.2.8p4+dfsg-3ubuntu5.5
       Candidate: 1:4.2.8p4+dfsg-3ubuntu5.5
       Version table:
      *** 1:4.2.8p4+dfsg-3ubuntu5.5 100
             100 /var/lib/dpkg/status

   apt-cache policy ntp:

     ntp:
       Installed: 1:4.2.8p4+dfsg-3ubuntu5.5
       Candidate: 1:4.2.8p4+dfsg-3ubuntu5.5
       Version table:
      *** 1:4.2.8p4+dfsg-3ubuntu5.5 100
             100 /var/lib/dpkg/status

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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to