OpenMarine

Full Version: Safe shutdown function takes 1-2 minutes to shutdown
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I attached the official 7" touchscreen to test the backlight feature (which works perfectly fine), and now i'm more aware of what's happening when i shutdown the Rpi.

I noticed than upon safe shutdown, it takes for 1 to 2 minutes displaying "shutdown.service".

It's normal that it takes that much to shut down?

I don't have any program opened, just the usual services running (SignalK, Pypilot..)
1 to 2 minutes to shut down a Raspberry Pi is excessive. Do expect something like 20..30 seconds.
Maybe you can experiment with different (faster) SD cards, or hook up an SSD if you have an RPi4.
Yup I know that's far too much, but the weird thing is that this only happens since I have the MacArthur HAT, no sure if that makes any sense.
Hello, I've had this on occasions and then the next time I've shut down its been a couple of seconds. I'm guessing its just waiting for a process to stop and that's quite difficult to predict based on what the system is/or has been doing.

Mine has always shut down, but the time to shut down isn't always the same. Also interested at what others have found.
Do you also experienced this AFTER plugin the MacArthur HAT?
Also, if i'm not mistaken from your videos you use and SDD instead of SD card, so that would rule out the SD issue.

In my case the delay is always that heavy (at least 1 minute).

Ok, now this is interesting:

I uninstalled Maiana becasuse (don't ask me why) i had "that feeling". Well, is not magic, is the fact that i don't have the antenna plugged in, and I imaged it was possible that the service was polling every 1 minute or so to find the device.

The result: now it shuts down in less than 15 seconds.

So I guess there is something with the Maiana service preventing the plymouth-shoutdown.service (and plymouth-reboot.service) to actually do its thing.

It would be great if the Maiana service would detect that and stop polling (if possible).
AFAIK there is a timeout of 2 minutes to force a shutdown when any app resists to be killed. The important thing is that there is always a shutdown at the end.

MigGat, maybe is the signal k server who is resisting in your case and maybe this issue could be related to this one: https://forum.openmarine.net/showthread....1#pid25531

Could you install and configure MAIANA, run openplotter-maiana app and check if the signal k server is consuming around 35% of the CPU before sending the shutdown order?
(Sailoog I posted this in the wrong thread indeed Big Grin , but already deleted it)

I installed Maiana again and the error the ~1.5 minutes shutdown time is back.

Using htop I can see that the only process that eventually spikes above 10% is avnav_server.py.

SignalK server stays somewhere between 4%-7%, which i think is quite normal. Average CPU usage is below 15%
Is there an easy way to bring the power out to an LED see we can see if the device has shut down ... even better woudl be an LED that came on as the shutdown process started and went out as the device *really* powered down ... I could mount this in the display bezel to give me confidence it was niot staying on and flattening the batteries ...
(2023-05-22, 10:39 PM)rszemeti Wrote: [ -> ]Is there an easy way to bring the power out to an LED see we can see if the device has shut down ... even better woudl be an LED that came on as the shutdown process started and went out as the device *really* powered down ... I could mount this in the display bezel to give me confidence it was niot staying on and flattening the batteries ...

Well worth asking an AI nowadays. 

Perplexity AI suggested this, might need a loop or trigger the python from node red every couple of seconds. >>

"on a raspberry pi computer is there a way to retrofit an LED to a gpio pin to check if the device has really powered down after a shutdown command"

PERPLEXITY
Yes, it is possible to add an LED to a GPIO pin on a Raspberry Pi computer to check if the device has really powered down after a shutdown command. Here are the steps to do so:
Gather the necessary materials: Raspberry Pi computer, breadboard, LED, resistor (220 ohm), and jumper wires.
Connect the LED to the breadboard. The longer leg of the LED should be connected to a GPIO pin (e.g. GPIO 18) and the shorter leg should be connected to a resistor, which is then connected to ground.
Write a program in Python to control the LED. You can use the RPi.GPIO Python module to control GPIO pins from the Raspberry Pi's GPIO header
1
. Here is an example code:
python
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)

# Turn on the LED
GPIO.output(18, GPIO.HIGH)
time.sleep(1)

# Turn off the LED
GPIO.output(18, GPIO.LOW)

This code will turn on the LED for one second and then turn it off. You can modify this code to suit your needs.
Run the program after shutting down the Raspberry Pi. If the LED turns off, it means that the Raspberry Pi has successfully powered down.
Note: Always make sure that your Raspberry Pi is powered off before connecting or disconnecting any hardware component
Why does that AI make the easy so hard? Smile

You already have the 5V and the 12V leds in the MacArthur HAT. If these leds are hidden by a casing or some panels, you can add a LED + resistor to the 3.3V/GND pins. When the shutdown sequence is complete, it will turn off. You can also use 5V/GND pins or even the 1W connector, see 1W alternative uses in the manual.

EDITED: Actually the Raspberry red LED will also do this job. when the shutdown sequence is complete it will turn off. You should not see any LED on in the Raspberry or the MacArthur HAT.
Pages: 1 2