ntpd can use stale /var/lib/ntp/ntp.conf.dhcp config

Bug #1472056 reported by Simon Déziel
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ntp (Debian)
Fix Released
Unknown
ntp (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Today, I noticed that my laptop's time was ~4s ahead of my home NTP server. Looking at 'ntpdc -sn localhost' I noticed that my laptop was trying to sync with an unknown and unreachable server. Surprisingly, this server was not in /etc/ntp.conf.

After some debugging, I found a stale /var/lib/ntp/ntp.conf.dhcp file that was several days old. This explains why my clock drift so much as I was not sync'ing with any reachable server.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: ntp 1:4.2.6.p5+dfsg-3ubuntu2.14.04.3
ProcVersionSignature: Ubuntu 3.13.0-57.95-generic 3.13.11-ckt21
Uname: Linux 3.13.0-57-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.11
Architecture: amd64
Date: Mon Jul 6 22:27:52 2015
InstallationDate: Installed on 2014-01-26 (526 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Alpha amd64 (20140124)
KernLog:
 Jul 6 07:42:09 simon-laptop kernel: [116085.154414] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
 Jul 6 07:42:09 simon-laptop kernel: [116085.157431] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
 Jul 6 12:07:27 simon-laptop kernel: [132003.862223] type=1400 audit(1436198847.026:183): apparmor="DENIED" operation="connect" profile="/usr/lib{,32,64}/libreoffice/program/oosplash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_9c6cceebd9df6af8f450bf52b6de65d0" pid=30017 comm="oosplash" requested_mask="rw" denied_mask="rw" fsuid=1000 ouid=1000
 Jul 6 19:54:12 simon-laptop kernel: [153828.256900] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
 Jul 6 19:54:12 simon-laptop kernel: [153828.259982] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
NtpStatus:
 remote refid st t when poll reach delay offset jitter
 ==============================================================================
  ntp.sdeziel.inf 206.108.0.132 2 u 37 64 1 5.967 -34.563 0.000
ProcEnviron:
 LANGUAGE=en_US
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: ntp
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.init.d.ntp: [modified]
modified.conffile..etc.ntp.conf: [modified]
mtime.conffile..etc.init.d.ntp: 2015-07-06T22:27:26.297288
mtime.conffile..etc.ntp.conf: 2015-07-06T22:24:58.208193

Related branches

Revision history for this message
Simon Déziel (sdeziel) wrote :
Revision history for this message
Simon Déziel (sdeziel) wrote :

The stale file was apparently left by /etc/dhcp/dhclient-exit-hooks.d/ntp. Since this dhclient script updates the ntp.conf.dhcp file when a new NTP server is advertised via DHCP, it should be OK to always use the most recent file between /var/lib/ntp/ntp.conf.dhcp and /etc/ntp.conf.

The attached patch changes the initscript to use /var/lib/ntp/ntp.conf.dhcp only if it is newer than /etc/ntp.conf.

Changed in ntp (Debian):
status: Unknown → New
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Only use /var/lib/ntp/ntp.conf.dhcp if it is newer than /etc/ntp.conf" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Robie Basak (racb)
Changed in ntp (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Iain Lane (laney) wrote :

Thanks. I'm going to upload your patch. I think the approach on the Debian bug is probably a bit better - make sure the file can't get (too) stale in the first place by putting it somewhere which will be cleaned out on reboot. But this one probably is less error prone given that we're close to wily release now.

Anyway. It'll get put into a review queue for someone to look at. If they disagree that this is a good idea it might get rejected. Just a warning.

Iain Lane (laney)
Changed in ntp (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ntp - 1:4.2.6.p5+dfsg-3ubuntu8

---------------
ntp (1:4.2.6.p5+dfsg-3ubuntu8) wily; urgency=medium

  * debian/ntp.init: Don't use /var/lib/ntp/ntp.conf.dhcp if /etc/ntp.conf is
    newer - it can get stale. Patch by Simon Déziel. (LP: #1472056)

 -- Iain Lane <email address hidden> Fri, 02 Oct 2015 10:45:41 +0100

Changed in ntp (Ubuntu):
status: Fix Committed → Fix Released
Changed in ntp (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.