1 MAGIC SYSRQ KEY DOCUMENTATION v1.2 2 ------------------------------------ 3 [Sat May 16 01:09:21 EDT 1998] 4 5* What is the magic SysRQ key? 6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7It is a 'magical' key combo you can hit which kernel will respond to 8regardless of whatever else it is doing, unless it is completely locked up. 9 10* How do I enable the magic SysRQ key? 11~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when 13configuring the kernel. This option is only available in 2.1.x or later 14kernels. 15 16* How do I use the magic SysRQ key? 17~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18On x86 - You press the key combo 'ALT-SysRQ-<command key>'. Note - Some 19 (older?) may not have a key labeled 'SysRQ'. The 'SysRQ' key is 20 also known as the 'Print Screen' key. 21 22On SPARC - You press 'ALT-STOP-<command key>', I believe. 23 24On PowerPC - You press 'ALT-Print Screen-<command key>'. 25 26On other - If you know of the key combos for other architectures, please 27 let me know so I can add them to this section. 28 29* What are the 'command' keys? 30~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31'r' - Turns off keyboard raw mode and sets it to XLATE. 32 33'k' - Kills all programs on the current virtual console. 34 35'b' - Will immediately reboot the system without syncing or unmounting 36 your disks. 37 38'o' - Will shut your system off (if configured and supported). 39 40's' - Will attempt to sync all mounted filesystems. 41 42'u' - Will attempt to remount all mounted filesystems read-only. 43 44'p' - Will dump the current registers and flags to your console. 45 46't' - Will dump a list of current tasks and their information to your 47 console. 48 49'm' - Will dump current memory info to your console. 50 51'0'-'9' - Sets the console log level, controlling which kernel messages 52 will be printed to your console. ('0', for example would make 53 it so that only emergency messages like PANICs or OOPSes would 54 make it to your console.) 55 56'e' - Send a SIGTERM to all processes, except for init. 57 58'i' - Send a SIGKILL to all processes, except for init. 59 60'l' - Send a SIGKILL to all processes, INCLUDING init. (Your system 61 will be non-functional after this.) 62 63* Okay, so what can I use them for? 64~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 65Well, un'R'aw is very handy when your X server or a svgalib program crashes. 66 67sa'K' (system attention key) is useful when you want to exit a program 68that will not let you switch consoles. (For example, X or a svgalib program.) 69 70re'B'oot is good when you're unable to shut down. But you should also 'S'ync 71and 'U'mount first. 72 73'S'ync is great when your system is locked up, it allows you to sync your 74disks and will certainly lessen the chance of data loss and fscking. Note 75that the sync hasn't taken place until you see the "OK" and "Done" appear 76on the screen. (If the kernel is really in strife, you may not ever get the 77OK or Done message...) 78 79'U'mount is basically useful in the same ways as 'S'ync. I generally 'S'ync, 80'U'mount, then re'B'oot when my system locks. It's saved me many a fsck. 81Again, the unmount (remount read-only) hasn't taken place until you see the 82"OK" and "Done" message appear on the screen. 83 84The loglevel'0'-'9' is useful when your console is being flooded with 85kernel messages you do not want to see. Setting '0' will prevent all but 86the most urgent kernel messages from reaching your console. (They will 87still be logged if syslogd/klogd are alive, though.) 88 89t'E'rm and k'I'll are useful if you have some sort of runaway process you 90are unable to kill any other way, especially if it's spawning other 91processes. 92 93* Sometimes SysRQ seems to get 'stuck' after using it, what can I do? 94~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 95That happens to me, also. I've found that tapping shift, alt, and control 96on both sides of the keyboard, and hitting an invalid sysrq sequence again 97will fix the problem. (ie, something like alt-sysrq-z). Switching to another 98virtual console (ALT+Fn) and then back again should also help. 99 100* I hit SysRQ, but nothing seems to happen, what's wrong? 101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 102There are some keyboards which do not support 'SysRQ', you can try running 103'showkey -s' and pressing SysRQ or alt-SysRQ to see if it generates any 1040x54 codes. If it doesn't, you may define the magic sysrq sequence to a 105different key. Find the keycode with showkey, and change the define of 106'#define SYSRQ_KEY 0x54' in [/usr/src/linux/]include/asm/keyboard.h to 107the keycode of the key you wish to use, then recompile. Oh, and by the way, 108you exit 'showkey' by not typing anything for ten seconds. 109 110* I have more questions, who can I ask? 111~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112You may feel free to send email to myrdraal@deathsdoor.com, and I will 113respond as soon as possible. If that email address does not work, use 114myrdraal@jackalz.dyn.ml.org. 115 -Myrdraal 116

