Hello,
Fresh install of the Raspberry Pi OS 64bits on a Rpi 4B using the latest image (i.e. 2023-12-05-raspios-bookworm-arm64.img.xz).
Install latest Witty Pi's software. Reboot the Rpi => no problem.
Update packages using "sudo apt update" and "sudo apt upgrade". Reboot the Rpi => shutdown immediately after startup.
Here is the wittypi.log content (packages upgrade between 22:31:47 and 22:43:44, Witty Pi removed at 22:44:07):
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.14) is started. [xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 4 Model B Rev 1.1 [xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system [xxxx-xx-xx xx:xx:xx] Writing RTC time to system... [2024-03-14 22:29:17] Done :-) [2024-03-14 22:29:17] Firmware ID: 0x26 [2024-03-14 22:29:17] Firmware Revison: 0x01 [2024-03-14 22:29:17] Current Vout=5.18V, Iout=0.49A [2024-03-14 22:29:17] System starts up because the button is clicked. [2024-03-14 22:29:22] Send out the SYS_UP signal via GPIO-17 pin. [2024-03-14 22:29:22] File "schedule.wpi" not found, skip running schedule script. [2024-03-14 22:29:22] Pending for incoming shutdown command... [2024-03-14 22:31:05] Internet detected, apply network time to system and Witty Pi... [2024-03-14 22:31:05] Applying network time to system... [2024-03-14 22:31:10] Done :-) [2024-03-14 22:31:10] Writing system time to RTC... <2024-03-14 22:31:10> Done :-) [xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.14) is started. [xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 4 Model B Rev 1.1 [xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system [xxxx-xx-xx xx:xx:xx] Writing RTC time to system... [2024-03-14 22:31:42] Done :-) [2024-03-14 22:31:42] Firmware ID: 0x26 [2024-03-14 22:31:42] Firmware Revison: 0x01 [2024-03-14 22:31:42] Current Vout=5.19V, Iout=0.79A [2024-03-14 22:31:42] System starts up because the button is clicked. [2024-03-14 22:31:47] Send out the SYS_UP signal via GPIO-17 pin. [2024-03-14 22:31:47] File "schedule.wpi" not found, skip running schedule script. [2024-03-14 22:31:47] Pending for incoming shutdown command... [xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.14) is started. [xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 4 Model B Rev 1.1 [xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system [xxxx-xx-xx xx:xx:xx] Writing RTC time to system... [2024-03-14 22:43:44] Done :-) [2024-03-14 22:43:44] Firmware ID: 0x26 [2024-03-14 22:43:44] Firmware Revison: 0x01 [2024-03-14 22:43:44] Current Vout=5.11V, Iout=0.79A [2024-03-14 22:43:44] System starts up because the button is clicked. [2024-03-14 22:43:49] Send out the SYS_UP signal via GPIO-17 pin. [2024-03-14 22:43:49] File "schedule.wpi" not found, skip running schedule script. [2024-03-14 22:43:49] Pending for incoming shutdown command... [2024-03-14 22:43:50] Shutting down system because button is clicked or GPIO-4 is pulled down. [2024-03-14 22:43:50] Halting all processes and then shutdown Raspberry Pi... [xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.14) is started. [xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 4 Model B Rev 1.1 [xxxx-xx-xx xx:xx:xx] Witty Pi is not detected, retry in one second... [xxxx-xx-xx xx:xx:xx] Witty Pi is not detected, retry in one second... [xxxx-xx-xx xx:xx:xx] Witty Pi is not detected, retry in one second... [xxxx-xx-xx xx:xx:xx] Witty Pi is not detected, retry in one second... [xxxx-xx-xx xx:xx:xx] Witty Pi is not detected, retry in one second... [xxxx-xx-xx xx:xx:xx] Witty Pi is not connected, skip I2C communications... <2024-03-14 22:44:07> Witty Pi is not connected, skip schedule script... <2024-03-14 22:44:07> Send out the SYS_UP signal via GPIO-17 pin. <2024-03-14 22:44:07> Pending for incoming shutdown command... <2024-03-14 22:44:09> I2C read 0x01 0x08 11 failed (result=), retrying 1 ... <2024-03-14 22:44:10> I2C read 0x01 0x08 11 failed (result=), retrying 2 ... <2024-03-14 22:44:11> I2C read 0x01 0x08 11 failed (result=), retrying 3 ... <2024-03-14 22:44:11> I2C read 0x01 0x08 11 failed (result=), and no more retry. <2024-03-14 22:44:11> Unknown/incorrect shutdown reason: I2C read 0x01 0x08 11 failed (result=), and no more retry. <2024-03-14 22:44:12> I2C read 0x01 0x08 55 failed (result=), retrying 1 ... <2024-03-14 22:44:13> I2C read 0x01 0x08 55 failed (result=), retrying 2 ... <2024-03-14 22:44:14> I2C read 0x01 0x08 55 failed (result=), retrying 3 ... <2024-03-14 22:44:14> I2C read 0x01 0x08 55 failed (result=), and no more retry.
Log of the packages upgrade attached below.
Note: I2C and Serial Port activated. 1-Wire desactivated.
Thank you
@dynalogic This is the bug that was fixed back in January by upgrading the Witty Pi script to version 4.14.
@msage I just posted the modified doWfi function that is in the gpio-util.sh script. I hope that someone at uugear will take time to look into this and maybe release an official fix.
@jeromebriot thanks for providing the detailed information, and we will try to reproduce it today.
Once we reproduce it, it will be fixed very quickly.
This has fixed my issue on my pi 4 with my witty pi 4. My wittypi 3 mini on my pi zero 2 was waaayyyy harder. Even with the witty pi physically removed the wittypi service was still shutting the pi down as soon as it booted. I had to be super quick on the ssh and login at the right time then run "sudo systemctl disable wittypi", I managed it on my 4th or 5th attempt (this could be a big problem depending on how many people use it). I don't think this will effect my schedules, but I will report back in 24 - 48 hours
Just found this in the comments on another site: "When they updated to the 6.6.20 kernel, they also killed the current methods of GPIO control. RPI.GPIO no longer works, nor do the Python libraries. All deprecated. Yet the pi foundation did t mention it, nor provide a workaround" would explain the issues we're seeing 🙁
@jeromebriot Thank you for providing a workaround. It is nicely done, and I think our implementation is no better than yours 😉
The whole "gpio-util.sh" is actually a workaround for the absence of WiringPi, and we are still hoping one day we can switch back to the real WiringPi. Thanks to the open-source community, we already see the light on the horizon. Unfortunately it is still not the right time to switch back, because WiringPi is also suffering this issue caused by the new kernel.
At the moment we think the workaround suggested by @jeromebriot is best solution. By using gpiozero (which depends on lgpio I think), the "wait for interrupt" function is no longer affected by the lack of sysfs.
The fixing has been included in V4.15.
The only drawback to use zerogpio, is that it doesn't support multiple programs to access the same GPIO. This usually should not cause problem though.
For users who gets stuck by this issue (can not enter the system because it keeps shutting down), you may use another SD card to boot your Pi and use an SD card reader to connect the previous SD card to the system, then you can rename or remove the wittyPi directory to avoid the unexpected shutdown.
@jeromebriot I've just done another round of updates and my schedules aren't working again. Are you using schedules at all? If so are yours still working? Thanks
@msage No issue with schedules for me. Except with the DST offset that occured last weekend in my country…