Table of Contents

Linux - Kernel - SysRq Key

SysRq Key – The Magic Key To Control Linux.

Linux does crash. Not often, but it happens.

When an application refuses to obey, but if everything fails, the last solution is using the supreme power on Linux: the magic SysRq key.

By using this key with a combination of “Alt” and another letter, you will be able to make your computer respond no matter what.


How To Activate The Magic Key

The magic key is super handy. But first, you have to activate this functionality if it is not already done.

To check:

cat /proc/sys/kernel/sysrq

If it returns a 1, the Magic Key is working.

If it is a 0, you will need to activate it.

In most cases, if you want to activate it temporarily, you can try:

sudo echo "1" > /proc/sys/kernel/sysrq

If this does not work try:

sudo sysctl kernel.sysrq=1

Note that this will be only temporary.

If you want the Magic Key to work even after a reboot, the best way is to edit the file “/etc/sysctl.conf”, so that the line

/etc/sysctl.conf
kernel.sysrq = 0

becomes

/etc/sysctl.conf
kernel.sysrq = 1

Useful Key Combinations

Magic SysRq key is to combine of the “Alt” key and another letter in order to trigger a particular function, even if your computer seems frozen.

This System Request key is usually sharing its location with the “Print Scrn” key at the top right of your keyboard.

The effect of the combination depends on which letter key is used.


Example - X server is frozen

If your X server is frozen and you cannot access any virtual console, using “Alt + SysRq + r” should take the keyboard away from the X server and let you perform “Ctrl + Alt + F1” in order to get to a terminal and kill the appropriate processes.

If you do not have the patience to do that, “Alt + SysRq + k” will kill everything in the same way as “Ctrl + Alt + Backspace” (but more violently).

If nothing responds at all, and the only way is to reboot your computer, the classical combo is “reisub” for “Raising Elephant Is So Utterly Boring”, or just remember the opposite of “busier“. Use each letter of this anagram with the magic key in order to: