'sudo hwclock -s' fails with 'settimeofday() failed: Invalid argument'

Bug #1870316 reported by Rik Mills on 2020-04-02
This bug affects 1 person
Affects Status Importance Assigned to Milestone
util-linux (Debian)
Fix Released
util-linux (Ubuntu)
Mauricio Faria de Oliveira

Bug Description

In Focal VM.
util-linux: 2.34-0.1ubuntu8

$ sudo hwclock -s
[sudo] password for focal:
hwclock: settimeofday() failed: Invalid argument

Result should be syncing the time to the RTC, which until recently (possibly before glibc update) worked.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: util-linux 2.34-0.1ubuntu8
ProcVersionSignature: Ubuntu 5.4.0-18.22-generic 5.4.24
Uname: Linux 5.4.0-18-generic x86_64
ApportVersion: 2.20.11-0ubuntu22
Architecture: amd64
CurrentDesktop: KDE
Date: Thu Apr 2 11:20:45 2020
InstallationDate: Installed on 2019-12-24 (99 days ago)
InstallationMedia: Kubuntu 20.04 LTS "Focal Fossa" - Alpha amd64 (20191224)
SourcePackage: util-linux
UpgradeStatus: No upgrade log present (probably fresh install)

Rik Mills (rikmills) wrote :

Rik, thanks for reporting this bug.
You're right, it's a regression in hwclock between glibc 2.30/2.31.
It's fixed in util-linux upstream; preparing a debdiff for Focal.


$ lsb_release -cs

Older glibc:

$ dpkg -s util-linux libc6 | grep ^Version:
Version: 2.34-0.1ubuntu8
Version: 2.30-0ubuntu3

$ sudo hwclock -s
$ echo $?

Newer glibc:

$ sudo apt install libc6
The following packages will be upgraded:
  libc-bin libc-dev-bin libc6 libc6-dev locales

$ dpkg -s util-linux libc6 | grep ^Version:
Version: 2.34-0.1ubuntu8
Version: 2.31-0ubuntu6

$ sudo hwclock -s
hwclock: settimeofday() failed: Invalid argument
$ echo $?


This is fixed with this upstream commit.
Preparing a debdiff for Focal.

ubuntu@focal:~/util-linux$ sudo ./hwclock -s
$ echo $?

commit cd781c405be82540484da3bfe3d3f17a39b8eb5c
Author: J William Piggott <email address hidden>
Date: Fri Feb 21 20:03:47 2020 -0500

    hwclock: make glibc 2.31 compatible

Changed in util-linux (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
importance: Medium → High
assignee: nobody → Mauricio Faria de Oliveira (mfo)
tags: added: sts-sponsor-mfo
Changed in util-linux (Debian):
status: Unknown → New

The patched package built correctly on all architectures on PPA [1].

And now 'hwclock -s' works again.

$ dpkg -s util-linux libc6 | grep ^Version:
Version: 2.34-0.1ubuntu9
Version: 2.31-0ubuntu6

$ sudo hwclock -s
$ echo $?

Attaching debdiff, and asking for sponsorship.

[1] https://launchpad.net/~mfo/+archive/ubuntu/lp1870316

Changed in util-linux (Ubuntu):
status: Confirmed → In Progress
tags: added: patch
Sebastien Bacher (seb128) wrote :

Thanks, uploaded to focal now

Changed in util-linux (Ubuntu):
status: In Progress → Fix Committed

The only autopkgtest 'regression' is openjdk-8/8u252-b07-1/armhf,
which is a flaky test. Triggering a re-run. Error in test logs:

> jdk FLAKY timed out

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package util-linux - 2.34-0.1ubuntu9

util-linux (2.34-0.1ubuntu9) focal; urgency=medium

  * d/p/hwclock-make-glibc-2.31-compatible.patch: fix hwclock
    for settimeofday(2) changes in glibc 2.31. (LP: #1870316)

 -- Mauricio Faria de Oliveira <email address hidden> Thu, 02 Apr 2020 12:29:40 -0300

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

Other bug subscribers

Remote bug watches

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