Le potato shutdown without any reason - journalctl shows sudo shutdown

Hello,

my Le potato is shutting down almost everyday by itself and when I look at journalctl there is always a shutdown command by sudo after a entropy starvation=0 message.

I’m running the last raspbian image (Bookworm) downloaded at the Libre website on the Le Potato and running the raspbian in a Raspberry PI 4. It only happens on the Le Potato. I’ve changed the power supply to a 3A 5 Volts and didn’t change anything. As the shutdown is showing up on the log without more info, I don’t know what is calling it.

In one of the entries it shown a crontab job, but my sudo crontab has nothing there.

Please look at the pictures attached for the log messages.

I don’t have a clue of what is causing it.

It is running for only a month and it is happening almost everyday.


Per the timestamps, this has nothing to do with entropy starvation. You have some software installed that is running shutdown in a cron job. This is not part of the base image.

You were right, it was my script for the shutdown button. It is working well in my 2 Raspberry PIs for years and is unstable on the Libre Board.

Here is the script:
import libregpio as GPIO
import time
import os

set pin GPIOX_4 to be used as an input

pin = GPIO.IN(‘GPIOX_4’)

wait for a rising-edge event. Bias is set to pull-up

value = pin.wait_for_edge(bias=‘pull-up’, edge=‘rising’)

time.sleep(5)
os.system(“sudo shutdown -h now”)

GPIO.cleanup()

The hardware is only a push button to ground. The switch is working well, I’ve tested.
Do I need to add an external pull-up resistor on this?
The libregpio is the correct one to use? I just followed some tutorials from the forum.

I have a Raspberry PI B+ working this way form more than 5 years, never had troubles. Same thing for my Raspberry PI4 that is working for 2 years without shutdown down like the LIbre board.

Thanks for the help

You would write a device tree overlay that binds a GPIO to a gpio-key. You set the emulated key to the power or some other button and then bind that button to shutdown the machine. Using a hacky script is not the right way as is the case with most Raspberry Pi guides in the wild.

A majority of things in the Raspberry Pi ecosystem are done incorrectly. There is hacking and there are proper way of doing things. Functions that belong in kernel should stay in kernel and not be hacked using userspace scripts.

If my script is the wrong way of doing it, why the are a lot of examples here in the forum doing it the way I did?
Also, can you provide an example of the right way of doing it, as all the examples I saw follow they way I did it?
Thanks