hwclock - possible problem after update

This forum is for discussion about general software issues.

hwclock - possible problem after update

Postby mcloaked » Mon Oct 30, 2017 7:40 pm

After the most recent update of util-linux

[2017-10-30 18:50] [ALPM] upgraded util-linux (2.30.2-1 -> 2.31-1)

when I run hwclock -r I get:

# hwclock -r
hwclock: ioctl(3, RTC_UIE_ON, 0) to /dev/rtc0 failed: Invalid argument

I see the same on two different systems - anyone else seeing this?
mcloaked
 
Posts: 83
Joined: Thu Oct 16, 2014 4:16 pm

Re: hwclock - possible problem after update

Postby mcloaked » Sat Nov 04, 2017 3:14 pm

Interestingly the following command shows the RTC is set correctly (though on one machine I have to manually set the system clock with the date command, and then write the time to the RTC with hwclock --systohc, and then I see:

$this->bbcode_second_pass_code('', '
# timedatectl status
Local time: Sat 2017-11-04 15:10:37 GMT
Universal time: Sat 2017-11-04 15:10:37 UTC
RTC time: Sat 2017-11-04 15:10:12
Time zone: Europe/London (GMT, +0000)
System clock synchronized: yes
systemd-timesyncd.service active: no
RTC in local TZ: no
')

Also

$this->bbcode_second_pass_code('', '
# hwclock --debug
hwclock from util-linux 2.31
System Time: 1509807955.224164
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Last drift adjustment done at 1509807734 seconds after 1969
Last calibration done at 1509807734 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
hwclock: ioctl(3, RTC_UIE_ON, 0) to /dev/rtc0 failed: Invalid argument
...synchronization failed
')

So I wonder if there was a regression with the hwclock command in the package util-linux?
mcloaked
 
Posts: 83
Joined: Thu Oct 16, 2014 4:16 pm

Re: hwclock - possible problem after update

Postby pcermak » Mon Nov 06, 2017 9:53 am

Same problem on my RPi after upgrade.

$this->bbcode_second_pass_code('', '[root@alarmpi ~]# hwclock --debug
hwclock from util-linux 2.31
System Time: 1509961898.067116
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Last drift adjustment done at 1509220014 seconds after 1969
Last calibration done at 1509220014 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
hwclock: ioctl(3, RTC_UIE_ON, 0) to /dev/rtc0 failed: Invalid argument
...synchronization failed')

But device seems to work ok, because direct read over i2c work.

$this->bbcode_second_pass_code('', '[root@alarmpi ~]# i2cdump -y -f -r 0-6 0 0x6f c
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 81 52 09 2a 06 11 17 ?R?*??? ')

And: "hwclock -w" seems to wok too.
pcermak
 
Posts: 3
Joined: Mon Nov 06, 2017 9:49 am

Re: hwclock - possible problem after update

Postby mcloaked » Tue Nov 07, 2017 5:33 pm

Yes I found the same, that writing the RTC from the system clock with hwclock does work for my two machines also. I didn't find any other reports that would indicate that anyone is working on a fix for this issue though.
mcloaked
 
Posts: 83
Joined: Thu Oct 16, 2014 4:16 pm

Re: hwclock - possible problem after update

Postby blacxun » Fri Nov 17, 2017 9:51 am

Hello to all,
I'm facing this problem too, both at PI2 as PI3. On a NanoPi Neo not! The Problem can be solved by enabling the CONFIG_RTC_INTF_DEV_UIE_EMUL option in the kernel. It's only a workaround! I don't know whether it's kernel related or hwclock. Earlier versions did work.
blacxun
 
Posts: 1
Joined: Fri Apr 17, 2015 7:19 am

Re: hwclock - possible problem after update

Postby es30 » Tue Nov 21, 2017 10:05 pm

I have raised the issue here.

UPDATE:
Expect a fix in util-linux 2.31.1.
es30
 
Posts: 3
Joined: Tue Nov 21, 2017 9:51 pm

Re: hwclock - possible problem after update

Postby pcermak » Fri Feb 02, 2018 6:36 pm

Old problem with hwclock seems to be fixed. But i have another problem, because system overwrite RTC time on reboot.
System adjust clock to build time, before RTC initialization and then write it to RTC. Don't know where.

Linux alarmpi 4.9.79-1-ARCH #1 SMP Thu Feb 1 01:28:26 UTC 2018 armv6l GNU/Linux
---
Jan 15 23:20:04 alarmpi systemd[1]: System time before build time, advancing clock.
---
Jan 15 23:20:13 alarmpi kernel: gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
Jan 15 23:20:13 alarmpi kernel: rtc-ds1307 0-006f: rtc core: registered mcp7940x as rtc0
Jan 15 23:20:14 alarmpi kernel: rtc-ds1307 0-006f: 64 bytes nvram
---

Any suggestions how to prevent RTC time overwrite?

Message "System time before build time, advancing clock." is from systemd, but i don't know where it write time back to HW clock. May be somewhere in systemd...
pcermak
 
Posts: 3
Joined: Mon Nov 06, 2017 9:49 am

Re: hwclock - possible problem after update

Postby fdc » Sat Feb 24, 2018 3:56 pm

The clock needs to be set early in the boot process. This works on an rpi3 with a PiHut Mini RTC Module:

in /boot/config.txt insert
$this->bbcode_second_pass_code('', ' dtoverlay=i2c-rtc,ds1307')

in /etc/mkinitcpio.conf insert
$this->bbcode_second_pass_code('', 'MODULES=(i2c-bcm2835 rtc_ds1307)
BINARIES=(hwclock)
FILES=(/etc/udev/rules.d/50-rtc-hwclock.rules)
')

create /etc/udev/rules.d/50-rtc-hwclock.rules
$this->bbcode_second_pass_code('', 'KERNEL=="rtc0", RUN+="/bin/hwclock -s"
')

execute
$this->bbcode_second_pass_code('', ' mkinitcpio -p linux-raspberrypi')

reboot
fdc
 
Posts: 1
Joined: Sat Feb 24, 2018 3:15 pm

Re: hwclock - possible problem after update

Postby pcermak » Tue Feb 27, 2018 10:34 am

Super it's right what i need. It's now working ok.. Thanks
pcermak
 
Posts: 3
Joined: Mon Nov 06, 2017 9:49 am

Re: hwclock - possible problem after update

Postby JenniferT » Wed Apr 11, 2018 6:24 am

Yeah its cool , what i wanted
JenniferT
 
Posts: 1
Joined: Wed Nov 29, 2017 9:27 am


Return to General

Who is online

Users browsing this forum: No registered users and 5 guests