Skip to main content
Topic: glibc-2.31.1 system clock error (Read 2868 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

glibc-2.31.1 system clock error

After upgrading to glibc 2.31-1 I get an error at boot
Code: [Select]
hwclock: settimeofday() failed: Invalid argument
 * Failed to set the system clock

Downgrading glibc to 2.30-3 solves this.

Re: glibc-2.31.1 system clock error

Reply #1
https://sourceware.org/ml/libc-announce/2020/msg00001.html
Quote
The settimeofday function can still be used to set a system-wide
  time zone when the operating system supports it.  This is because
  the Linux kernel reused the API, on some architectures, to describe
  a system-wide time-zone-like offset between the software clock
  maintained by the kernel, and the "RTC" clock that keeps time when
  the system is shut down.

  However, to reduce the odds of this offset being set by accident,
  settimeofday can no longer be used to set the time and the offset
  simultaneously.  If both of its two arguments are non-null, the call
  will fail (setting errno to EINVAL).

Looks related.

Re: glibc-2.31.1 system clock error

Reply #2
Thanks. So this is an openrc bug, right (since the error is reported in /var/log/rc.log)? Does this mean I can do nothing about it except wait for an update? Can I ignore it, since the clock seems to be working? I just got a "bad gateway" error trying to log in, is this time-related? (I'm now back to glibc-2.30-3, I don't know if that solved the error)

Re: glibc-2.31.1 system clock error

Reply #3
I'd guess it's a bug in hwclock. But that really is nothing more than a guess...

I think the only effect of this is that the system time isn't being loaded from the computers hardware clock chip at boot. But if you run ntp, that shouldn't matter.

Re: glibc-2.31.1 system clock error

Reply #4
But, it could also be a bug in how openrc runs 'hwclock'.

Re: glibc-2.31.1 system clock error

Reply #5
According to the Gentoo "System time" wiki, I should delete the hwclock service from boot, since my kernel (and also the default kernel) has all the required options to set the time in-kernel:
Code: [Select]
On a sufficiently modern kernel (3.9 or newer), Linux can be configured to handle setting the system time automatically. To do so, enable the Set system time from RTC on startup and resume (CONFIG_RTC_HCTOSYS) and Set the RTC time based on NTP synchronization (CONFIG_RTC_SYSTOHC) kernel options:

Device Drivers --->
      [*] Real Time Clock --->
            [*]   Set system time from RTC on startup and resume
            (rtc0)  RTC used to set the system time
            [*]   Set the RTC time based on NTP synchronization
            (rtc0)  RTC used to synchronize NTP adjustment
            [*]   /sys/class/rtc/rtcN (sysfs)
            [*]   /proc/driver/rtc (procfs for rtc0)
            [*]   /dev/rtcN (character devices)
            <*>   PC-style 'CMOS'
So I deleted the hwclock service. The time is correct after rebooting. I did not change /etc/conf.d/hwclock.

If the hwclock service is still activated by default, that should be changed.


 

Re: glibc-2.31.1 system clock error

Reply #7
After the recent openrc update the hwclock service was readded, and I had to manually delete it again. I don't need it - system time works without it, and for mate-control-center I can install openrc-settingsd, which will open a proper authentication window (not that I need openrc-settingsd, I don't even need mate-control-center, but I keep it for convenience).

Is there a way of blacklisting the hwclock service, other than adding
Code: [Select]
NoExtract = etc/init.d/hwclock
to /etc/pacman.conf? This works, I successfully rebooted without error after reinstalling openrc, but it seems like overkill. A command like "rc-status set hwclock unused" would be nice.