I'm having trouble with a Pi-Zero rebooting after a varying number of hours. It's not crashing, it's rebooting, so there must be a reason for its madness.
I see this in syslog minutes or hours before a reboot:
rtc rtc0: __rtc_set_alarm: err=-22
I'm not trying to set an alarm or to use the rtc to wakeup or reboot the system. But SOMETHING is telling the system to reboot because I always find this in syslog:
shutdown: shutting down for system reboot
with varying process ID's, none of which I can ever track down because I only learn about them after the system reboots. I never see those PID's while the system is running, so they must only be present for an instant.
I checked how the rtc is setup (I can read the hwclock ok) but something is clearly wrong because I see this very strange path:
/sys/class/rtc/rtc0/device/rtc/<endless copies of rtc0/subsystem/>
I may be causing this because I have this line in /etc/init.d/rc.local:
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
I thought I needed it for every boot, but maybe not. How do I fix it ? I tried to remove the repeating path, but it won't let me. Could it be causing the reboots ?
Update: I found a similar problem with two gpio's that I defined using /sys/class/gpio. Something is causing endless nesting of /sys/class definitions for rtc and gpio. I'm only running the statement once that defines them, and if I reboot without that statment, the entire repeating chain is gone, which is good. Otherwise, each /sys/class/rtc or gpio subdirectory repeats everything so there's a huge maze of definitions.
I'm running Raspian 4.9.40+ #1022 (prior to System-D, apparently sys-v init), and a DS-3231 clock chip, which is a DS-1307 compatible device.
Thank you in advance.