Posts: 4
Joined: Wed Jul 22, 2015 12:21 pm

broken package hwclock

Fri Aug 14, 2015 4:45 pm


i have added a hwclock to my pi and almost got it to work.
there is one tiny issue and that has to do with the startup script /etc/init.d/

the way it is created makes it impossible for the start code to do its thing resulting in the hw clock never being restored properly at reboot.

the problem is with this section of the start script:

Code: Select all

if [ -d /run/udev ] || [ -d /dev/.udev ]; then
 return 0
commenting out those 3 lines makes it work as it should.
i don't understand why the reminder of the start script is supposed to be skipped if udev is present.

comments about my findings? perhaps the package needs fixing?

FYI to get the hw clock working i did something like this:
edit /boot/config.txt and add:¨
this made the modules needed load at boot
then remove fake-hwclock and cleanup leftovers
then enable from util-linux

User avatar
Posts: 3586
Joined: Tue Oct 11, 2011 8:38 pm

Re: broken package hwclock

Fri Aug 14, 2015 5:37 pm

You are certainly correct that the Raspbian userspace does not make proper use of an RTC, even after it is has been correctly enabled in the kernel using a dtoverlay.

The relevant udev files are /lib/udev/rules.d/85-hwclock.rules and /lib/udev/hwclock-set. These assume the kernel will already have initialised the system clock from the RTC, and they merely adjust it back to UTC if the RTC is set for localtime.

This appears to be an upstream Debian problem. I believe that the hwclock handling requires the RTC driver be compiled into the kernel (not as a module) and CONFIG_RTC_HCTOSYS set. It therefore fails on any platform, like the Pi, where the RTC driver cannot be determined at kernel compile time.

I have not determined what the best long term fix for this would be, but commenting out those udev tests is somewhat effective as long as apt-get does not update the file.

Return to “Raspberry Pi OS”