Howchoo / pi-power-button

Scripts useful for the Pi power button
MIT License
305 stars 153 forks source link

Not working under Bookworm? #37

Open JoeClueless opened 6 months ago

JoeClueless commented 6 months ago

This worked fine for me for several years, but now - after a fresh installation of BOOKWORM, it fail. The Shutdown-Functionality does not work any longer. I made a fresh Bookworm installation from scratch on a Pi Zero W, installed the howchoo-script (installation script finished with success message), powered the PI Zero of via SSH 'sudo poweroff'. I can restart the Pi with the button, but I can't power it off... Any idea for me noob?

Manu-pardo commented 5 months ago

I also experienced the same issue, it only works to power on the board, but not to shut it down (with bookworm) on a Pi 3B V1.2

winslowj commented 5 months ago

I can’t get to shutdown or wake pi 4b

bassamanator commented 5 months ago

It's not working under RPi OS Bookworm (cat /etc/debian_version...12.6).

I caught the exception, Failed to add edge detection. The RPi.GPIO package has not changed in ages, so I can't quite tell what the issue is 😕.

bassamanator commented 5 months ago

This functionality was broken due to a recent linux kernel update. Read about it here.

Solution

You simply need to install rpi-lpgio, which will automatically uninstall rpi-gpio. Source.

sudo apt update && sudo apt install python3-rpi-lgpio

No other changes are necessary, anywhere at all.

jimholmesNZ commented 4 months ago

I installed the rpi-lpgio, do I need to change the listen-for-shutdown.py script to look at rpi-lpgio instead of rpi-gpio? Still not shutting down for me, start up OK but won't shutdown.Cheers Jim.

bassamanator commented 4 months ago

I installed the rpi-lpgio, do I need to change the listen-for-shutdown.py script to look at rpi-lpgio instead of rpi-gpio? Cheers Jim.

No other changes are necessary.

jimholmesNZ commented 4 months ago

Sorry, I didn't see your reply and changed my original comment. I still can't get the shutdown to work after running the sudo apt update && sudo apt install python3-rpi-lgpio command.

bassamanator commented 4 months ago

@jimholmesNZ Have you restarted the service, or rebooted?

jimholmesNZ commented 4 months ago

Yes, I've tried both rebooting and restarting the listener. I'm just about to ditch Bookworm and go back to Bullseye!

bassamanator commented 4 months ago

@jimholmesNZ To downgrade the entire OS for this script unwise, but maybe you have a special use case?

Feel free to install my fork of this script, install it via the instructions (via systemd).

jimholmesNZ commented 4 months ago

Thanks very much, using your fork and following the instruction it now works, it seems that it needs a long press on the switch? Anyway thank you so much, now I just need to work out a command to turn on / off the monitor with Bookworm and I'm just about one. Thanks, Jim.

winslowj commented 4 months ago

I just ground out the pi using the 3v pin. Probably not the best but clearly there’s no good alternative solution for buttons on RPi without hacking into the OS. You’d think after all these years there would be a standard pin added for buttons

bassamanator commented 4 months ago

I just ground out the pi using the 3v pin. Probably not the best but clearly there’s no good alternative solution for buttons on RPi without hacking into the OS. You’d think after all these years there would be a standard pin added for buttons

Not sure what device you're using, but no hacking into the OS is required.

winslowj commented 4 months ago

I just ground out the pi using the 3v pin. Probably not the best but clearly there’s no good alternative solution for buttons on RPi without hacking into the OS. You’d think after all these years there would be a standard pin added for buttons

Not sure what device you're using, but no hacking into the OS is required.

I’d surely prefer not to have to ground out the pi, but nothing I’ve tried here works with RPi 4b bookworm

bassamanator commented 4 months ago

@winslowj What is the issue exactly? There are ground pins btw.