Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1823463

Summary: hwclock unable to set system time
Product: [Fedora] Fedora Reporter: Dennis Gilmore <dgilmore>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: jonathan, kzak, mlichvar, pbrobinson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: util-linux-2.35.1-8.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-25 02:23:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dennis Gilmore 2020-04-13 18:53:32 UTC
Description of problem:

I booted a system with the network cable disconnected and got:
[root@localhost ~]# date
Wed 01 Apr 2020 05:24:35 PM UTC
[root@localhost ~]# hwclock 
2020-04-08 15:15:29.146007+00:00

trying to set the time
[root@localhost ~]# hwclock --hctosys
hwclock: settimeofday() failed: Invalid argument
[root@localhost ~]# hwclock --hctosys --verbose
hwclock from util-linux 2.35.1
System Time: 1585762054.571276
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Last drift adjustment done at 1585761886 seconds after 1969
Last calibration done at 1585761886 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2020/04/08 15:18:25
Hw clock time : 2020/04/08 15:18:25 = 1586359105 seconds since 1969
Time since last adjustment is 597219 seconds
Calculated Hardware Clock drift is 0.000000 seconds
Calling settimeofday(NULL, 0) to set persistent_clock_is_local.
Calling settimeofday(1586359105.000000, 0)
hwclock: settimeofday() failed: Invalid argument
[root@localhost ~]# rpm -q glibc
glibc-2.31-2.fc32.aarch64

Version-Release number of selected component (if applicable):
util-linux-2.35.1-7.fc32.aarch64

I came across https://www.mail-archive.com/info-gnu@gnu.org/msg02694.html which indicates that the apis used by hwclock is removed for new use after being previously deprecated.

if a system boots without network, date and time will be off. potentially preventing system from updating. 

How reproducible:
always 

Steps to Reproduce:
1. hwclock --hctosys
2.
3.

Actual results:
hwclock: settimeofday() failed: Invalid argument

Expected results:
time to be set

Additional info:

Comment 1 Karel Zak 2020-04-14 08:45:32 UTC
Fixed by upstream commit http://github.com/karelzak/util-linux/commit/cd781c405be82540484da3bfe3d3f17a39b8eb5c

It seems we need to backport this commit to Fedora ASAP.

Comment 2 Karel Zak 2020-04-15 08:06:41 UTC
Fixed in util-linux-2.35.1-8.fc33 for rawhide.

Comment 3 Fedora Update System 2020-04-15 09:14:51 UTC
FEDORA-2020-eedbcc85f7 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-eedbcc85f7

Comment 4 Fedora Update System 2020-04-15 09:17:36 UTC
FEDORA-2020-eedbcc85f7 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-eedbcc85f7

Comment 5 Fedora Update System 2020-04-16 19:28:15 UTC
FEDORA-2020-eedbcc85f7 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-eedbcc85f7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-eedbcc85f7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2020-04-25 02:23:13 UTC
FEDORA-2020-eedbcc85f7 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.