[regression]: Failed to call clock_adjtime(): Invalid argument

Bug #1566465 reported by Simon Déziel
116
This bug affects 22 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Medium
Tim Gardner
Xenial
Fix Released
Medium
Tim Gardner

Bug Description

Steps to reproduce:

1) Force a time delta
date -s "now - 1 hour"
2) Restart systemd-timesyncd to have it fix the time
systemctl restart systemd-timesyncd

Expected behavior:

The clock should be back in sync.

Actual (problematic) behavior:

The clock stays out of sync because the call to clock_adjtime() failed.

# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Tue 2016-04-05 14:26:25 EDT; 1s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 11567 (systemd-timesyn)
   Status: "Synchronized to time server 172.24.21.1:123 (ntp.ubuntu.com)."
    Tasks: 2 (limit: 512)
   Memory: 260.0K
      CPU: 15ms
   CGroup: /system.slice/systemd-timesyncd.service
           └─11567 /lib/systemd/systemd-timesyncd

Apr 05 14:26:25 simon-laptop systemd[1]: Starting Network Time Synchronization...
Apr 05 14:26:25 simon-laptop systemd[1]: Started Network Time Synchronization.
Apr 05 14:26:25 simon-laptop systemd-timesyncd[11567]: Failed to call clock_adjtime(): Invalid argument
Apr 05 14:26:25 simon-laptop systemd-timesyncd[11567]: Synchronized to time server 172.24.21.1:123 (ntp.ubuntu.com).

This problem doesn't happen when running kernel 4.4.0-16.32. Looking at the changelog of 4.4.0-17.33 it could be because of the new feature introduced in LP: #1519625.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: linux-image-4.4.0-17-generic 4.4.0-17.33
ProcVersionSignature: Ubuntu 4.4.0-17.33-generic 4.4.6
Uname: Linux 4.4.0-17-generic x86_64
NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
ApportVersion: 2.20.1-0ubuntu1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: simon 5198 F.... pulseaudio
CurrentDesktop: Unity
CurrentDmesg: Error: command ['dmesg'] failed with exit code 1: dmesg: read kernel buffer failed: Operation not permitted
Date: Tue Apr 5 14:21:22 2016
HibernationDevice: RESUME=/dev/mapper/crypt-swap
MachineType: LENOVO 2516CTO
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.4.0-17-generic root=/dev/mapper/crypt-xroot ro quiet splash cryptopts=target=crypt,source=/dev/sda1,lvm=crypt-xroot possible_cpus=4 nmi_watchdog=0 kaslr quiet splash cryptopts=target=crypt,source=/dev/sda1,lvm=crypt-xroot possible_cpus=4 nmi_watchdog=0 kaslr vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-4.4.0-17-generic N/A
 linux-backports-modules-4.4.0-17-generic N/A
 linux-firmware 1.157
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 02/14/2013
dmi.bios.vendor: LENOVO
dmi.bios.version: 6IET85WW (1.45 )
dmi.board.name: 2516CTO
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr6IET85WW(1.45):bd02/14/2013:svnLENOVO:pn2516CTO:pvrThinkPadT410:rvnLENOVO:rn2516CTO:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 2516CTO
dmi.product.version: ThinkPad T410
dmi.sys.vendor: LENOVO

CVE References

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in linux (Ubuntu):
status: New → Confirmed
tags: added: kernel-da-key
Changed in linux (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Mikko Pesari (mpesari) wrote :

Still happens with kernel 4.4.0-18 from xenial-proposed

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I have set get time from internet in the indicator datetime.
timedatectl says:
$ timedatectl
      Local time: Tue 2016-04-12 10:54:21 BST
  Universal time: Tue 2016-04-12 09:54:21 UTC
        RTC time: Tue 2016-04-12 10:54:20
       Time zone: Europe/London (BST, +0100)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: yes

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

Which is consistent, but I'm not sure if that's right. My /etc/adjtime says LOCAL, and I do have WIndows 10 installed. I should check if WIndows 10 can handle UTC hardware clock.

The journal has many errors about failing to call adjtime.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Revision history for this message
Fabian Grünbichler (f-gruenbichler) wrote :

This seems to be caused by the call to "timeval_inject_offset_valid()" introduced in kernel/time/ntp.c (in "ntp_validate_timex()") by 2ed8b5bac95a96e2334a6b9bcbe99eabaf83f931. timeval_inject_offset_valid only handles timevals with microseconds, but systemd-timesyncd uses the ADJ_NANO mode which stores nanosecond values in tv_usec. upstream 4.5 already has a fix to handle this situation by copying the tv content to a (temporary) timespec and validating that iff ADJ_NANO is used.

Tim Gardner (timg-tpi)
Changed in linux (Ubuntu Xenial):
assignee: nobody → Tim Gardner (timg-tpi)
status: Confirmed → In Progress
Revision history for this message
Tim Gardner (timg-tpi) wrote :
Changed in linux (Ubuntu Xenial):
status: In Progress → Fix Committed
Revision history for this message
Simon Déziel (sdeziel) wrote :

The fix included in 4.4.0-20-generic works well, thanks.

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.5 KiB)

This bug was fixed in the package linux - 4.4.0-21.37

---------------
linux (4.4.0-21.37) xenial; urgency=low

  [ Tim Gardner ]

  * Release Tracking Bug
    - LP: #1571791

  * linux: MokSBState is ignored (LP: #1571691)
    - SAUCE: (noup) MODSIGN: Import certificates from UEFI Secure Boot
    - SAUCE: (noup) efi: Disable secure boot if shim is in insecure mode
    - SAUCE: (noup) Display MOKSBState when disabled

linux (4.4.0-20.36) xenial; urgency=low

  [ Tim Gardner ]

  * Release Tracking Bug
    - LP: #1571069

  * sysfs mount failure during stateful lxd snapshots (LP: #1570906)
    - SAUCE: kernfs: Do not match superblock in another user namespace when
      mounting

  * Kernel Panic in Ubuntu 16.04 netboot installer (LP: #1570441)
    - x86/topology: Fix logical package mapping
    - x86/topology: Fix Intel HT disable
    - x86/topology: Use total_cpus not nr_cpu_ids for logical packages
    - xen/apic: Provide Xen-specific version of cpu_present_to_apicid APIC op
    - x86/topology: Fix AMD core count

  * [regression]: Failed to call clock_adjtime(): Invalid argument
    (LP: #1566465)
    - ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO

linux (4.4.0-19.35) xenial; urgency=low

  [ Tim Gardner ]

  * Release Tracking Bug
    - LP: #1570348

  * CVE-2016-2847 (LP: #1554260)
    - pipe: limit the per-user amount of pages allocated in pipes

  * xenial kernel crash on HP BL460c G7 (qla24xx problem?) (LP: #1554003)
    - SAUCE: (noup) qla2xxx: Add irq affinity notification V2

  * arm64: guest hangs when ntpd is running (LP: #1549494)
    - SAUCE: (noup) KVM: arm/arm64: Handle forward time correction gracefully

  * linux: Enforce signed module loading when UEFI secure boot (LP: #1566221)
    - [Config] CONFIG_EFI_SECURE_BOOT_SIG_ENFORCE=y

  * s390/cpumf: Fix lpp detection (LP: #1555344)
    - s390/facilities: use stfl mnemonic instead of insn magic
    - s390/facilities: always use lowcore's stfle field for storing facility bits
    - s390/cpumf: Fix lpp detection

  * s390x kernel image needs weightwatchers (LP: #1536245)
    - [Config] s390x: Use compressed kernel bzImage

  * Surelock GA2 SP1: surelock02p05: Not seeing sgX devices for LUNs after
    upgrading to Ubuntu 16.04 (LP: #1567581)
    - Revert "UBUNTU: SAUCE: (noup) powerpc/pci: Assign fixed PHB number based on
      device-tree properties"

  * Backport upstream bugfixes to ubuntu-16.04 (LP: #1555765)
    - cpufreq: powernv: Define per_cpu chip pointer to optimize hot-path
    - Revert "cpufreq: postfix policy directory with the first CPU in related_cpus"
    - cpufreq: powernv: Add sysfs attributes to show throttle stats

  * systemd-modules-load.service: Failing due to missing module 'ib_iser' (LP: #1566468)
    - [Config] Add ib_iser to generic inclusion list

  * thunderx nic performance improvements (LP: #1567093)
    - net: thunderx: Set recevie buffer page usage count in bulk
    - net: thunderx: Adjust nicvf structure to reduce cache misses

  * fixes for thunderx nic in multiqueue mode (LP: #1567091)
    - net: thunderx: Fix for multiqset not configured upon interface toggle
    - net: thunderx: Fix for HW TSO not enabled for secondary qsets
    - net: thund...

Read more...

Changed in linux (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Ales Kvapil (aleskva) wrote :

4.4.0-21-generic still not fixed. Should I wait until next Kernel update? Or still a bug

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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