1

No matter how I launch a shutdown (shutdown, shutdown -h now, nohup shutdown -h now, etc) my Raspberry always reboot after 40-50 seconds from the command (apparently, as soon as the poweroff cycle is ended).

I need an affordable way to shutdown the device before cutting power, as I am using it headless.

This is a Raspi 3b+ running Bookworm

uname -a
Linux pab 6.6.31+rpt-rpi-v7 #1 SMP Raspbian 1:6.6.31-1+rpt1 (2024-05-29) armv7l GNU/Linux

EDIT:

This is an excerpt from syslog, after the poweroff command was issued at 12:01:

Aug 19 12:01:48 pab systemd[1]: Stopping minissdpd.service - keep memory of all UPnP devices that announced themselves...
Aug 19 12:01:48 pab mopidy[799]: INFO     [MainThread] mopidy.commands GLib mainloop got SIGTERM. Exiting...
Aug 19 12:01:48 pab listen_for_AC.sh[1012]: Stopping listen_for_AC.py
Aug 19 12:01:48 pab systemd[1]: Stopping mopidy.service - Mopidy music server...
Aug 19 12:01:48 pab mopidy[799]: INFO     [MainThread] mopidy.commands Stopping Mopidy frontends
Aug 19 12:01:48 pab systemd[1]: Starting plymouth-poweroff.service - Show Plymouth Power Off Screen...
Aug 19 12:01:48 pab mopidy[799]: INFO     [IrisFrontend-14 (_actor_loop)] mopidy_iris.core Stopping Iris
Aug 19 12:01:59 pab kernel: [    0.000000] Booting Linux on physical CPU 0x0
Aug 19 12:01:59 pab kernel: [    0.000000] Linux version 6.6.31+rpt-rpi-v7 ([email protected]) (gcc-12 (Raspbian 12.2.0-14+rpi1) 12.2.0, GNU ld (GNU Binutils for Raspbian) 2.40) #1 SMP Raspbian 1:6.6.31-1+rpt1 (2024-05-29)

As you can see, at 12:01:59 the system is rebooting, and it runs until full reboot.

2 Answers 2

1

Your question has been around for a while it seems. Here's one from 2012 that had the same issue. The solutions/explanations offered in answers to that question included power issues, SD card corruption, and power cable. Perhaps worth reviewing...

However, today's systems have additional potential causes due to the added software complexity! TBH, I do not know what's actually causing your problem; I have only a few suggestions you might try:

  1. If you read man shutdown, you see several things:

    A.) under 'DESCRIPTION':

    "shutdown may be used to halt, power off, or reboot the machine."

    IOW, there are options under shutdown for also re-booting the system.

    B.) the shutdown options are a bit ambiguous IMHO; ref -h vs -H

    IOW, perhaps -H is the option to use w/ shutdown instead of -h?

    C.) shutdown may be run under systemd on your system (sorry, I use the Lite version of RPi OS, so I cannot confirm this on my system)

    IOW, there may be a systemd unit that is taking your commands, and altering them.

  2. CONSEQUENTLY, you may wish to try the following:

    A.) Check to see if an alias has been created in one of the "dot" files in /home/<whoever>.

    B.) Try using sudo shutdown -H (capital "H", not lower-case "h")

    C.) Check for the presence of a systemd unit/service that handles shutdown on your system. If you find it, it can be disabled - or modified.

  3. If all of that fails, you can try using what I use on my Lite systems; the following command has never resulted in a reboot on any system I've used:

    sudo halt
    
  4. Final Note: There is no ("standard/off-the-shelf") Raspberry Pi model that actually disconnects or removes power from the system following any halt shutdown or poweroff command; the system itself remains powered. No processing takes place, but the system remains under power. The only way to remove power on a RPi is to "pull the plug".

    While the system is powered, but not processing, there are methods by which the system may be re-started/re-booted - for example. And depending upon which device tree overlays are added to config.txt, it's possible to achieve this effect through a GPIO pin.

    This may be something else to consider, depending upon your system configuration.

0

sudo poweroff SHOULD shutdown after closing all running processes.

This can take ~90 seconds. If it doesn't there is something wrong with your OS.

You can append -f to force recalcitrant processes to halt.

1
  • I have edited the question with an excerpt from syslog. Commented Aug 19 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.