You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have installed according to instructions, but the Raspberry does not shut down after pressing the button.
Tried to shorten the button pins. No reaction.
shutdown-press-simple.py
Raspberry Pi 3+
2022-09-22-raspios-bullseye-armhf-lite
~ $ ls -l
total 4
-rwxr-xr-x 1 root root 121 Jan 28 11:15 shutdown-press-simple.py
pi@aqua:~ $ python shutdown-press-simple.py
Failed to set wall message, ignoring: Interactive authentication required.
Failed to power off system via logind: Interactive authentication required.
Failed to open initctl fifo: Permission denied
Failed to talk to init daemon.
What could it be?...
sudo python shutdown-press-simple.py
... did the "trick". - Which tells us it is a permissions problem. Must have created the file with sudo in front.
Just changing to create the script without sudo first, did not solve the problem entirely.
Here what works (for me):
´´´
pi@aqua:~ $ ls -l
total 4
-rwxr-xr-x 1 pi pi 124 Jan 28 13:30 shutdown-press-simple.py
´´´
And for me it needs to have "sudo shotdown now" as command for shutting down.
´´´
#!/usr/bin/env python3
from gpiozero import Button
import os
Button(21).wait_for_press()
os.system("sudo shutdown now")
´´´
The text was updated successfully, but these errors were encountered:
I have installed according to instructions, but the Raspberry does not shut down after pressing the button.
Tried to shorten the button pins. No reaction.
shutdown-press-simple.py
Raspberry Pi 3+
2022-09-22-raspios-bullseye-armhf-lite
What could it be?...
... did the "trick". - Which tells us it is a permissions problem. Must have created the file with sudo in front.
Just changing to create the script without sudo first, did not solve the problem entirely.
Here what works (for me):
´´´
pi@aqua:~ $ ls -l
total 4
-rwxr-xr-x 1 pi pi 124 Jan 28 13:30 shutdown-press-simple.py
´´´
And for me it needs to have "sudo shotdown now" as command for shutting down.
´´´
#!/usr/bin/env python3
from gpiozero import Button
import os
Button(21).wait_for_press()
os.system("sudo shutdown now")
´´´
The text was updated successfully, but these errors were encountered: