Using the Magic SysRq Key to Rescue a Linux System

It could be a freeze, a crash, or simply completely or near unresponsiveness that drives you to shut off your server and start it back up cold. That, however, is never ideal. The ideal way to recover a system is to bring it back to complete functionality or simply restart it gracefully. Enter Magic SysRq, a set of keyboard shortcuts that can fix a wide range of Linux issues.

Before you run into any problems, you should check to see if you have Magic SysRq Key enabled. Run this command:

# cat /proc/sys/kernel/sysrq

A “0” means it is disabled, while a “1” means it is enabled.

You can enable it with this command:

# echo “1” > /proc/sys/kernel/sysrq

What is the SysRq key?

Some keyboards may not even have a key labeled SysRq, but most Linux distributions will assign the functionality to the PrtScrn key even if it is not also labeled as SysRq. Used on its own, it will usually function as a print screen key. Used in combination with modifiers like Alt along with various key combinations, you can have a powerful tool for fixing Linux issues that normally cannot be fixed.