I have been trying to install a RTC on my raspberry pi 2 (running Raspbian Jessie lite 2015-11-21) and I run into the following problem that puzzles me:
- I set the correct time on the hardware clock and shut down the pi.
- I unplug the ethernet cable so that the pi is off the internet.
I turn on again after about 7/8 minutes and check date and hwclock -r: and here is what I get:
- Date gives me the correct time (and so does /var/log/syslog). --> so the RTC has done its job.
- But hwclock -r gives me the wrong time! So it seems hwclock is overwritten by something at boot, after it has passed the time correctly to the system.
And of course if I reboot a second time, then date becomes wrong.
Anyone has an idea of how to fix this?
Here are the current config files. I started without changing config.txt and hwclock-set, and the result was the same:
sudo nano /boot/config.txt: added at the end:
/lib/udev/hwclock-set: commented out:
#if [ -e /run/systemd/system ] ; then # exit 0 #fi
i2c-bcm2708 i2c-dev rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device sudo hwclock -s