I have a PiFace RTC clock that I have setup on archlinux ARM on a rpi2.

I have edited /boot/config.txt to add


I have added i2c-dev and i2c:mcp7941x modules to /etc/modules-load.d/raspberrypi.conf

But the kernel does not seem to use it to update the system clock. I can see the rtc driver is loaded:

 kernel: rtc-ds1307 1-006f: registered as rtc0

and there is a /dev/rtc0 device. But the kernel does not update system clock with it.

It is only systemd-timesyncd that restores time from saved timestamp. And then later on sync time with SNTP if I have a network available.

The idea of having a RTC is to have correct time if there is no network.

But this is not used at all.

How do I tell the kernel to use the RTC to update system clock at boot ? or only if there is no internet connection ?

  • Enable RTC in Device Tree – Milliways Aug 25 '18 at 19:11
  • Could you be more specific ? – solsTiCe Aug 25 '18 at 20:53

Well, an ugly hack is to make a hwclock.service like this

Description=Synchronize system clock from RTC

ExecStart=/usr/bin/hwclock --hctosys


And enable it with

sudo systemctl enable hwclock.service

It will step on systemd-timesyncd's toes when network is available but should do no harm.

In the hope of a better solution ?

Another way to do it, is to use an udev rule that trigger hwclock.

in /etc/udev/rules.d/i2c-rtc.rules

KERNEL=="rtc0", SUBSYSTEM=="rtc", SUBSYSTEMS=="i2c", TAG+="systemd", ENV{SYSTEMD_WANTS}="hwclock.service"

in /etc/systemd/system/hwclock.service

Description=Synchronize system clock from RTC

ExecStart=/usr/bin/hwclock --hctosys --utc
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.