If you know what this is and just need a reminder of the key combination, here you go: ALT + SysRq + REISUB.
The longer version…
It’s very rare that a Linux system crashes to the point of being completely locked up. When it seems to happen, it’s usually not the kernel that crashed but something else that is preventing user input, typically your desktop environment. Most times you should be able to jump to a terminal by pressing CTRL + ALT + Fx (with Fx being one of the function keys on your keyboard) to try to kill whatever process is causing the problem. Another option would be to kill and restart your desktop environment via CTRL + ALT + Backspace, though some distributions have turned that off by default.
When none of this works and people find themselves facing a locked up system, we tend to go for the hardcore solution: the reset button. This may have unintended consequences, though, since processes that were writing data to disk may be interrupted, leaving said data in an inconsistent state. This is an oversimplification of the problem and fortunately, most filesystems nowadays are mostly resistent to this kind of problem but it’s still not recommended. Pretty much like you “have to” unmount an external USB drive before unplugging it.
Fortunately, there’s a better way: magic SysRq key to the rescue!
This key provides access to low-level functions directly in the Linux kernel, including the ability to kill processes, write any buffered data to disk, unmount filesystems, and reboot the machine.
In order to do this, you press the ALT + SysRq keys in combination with a second key on the keyboard for each action you want to take. You may wany yo give it a second between keystrokes, especially when it comes to steps that handle writing data to disk or remounting filesystems.
For rebooting a frozen system, the most common way is the REISUB combination:
- R: Switch the keyboard from raw mode to XLATE mode
- E: Send the SIGTERM signal to all processes except init (PID 1)
- I: Send the SIGKILL signal to all processes except init
- S: Sync all mounted filesystems
- U: Remount all mounted filesystems in read-only mode
- B: Immediately reboot the system, without unmounting or syncing filesystems
You can go straight to ALT + SysRq + B but that won’t be much different from doing a hard reset. Instead, you probably want to hit each key in the given order.
Also, if you want to shutdown the system instead of rebooting it, just hit O instead of B as the final step.
That’s it! No more hard resets. Plus, you have a cool new trick to impress your friends.