36 votes

Shutting down the Pi safely without SSH or a monitor?

Magic SysRq Key This should get you started. The magic SysRq key is a key combination understood by the Linux kernel, which allows the user to perform various low-level commands regardless of the ...
Hydraxan14's user avatar
  • 1,836
32 votes
Accepted

Shutting down the Pi safely without SSH or a monitor?

Although it should be regarded as a last resort since it does increase the risk of filesystem corruption, unplugging the cord is usually okay if the green ACT light is not flashing intensely. By ...
goldilocks's user avatar
  • 58.7k
30 votes
Accepted

Is it okay to just pull the plug?

I don't make a habit of unplugging the pi in the sense of eschewing shutting them down properly except when I've lost networking on a headless pi, in which case I am usually too lazy to plug in a ...
goldilocks's user avatar
  • 58.7k
12 votes

Raspberry Pi 3 model B "dtoverlay=gpio-shutdown"

The "documentation" for gpio-shutdown is Name: gpio-shutdown Info: Initiates a shutdown when GPIO pin changes. The given GPIO pin is configured as an input key that generates KEY_POWER ...
Milliways's user avatar
  • 59.6k
7 votes
Accepted

Raspberry Pi 3 Freezes

I/O failure is a common cause of this; processes suffering from such are stuck in an uninterruptible sleep. If this is widespread and includes critical processes, the entire system will stutter and ...
goldilocks's user avatar
  • 58.7k
6 votes

How to keep watchdog timer running during reboot/shutdown

sudo poweroff means shut down and stay off. The watchdog does not, and should not, intercept this. The behaviour you are experiencing is correct and you should not expect the watchdog to restart a ...
nickcrabtree's user avatar
6 votes

Run a script at shutdown on Raspbian

If you are using systemd, just put your script to /lib/systemd/system-shutdown/ as described here and here. EDIT: If it's not working try this one: Create a systemd service: /etc/systemd/system/...
jake's user avatar
  • 1,347
6 votes
Accepted

What happens to the GPIO voltage after shutdown?

The Pi has 3 "components" the CPU, GPIO and Video Core which are relatively independent. Even when the Pi is shutdown the Video Core continues to run, and the GPIO pins retain their state; ...
Milliways's user avatar
  • 59.6k
6 votes
Accepted

Does Raspberry Pi 4 consume considerable amount of power in soft-off state?

The Pi has 3 "components" the CPU, GPIO and Video Core which are relatively independent. Even when the Pi is shutdown the Video Core continues to run, and the GPIO pins retain their state; ...
Milliways's user avatar
  • 59.6k
6 votes

Raspberry Pi 4 B GPIO boot and shutdown button(s)

I see two separate questions re use and configuration of "power buttons" to halt and boot an RPi 4: Question 1: Is the shutdown initiated with connecting the GPIO3 pin and the GND pin ...
Seamus's user avatar
  • 21.8k
5 votes
Accepted

Prevent wake-from-halt

Yes there is a way to disable GPIO3 (physical pin 5) pulled low to boot. In /boot/config.txt add the line dtoverlay=gpio-poweroff See the documentation for overlays in /boot/overlays/README. The ...
Philip Cook's user avatar
5 votes

How to keep watchdog timer running during reboot/shutdown

I didn't wade through all the rant you linked, but the author doesn't seem to understand the watchdog. There is a BCM hardware watchdog; If you want to start the hardware watchdog include dtparam=...
Milliways's user avatar
  • 59.6k
5 votes

What happens to the GPIO voltage after shutdown?

This howchoo post shows how to connect an LED to show the status of the Pi. The LED is steady on when the Pi is running, and off after shutdown. Briefly: Add this line to /boot/config.txt, and ...
Peter bill's user avatar
5 votes
Accepted

Shutdown from C program

Call system(): #include <stdlib.h> ... system("sudo shutdown now");
Joep's user avatar
  • 111
4 votes
Accepted

Should I shut down RP3 using command line or GUI?

Shutting down the Pi properly can be done using either the GUI or the command-line. All the GUI does is invoke the proper command-line command. Different OS's and different users will have different ...
tlhIngan's user avatar
  • 3,372
4 votes

Shutdown Pi via USB stick

I see two ways of doing this: 1. UUID Based You could write a very simple script, possibly in Python, to check for a specific UUID to be plugged into the Pi. The script would then shutdown the Pi. ...
Patrick Cook's user avatar
  • 6,365
4 votes
Accepted

Turning RPi off safely and elegantly

Something worth noting from the manual page for halt, poweroff and reboot is: These are legacy commands available for compatibility only. At the bottom is a "see also" for systemctl, and man ...
goldilocks's user avatar
  • 58.7k
4 votes

Raspberry Pi 3 model B "dtoverlay=gpio-shutdown"

Go to this link and search for 'gpio-shutdown', it will give you steps to implement the gpio shutdown: https://www.stderr.nl/Blog/Hardware/RaspberryPi/PowerButton.html
Mamorsolo's user avatar
4 votes

How to make Raspberry shutdown when internet/lan disconnected

EDIT 2: You can use a dhcpcd exit hook script. The script is called on each dhcpcd event and checks the reason for calling dhcpcd and the related interface. Create the script /etc/dhcpcd.exit-hook (...
palto's user avatar
  • 151
4 votes

How to make Raspberry shutdown when internet/lan disconnected

use post-up and post-down hook options in network script /etc/network/interfaces , you can create a simple script for shutdown, lets call it sd.sh executing which system will be shut down, so your ...
Deepkamal's user avatar
  • 141
4 votes
Accepted

Automatic shutdown of Pi based on timer

You've made a couple of mistakes, all par for the course. Let's step through this, get it working, and hopefully learn one other trick to help you help yourself in the future: First, the "other ...
Seamus's user avatar
  • 21.8k
4 votes

Is there a way to unplug the Raspberry pi safely without shutting down

If you don't need to write to your filesystem (i.e. SD Card) regularly, this can be done pretty safely by making the file-system read only. This will ensure there never are any writes occurring to the ...
Araho's user avatar
  • 141
4 votes
Accepted

Is there a way to unplug the Raspberry pi safely without shutting down

You seem to be looking for something like https://juice4halt.com/ : a UPS which provides a GPIO signal to the RPi which can be used to initiate shutdown when the external power is lost. Now, sudo ...
Dmitry Grigoryev's user avatar
4 votes

How to add Capacitors to Raspberry Pi

You need the supercaps to be in parallel to the power supply, not in series. However, before fixing your circuit, mind a few things: If you simply connect your supercaps between 0 and 5V, most power ...
Dmitry Grigoryev's user avatar
4 votes

Raspberry Pi 4 B GPIO boot and shutdown button(s)

The operation is explained in /boot/overlays/README It is quite safe, I have it on all my Pi in case I need to shutdown a headless Pi (or one without keyboard attached), although my Pi are rarely ...
Milliways's user avatar
  • 59.6k
3 votes

Shutting down the Pi safely without SSH or a monitor?

No need to guess; just plug in the keyboard and type this and hit enter: sudo shutdown -h now The shutdown command needs a root privilege to execute.
Lightness Races in Orbit's user avatar
3 votes

Code/Cron to detect low power and safe shutdown on GPIO

You can not rely on the 5V from the UBEC - because the UBEC is designed to maintain voltage even when input fails. It is not difficult to detect. Dry cells are effectively exhausted when the voltage ...
Milliways's user avatar
  • 59.6k
3 votes

Code/Cron to detect low power and safe shutdown on GPIO

MCP3008 can do that. You can build module for mesure voltage. Here is some links what can help you: https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/...
Ivijan Stefan Stipić's user avatar
3 votes

How do i turn off the raspberry pi 3

Do not pull the plug until the OS has shutdown completely. If you do, you risk corrupting the SD card and then needing to reformat and re-install. You can power down from the menu, once the green ...
tlhIngan's user avatar
  • 3,372
3 votes

Raspberry Pi 3 model B "dtoverlay=gpio-shutdown"

I do not know what version of the firmware you are using, but for any current version on the RPi 3B, or RPi 4B this two-step procedure by @MatthijsKooijman still works. It may also work on other ...
Seamus's user avatar
  • 21.8k

Only top scored, non community-wiki answers of a minimum length are eligible