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 system's state. It is often used to recover from
freezes, or to reboot a computer without corrupting the filesystem.
Its effect is similar to the ...
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 default the ACT led shows I/O activity on the SD card. If it is off, most likely the system is idle. This is not necessarily true, but killing a system that is ...
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 keyboard, etc.
Generally I always check to make sure the green ACT light is not on at that point; for recent models (or firmware?) this will be off when the SD ...
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 stall -- although from a GUI perspective this may be exaggerated in that it is mostly the GUI that is stalling.
Such processes can be identified with diagnostic ...
The "documentation" for gpio-shutdown is rather obscure.
I have used gpio-shutdown to implement a shutdown button (although I use GPIO5 - pin 29 as I use the default for I²C).
The "documentation" does not explain what happens in another pin is used - it does state "This overlay only handles shutdown".
Pin 5 USED to perform a restart on older Pi - See ...
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 setups as to whether the Pi boots to the GUI or to the command-line. Raspbian defaults to the GUI since it endeavors to be user-friendly for new users not ...
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=watchdog=on in /boot/config.txt
In and of itself this does little, although it should restart the system if not "kicked" regularly. You can write code which opens ...
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 powered-off system.
I don't think this is what you are wanting to do though. If you want to restart the pi. you should use the command sudo reboot instead. And in ...
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 (usually it doesn't exists, otherwise edit it):
if [ "$reason" = NOCARRIER ] && [ "$interface" = eth0 ]
echo "$(date) - eth0 DOWN, will shutdown ...
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 network interfaces script will look like
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
If you are using systemd, just put your script to /lib/systemd/system-shutdown/ as described here and here.
If it's not working try this one:
Create a systemd service: /etc/systemd/system/yourSript.service with following lines:
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 trick": When you run a command from the terminal, your error messages stderr go to the terminal, and you see them immediately. When you run a command as a cron user,...
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 falls to ~1.0V - here 8V. A voltage divider (connected across the battery) which will produce 1.3V when battery falls to 8V connected to a GPIO will go low.
MCP3008 can do that.
You can build module for mesure voltage.
Here is some links what can help you:
What I will do is made one converter what will mesure ...
Yes there is a way to disable GPIO3 (physical pin 5) pulled low to boot.
In /boot/config.txt add the line
See the documentation for overlays in /boot/overlays/README. The entry for gpio-poweroff states:
Info: Drives a GPIO high or low on poweroff (including halt). Enabling
this overlay will prevent ...
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 systemctl has further details regarding the difference between the three things (in context, systemctl halt, systemctl reboot, etc). As Milliways points out in a ...
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.
Add this line to /boot/config.txt, and reboot
Connect the TxD pin (GPIO pin 8) to the positive lead of a 2 or 3 volt LED.
Connect a ground pin (e.g. GPIO pin 6) to a 330 ohm resistor, ...
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 retail their state; only the CPU is not running.
The 3.3V is supplied by separate circuitry and will be present while ever the Pi is connected to a 5V supply.
The best way to reliably ...
Courtesy of @goldilocks and @SlySven it has been confirmed that there is no way to disable the wake-from-halt feature (= Pulling GPIO5 low causes RPi to boot).
The RRC2040 has a builtin feature which allows it to act as an I2C master in order to send updates to Smart Chargers and an SMBus Host. This subsequently also causes the RPi to boot if the I2C SCLK ...
You would have to experiment but I believe the simplest and least intrusive method would be to disable serial boot messages and monitor the UART TX line (GPIO 14, pin 8).
This line will go high during boot and go low at power down.
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.
It would go something like this:
if "123456789-1234-1234-1234-1234567890" in os.popen("ls /dev/disk/by-uuid/").read():
Not sure if I've observed this just plain not work before, although calling shutdown in an ssh session may often cause it to hang on your side. I'll hazard a guess and say the reason you have this problem with wifi but not ethernet is because of the bit of latency involved. TBH that's a dubious, unsatisfying guess, but I don't think we need a complete ...
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 activity light goes off permanently and your display is off, you can safely assume the OS is done powering down and you can pull the plug. If you fancy the command-...
No; it is not possible without some additional hardware.
When the Pi is shutdown, it enters a HALT state. However there is still code running, which is why the Pin5 can reboot. See https://raspberrypi.stackexchange.com/a/19754/8697 for some explanation.
If the Pi has never been booted Pin5 will do nothing.
A better solution for ...
A non root user is not allowed to shutdown.
Be sure you really use sudo to execute the command.
sudo shutdown -h now
Note that the shutdown command is in /sbin/shutdown, which is only in the root user's PATH, which is why the command appears not to exist for regular users.
As @Millways says, soft shutdown is simply shutting down the operating system before powering off.
Depending on what your Pi is used for, you may be able to automate the shutdown. I have this script which is called from /etc/rc.local
# Control script for Raspberry Pi
# Runs at boot-up, as root
# Run the ...
For other people looking for this issue - solution in my case was hidden in video configuration file. When using the HDMI to VGA converter boot configuration file (/boot/config.txt) must contain proper entry of hdmi_group and hdmi_mode in order to work with every startup.