Magic SysRq (Magic System Request) is a kernel hack that enables the kernel to listen to specific key presses and respond by calling a specific kernel function. Magic SysRq is activated via input from the keyboard or a serial line.
Magic SysRq should not be enabled in kernel for production or mission critical systems! Even if Magic SysRq is disabled at boot using for example sysctl, it still leaves /proc/sysrq-trigger open. Not to mention the fact that re-enabling SysRq is as easy as disabling it.
A basic Magic SysRq configuration:
Kernel hacking ---> Generic Kernel Debugging Instruments ---> [*] Magic SysRq key (0x1) Enable magic SysRq key functions by default
The CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE value must always be written in the kernel with hexadecimal (0x) form (not integer numbers).
On amd64 and x86 systems the key combination of Alt+SysRq+<command key> will result in Magic SysRQ invocation. See the following table for some possible options:
|b||Immediately reboot the system without syncing or unmounting the disks.|
|e||Send a SIGTERM to all processes, except for init.|
|f||Calls the oom killer to kill a memory hog process; does not panic if nothing can be killed.|
|s||Attempts to sync all mounted filesystems.|
|u||Attempts to remount all mounted filesystems read-only.|
More information can be found in the official Magic SysRQ Linux Kernel documentation.
Not all keyboards include a SysRq key. Typically Print Screen is the same key.