ntpdate fails with invalid argument when device is set to a date in the future (delta > 2^16)

Bug #1526264 reported by Jean-Baptiste Lallement
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Unassigned
ntp (Ubuntu)
Fix Released
High
Łukasz Zemczak
ntp (Ubuntu RTM)
Fix Released
High
Unassigned

Bug Description

current build number: 204
device name: krillin
channel: ubuntu-touch/rc-proposed/bq-aquaris.en

when the current date of the device is in the future, ntpdate fails with 'Invalid Argument'

For example:

* current date: passed
root@ubuntu-phablet:~# date
mardi 15 décembre 2015, 12:01:22 (UTC+0100)
root@ubuntu-phablet:~# ntpdate ntp.ubuntu.com
15 Dec 12:01:38 ntpdate[4360]: adjust time server 91.189.94.4 offset 0.000150 sec

* Date in the past: passed
root@ubuntu-phablet:~# date -s '2015-12-14 13:00:00'
lundi 14 décembre 2015, 13:00:00 (UTC+0100)
root@ubuntu-phablet:~# ntpdate ntp.ubuntu.com
15 Dec 12:03:02 ntpdate[5008]: step time server 91.189.89.199 offset 82943.900852 sec

* Date in the future: Failed
root@ubuntu-phablet:~# date -s '2015-12-16 13:00:00'
mercredi 16 décembre 2015, 13:00:00 (UTC+0100)
root@ubuntu-phablet:~# ntpdate ntp.ubuntu.com
16 Dec 13:00:10 ntpdate[4820]: Can't adjust the time of day: Invalid argument

After some experimentation, ntpdate fails if the difference between the current time on the device and the real time is bigger than 2^16 (65536)

= Workaround =
Use option -b

root@ubuntu-phablet:~# date -s '2015-12-16 13:00:00'
mercredi 16 décembre 2015, 13:00:00 (UTC+0100)
root@ubuntu-phablet:~# ntpdate -b ntp.ubuntu.com
15 Dec 12:07:08 ntpdate[7083]: step time server 91.189.94.4 offset -89602.883248 sec

Changed in canonical-devices-system-image:
importance: Undecided → High
description: updated
description: updated
summary: ntpdate fails with invalid argument when device is set to a date in the
- future
+ future (delta > 2^16)
Changed in canonical-devices-system-image:
status: New → Confirmed
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :
Mathew Hodson (mhodson)
Changed in ntp (Ubuntu):
importance: Undecided → High
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Alfonso also told me this patch has been forwarded upstream: http://bugs.ntp.org/show_bug.cgi?id=3023

I'm not an expert in ntp, but the change makes sense to me. Will be sponsoring this change in that case.

Changed in ntp (Ubuntu RTM):
importance: Undecided → High
Changed in ntp (Ubuntu):
assignee: nobody → Łukasz Zemczak (sil2100)
Changed in canonical-devices-system-image:
status: Confirmed → Fix Committed
milestone: none → ww08-2016
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

This bug was fixed in the package ntp 1:4.2.6.p5+dfsg-3ubuntu6.4~overlay1 in https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/stable-phone-overlay

---------------

ntp (1:4.2.6.p5+dfsg-3ubuntu6.4~overlay1) vivid; urgency=medium

  * Fix cannot correct dates in the future (LP: #1526264)

 -- Simon Fels <email address hidden> Mon, 22 Feb 2016 15:49:16 +0100

Changed in ntp (Ubuntu RTM):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ntp - 1:4.2.8p4+dfsg-3ubuntu3

---------------
ntp (1:4.2.8p4+dfsg-3ubuntu3) xenial; urgency=medium

  * debian/patches/ntpdate-fix-lp1526264.patch:
    - Add Alfonso Sanchez-Beato's patch for fixing the cannot correct dates in
      the future bug (LP: #1526264)

 -- Łukasz 'sil2100' Zemczak <email address hidden> Wed, 24 Feb 2016 12:29:32 +0100

Changed in ntp (Ubuntu):
status: New → Fix Released
Changed in canonical-devices-system-image:
status: Fix Committed → 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.