Import changeset
[linux-flexiantxendom0-3.2.10.git] / Documentation / sysrq.txt
1
2                       MAGIC SYSRQ KEY DOCUMENTATION v1.32
3                      ------------------------------------
4                         [Sat Apr  8 22:15:03 CEST 2000]
5
6 *  What is the magic SysRQ key?
7 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 It is a 'magical' key combo you can hit which kernel will respond to
9 regardless of whatever else it is doing, unless it is completely locked up.
10
11 *  How do I enable the magic SysRQ key?
12 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when
14 configuring the kernel. This option is only available in 2.1.x or later
15 kernels. Once you boot the new kernel, you need to enable it manually 
16 using following command:
17
18          echo "1" > /proc/sys/kernel/sysrq
19
20 *  How do I use the magic SysRQ key?
21 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 On x86   - You press the key combo 'ALT-SysRQ-<command key>'. Note - Some
23            (older?) may not have a key labeled 'SysRQ'. The 'SysRQ' key is
24            also known as the 'Print Screen' key.
25
26 On SPARC - You press 'ALT-STOP-<command key>', I believe.
27
28 On the serial console (PC style standard serial ports only) -
29            You send a BREAK, then within 5 seconds a command key. Sending
30            BREAK twice is interpreted as a normal BREAK.
31
32 On other - If you know of the key combos for other architectures, please
33            let me know so I can add them to this section. 
34
35 *  What are the 'command' keys?
36 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 'r'     - Turns off keyboard raw mode and sets it to XLATE.
38
39 'k'     - Secure Access Key (SAK) Kills all programs on the current virtual 
40           console. NOTE: See important comments below in SAK section.
41
42 'b'     - Will immediately reboot the system without syncing or unmounting
43           your disks.
44
45 'o'     - Will shut your system off (if configured and supported).
46
47 's'     - Will attempt to sync all mounted filesystems.
48
49 'u'     - Will attempt to remount all mounted filesystems read-only.
50
51 'p'     - Will dump the current registers and flags to your console.
52
53 't'     - Will dump a list of current tasks and their information to your
54           console.
55
56 'm'     - Will dump current memory info to your console.
57
58 '0'-'9' - Sets the console log level, controlling which kernel messages
59           will be printed to your console. ('0', for example would make
60           it so that only emergency messages like PANICs or OOPSes would
61           make it to your console.)
62
63 'e'     - Send a SIGTERM to all processes, except for init.
64
65 'i'     - Send a SIGKILL to all processes, except for init.
66
67 'l'     - Send a SIGKILL to all processes, INCLUDING init. (Your system
68           will be non-functional after this.)
69
70 'h'     - Will display help ( actually any other key than those listed
71           above will display help. but 'h' is easy to remember :-)
72
73 *  Okay, so what can I use them for?
74 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75 Well, un'R'aw is very handy when your X server or a svgalib program crashes.
76
77 sa'K' (Secure Access Key) is useful when you want to be sure there are no
78 trojan program is running at console and which could grab your password
79 when you would try to login. It will kill all programs on given console
80 and thus letting you make sure that the login prompt you see is actually
81 the one from init, not some trojan program.
82 IMPORTANT:In its true form it is not a true SAK like the one in   :IMPORTANT
83 IMPORTATN:c2 compliant systems, and it should be mistook as such. :IMPORTANT
84         It seems other find it useful as (System Attention Key) which is
85 useful when you want to exit a program that will not let you switch consoles.
86 (For example, X or a svgalib program.)
87
88 re'B'oot is good when you're unable to shut down. But you should also 'S'ync
89 and 'U'mount first.
90
91 'S'ync is great when your system is locked up, it allows you to sync your
92 disks and will certainly lessen the chance of data loss and fscking. Note
93 that the sync hasn't taken place until you see the "OK" and "Done" appear 
94 on the screen. (If the kernel is really in strife, you may not ever get the
95 OK or Done message...)
96
97 'U'mount is basically useful in the same ways as 'S'ync. I generally 'S'ync,
98 'U'mount, then re'B'oot when my system locks. It's saved me many a fsck.
99 Again, the unmount (remount read-only) hasn't taken place until you see the
100 "OK" and "Done" message appear on the screen.
101
102 The loglevel'0'-'9' is useful when your console is being flooded with
103 kernel messages you do not want to see. Setting '0' will prevent all but
104 the most urgent kernel messages from reaching your console. (They will
105 still be logged if syslogd/klogd are alive, though.)
106
107 t'E'rm and k'I'll are useful if you have some sort of runaway process you
108 are unable to kill any other way, especially if it's spawning other
109 processes.
110
111 *  Sometimes SysRQ seems to get 'stuck' after using it, what can I do?
112 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113 That happens to me, also. I've found that tapping shift, alt, and control
114 on both sides of the keyboard, and hitting an invalid sysrq sequence again
115 will fix the problem. (ie, something like alt-sysrq-z). Switching to another
116 virtual console (ALT+Fn) and then back again should also help.
117
118 *  I hit SysRQ, but nothing seems to happen, what's wrong?
119 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120 There are some keyboards that send different scancodes for SysRQ than the
121 pre-defined 0x54. So if SysRQ doesn't work out of the box for a certain 
122 keyboard, run 'showkey -s' to find out the proper scancode sequence. Then 
123 use 'setkeycodes <sequence> 84' to define this sequence to the usual SysRQ 
124 code (84 is decimal for 0x54). It's probably best to put this command in a
125 boot script. Oh, and by the way, you exit 'showkey' by not typing anything 
126 for ten seconds.
127
128 *  I have more questions, who can I ask?
129 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130 You may feel free to send email to myrdraal@deathsdoor.com, and I will
131 respond as soon as possible. 
132  -Myrdraal
133
134 *  Credits
135 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136 Written by Mydraal <myrdraal@deathsdoor.com>
137 Updated by Adam Sulmicki <adam@cfar.umd.edu>