13

Hi my Raspberry Pi has frozen, and I am not sure what is the safest way to restart/shut down without doing any damage.

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
James Adams
  • 131
  • 1
  • 1
  • 3
  • 4
    If it's frozen there's not much you can do, just unplug it and cross your fingers. You won't damage the hardware that way, you just risk filesystem corruption. – goldilocks Mar 02 '15 at 20:58
  • If it is frozen you should be okay just to pull the plug. You are advised not to do that if the Pi is writing the SD card but that won't be happening if it's frozen. – joan Mar 02 '15 at 20:59
  • OK thanks. I was a bit worried as I am only new to it. – James Adams Mar 02 '15 at 21:02
  • @goldilocks Can you post this comment as an answer? For completely 100% frozen this is the only solution (and it is nice to hear that filesystem corruption is the worst possible consequence). – reducing activity Jan 30 '19 at 12:28

7 Answers7

11

You did not indicate of you where in the terminal or GUI and what you were doing when the Raspberry Pi became frozen. Sometimes the GUI or even the terminal can freeze, but the operating system is still running, fully functional.

What you can do is to switch to a "backup" text terminal. Pressing CTRL+ALT+F1 will switch to one of the "backup" terminals offered by the kernel.

You can then log in and kill the offending process that cause the GUI or terminal to freeze. In your case you can then do sudo halt or sudo reboot to restart if that is all you want to do.

I opt for this when my Pi freezes an I don't want to risk filesystem corruption.

Be aware, if the CPU is being used 100% the switch may take more than a minute to take effect.

To switch back to the GUI, press CTRL+ALT+F7.

Piotr Kula
  • 17,307
  • 6
  • 65
  • 104
Ryan Louw
  • 199
  • 4
  • 8
    +1 But please do not call them "backup terminals". There are at least 6 virtual terminals that run a login getty and are accessible with F1-6. – goldilocks Mar 03 '15 at 14:37
4

What worked for me was holding down Alt+PrtSc while pressing R, E, I, S, B.

  • R = Switch keyboard from raw mode
  • E = Send the SIGTERM signal to all processes except init
  • I = Send the SIGKILL signal to all processes except init
  • S = Sync all mounted filesystems
  • B = Immediately reboot the system, without unmounting or syncing filesystems

https://en.wikipedia.org/wiki/Magic_SysRq_key

3

If your rpi is hanging then pulling the plug is the only option left. Keep top running so next time it hangs you can see if something ate all your ram or cpu. watch dmesg may show you a crash

user1133275
  • 2,216
  • 15
  • 31
3

If you have access to SSH or Putty try logging in via this method. If you need to recover your local console I recommend rebooting the pi by calling sudo reboot from the SSH/Putty console. For reference the default user in Raspbian is pi and the default password is raspberry. SSH is on by default.

bradnak
  • 31
  • 3
3

YES! I saved my little RPI3 from a CPR.

With me - the CPU is running above %90, I have attached: HDMI, 1 keybaord and 1 USB wireless mouse. I also have SSH opened from my Mac and a 1-hour software install.

My RPI randomly paused, I think the time on the screen moved. I saved it by removing all USB and the HDMI devices. I blew air into the board and chip.

I then tried to see if I could get a light response from the board. I attempted to connect to VNC and SSH simultaneously. Each time I attempted to SSH in terminal, the green light would flicker.

I gave it a few minutes (about 5) and it began to process slow, then back to normal speeds.

BEST of luck!

  • Disconnecting HDMI seemed to help in my case as well. I don't believe blowing into it is necessary and may not be a good idea as moisture and electronics don't mix. Even if it is a matter of overheating, allowing it to cool on its own is safer than blowing into it. Thanks for the help though. Good thinking. – iyrin Jun 12 '18 at 05:43
2

If you are using the gui, you can try control-alt-backspace. depending on your OS and how you set it up this will restart the x-server and return you to the login prompt, giving you the option to login or reboot/shutdown.

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
0

This is too long for a comment, but it was a combination of answers that worked for me. I'm guessing that the processing graphics was taking up a lot of cpu, although I could not confirm since it was frozen. In my case, three browser tabs were open with one containing a higher quality youtube video. In my experience, freezing on the Raspberry Pi 3 is usually a case of having too many browser tabs open with one or more containing youtube videos. It froze so much that the clock did not update and the cursor would not move.

Solution:

Turn off the monitor and remove the HDMI cable, then reinsert the HDMI and turn the monitor on again. This got things moving, but very slowly. Switch to another virtual terminal by holding CTRL+ALT+F1. I have experienced this on other lxde environments as well where you need to hold these keys to succeed in switching the virtual terminal.

In my case, once focus was changed to another virtual terminal, it was still sluggish at first, but after logging in and running htop, whatever process was hogging the cpu was no longer doing so. This is likely because the GUI environment did not need much processing since it was not running in the current virtual terminal. This gave it enough of a break that switching back to tty7 CTRL+ALT+F7 where the GUI desktop is running allowed the environment to continue functioning as normal.

iyrin
  • 101
  • 2