The officially official Devuan Forum!

You are not logged in.

#1 2023-06-03 15:11:20

bigcat
Member
Registered: 2023-05-10
Posts: 29  

[SOLVED] rtc clock problem

Greetings,

I have a chimaera system which I updated to testing.  It is running a linux-image-6.1.0-9-amd64 kernel.  This is a fairly old machine with i3-4130T cpu and asrock tx-97x board.  I always suspected that the board was somewhat defective. I had to tweak a lot of things in the BIOS to get it running without locking up randomly.

I noticed that system time is off after resume, it is usually set to the time when the machine suspended.  I think I traced this to it being unable to read the hardware clock:

# hwclock --get --directisa

# hwclock --get 
hwclock: select() to /dev/rtc0 to wait for clock tick timed out

# cat /proc/interrupts|grep -i rtc
  8:          0          0          0          0   IO-APIC   8-edge      rtc0

The first command simply exits, and the second one gives a select() error.  I am guessing select() system call is waiting for an rtc interrupt which it never receives.

This machine used to run debian with the same kernel, and the time was set correctly after a resume.  I don't know if hwclock command could read the rtc because I had no reason to investigate.

So I have two questions;
(1) Any ideas about the time problem above?
(2) Does elogind support suspend/resume hooks as described here: https://wiki.gentoo.org/wiki/Elogind#Su … ok_scripts and if yes, what is the location of those scripts?  This would allow me to use ntpdate on resume to set a correct clock, and to restart ntpd, which at the moment refuses to function with such a large clock drift. 

Thanks.

Last edited by bigcat (2023-06-03 15:18:48)

Offline

#2 2023-06-03 15:23:54

trinidad
Member
From: Waterford WI
Registered: 2022-11-15
Posts: 18  
Website

Re: [SOLVED] rtc clock problem

Does the board have a separate coin cell battery? Put a new one in if it does. CR2032 is the most common.

TC

Offline

#3 2023-06-03 15:32:29

bigcat
Member
Registered: 2023-05-10
Posts: 29  

Re: [SOLVED] rtc clock problem

trinidad wrote:

Does the board have a separate coin cell battery? Put a new one in if it does. CR2032 is the most common.

TC

Thanks.  I could but not sure this will fix the problem.  I can see that the BIOS is keeping the time correctly.  I unplugged it from the wall outlet for a night, and it had a correct UTC time in the BIOS when it booted in the morning.

Offline

#4 2023-06-03 15:39:43

bigcat
Member
Registered: 2023-05-10
Posts: 29  

Re: [SOLVED] rtc clock problem

BTW I believe this problem is related to this particular hardware and not to devuan.  I have 8 machines with different hardware at home, all running the same system, and this one is the only machine that cannot set/update the hardware clock.  I am just not sure how debian managed to work around this.

Offline

#5 2023-06-04 09:56:47

delgado
Member
Registered: 2022-07-14
Posts: 156  

Re: [SOLVED] rtc clock problem

Some thoughts:
Correct BIOS time and non-fucntional RTC sounds contrary. Both are the same device, aren't they?

Debian shows correct time: Probably systemd-timesync forces a clock-update. ntpd could do so too with addional switches. google found e.g. https://askubuntu.com/questions/254826/ … -using-ntp

cat /proc/interrupts|grep -i rtc on my 97x-based mainboard looks almost equal, only one of the four zeros is not zero. Just to mention, whatever it means.

Offline

#6 2023-06-04 13:51:30

bigcat
Member
Registered: 2023-05-10
Posts: 29  

Re: [SOLVED] rtc clock problem

Thank you.

My current remedy is the following.  Create a file /etc/elogind/system-sleep/ntp.sh
with the following contents:

#!/bin/sh
case $1 in
        pre)
                /etc/init.d/ntpsec stop
                /bin/sleep 1
                ;;
        post)
                /usr/sbin/ntpd -gq
                /etc/init.d/ntpsec start
                ;;
esac

This seems to set the correct time on resume.

Offline

Board footer