Editing Magic SysRq Key

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
'''Alt-SysRq-*''' is a "magical" key combo you can hit which the kernel will respond to
+
It is a 'magical' key combo you can hit which the kernel will respond to
 
regardless of whatever else it is doing, unless it is completely locked up.
 
regardless of whatever else it is doing, unless it is completely locked up.
  
== /proc/sys/kernel/sysrq ==
+
When running a kernel with SysRq compiled in (that's right in openVZ case),
 
+
<tt>/proc/sys/kernel/sysrq</tt> controls the functions allowed to be invoked via the SysRq key.
When running a kernel with SysRq compiled in (as in all binary kernels released by OpenVZ),
 
<tt>/proc/sys/kernel/sysrq</tt> file controls the functions allowed to be invoked via the SysRq key.
 
 
Here is the list of possible values in <tt>/proc/sys/kernel/sysrq</tt>:<br>
 
Here is the list of possible values in <tt>/proc/sys/kernel/sysrq</tt>:<br>
  
{| class="wikitable"
+
<tt>0</tt> - disable sysrq completely<br>
! 0
+
<tt>1</tt> - enable all functions of sysrq<br>
| disable sysrq completely
+
><tt>1</tt> - bitmask of allowed sysrq functions<br>
|-
 
! 1
 
| enable all functions of sysrq
 
|-
 
! >1
 
| bitmask of allowed sysrq functions
 
|}
 
  
 
You can set the value in the file by the following command:
 
You can set the value in the file by the following command:
Line 24: Line 15:
 
</pre>
 
</pre>
  
== Available keys ==
+
To use SysRq feature you should press the key combo 'ALT-SysRq-<command key>'.
 
 
To use SysRq feature you should press the key combo 'Alt-SysRq-<command key>'.
 
 
The 'SysRq' key is also known as the 'Print Screen' key. Other way, if you don't have
 
The 'SysRq' key is also known as the 'Print Screen' key. Other way, if you don't have
 
physical access to the node, only ssh, you can do
 
physical access to the node, only ssh, you can do
Line 35: Line 24:
 
Here is the list of most useful command keys:
 
Here is the list of most useful command keys:
  
{| class="wikitable"
+
<tt>b</tt> - Will immediately reboot the system without syncing or unmounting
! b
+
your disks.<br>
| Will immediately re'''b'''oot the system without syncing or unmounting your disks
+
<tt>s</tt> - Will attempt to sync all mounted filesystems.<br>
|-
+
<tt>u</tt> - Will attempt to remount all mounted filesystems read-only.<br>
! s
+
<tt>p</tt> - Will dump the current registers and flags to your console.<br>
| Will attempt to '''s'''ync all mounted filesystems
+
<tt>t</tt> - Will dump a list of current tasks and their information to your
|-
+
console.<br>
! u
+
<tt>m</tt> - Will dump current memory info to your console.<br>
| Will attempt to remo'''u'''nt all mounted filesystems read-only
+
<tt>0</tt>-<tt>9</tt> - Sets the console log level, controlling which kernel messages
|-
+
will be printed to your console. ('0', for example would make
! p
+
it so that only emergency messages like PANICs or OOPSes would
| Will dum'''p''' the current registers and flags to your console
+
make it to your console.)<br>
|-
+
<tt>f</tt> - Will call oom_kill to kill a memory hog process<br>
! t
+
<tt>e</tt> - Send a SIGTERM to all processes, except for init.<br>
| Will dump a list of current '''t'''asks and their information to your console
+
<tt>i</tt> - Send a SIGKILL to all processes, except for init.<br>
|-
+
<tt>h</tt> - Will display help<br>
! m
 
| Will dump current '''m'''emory info to your console
 
|-
 
! 0...9
 
| Sets the console log level, controlling which kernel messages will be printed to your console. ('''0''', for example would make it so that only emergency messages like PANICs or OOPSes would make it to your console)
 
|-
 
! f
 
| Will call oom_kill to kill a memory hog process
 
|-
 
! e
 
| Send a SIGT'''E'''RM to all processes, except for init
 
|-
 
! i
 
| Send a SIGK'''I'''LL to all processes, except for init
 
|-
 
! h
 
| Will display '''h'''elp
 
|}
 
 
 
All output will appear on the console and/or in <tt>/var/log/messages</tt> file. In some cases you need to [[Remote console setup|set up a remote console]] in order to catch all the messages you need.
 
  
== Example ==
+
All ouptput will be on console or in <tt>/var/log/messages</tt>
  
Suppose for some strange reason your system is working slow and you want to
+
Example of using SysRq. Suppose for some strange reason your system is working slow and you want to
 
ask developers what happens, then don't forget to press
 
ask developers what happens, then don't forget to press
<tt>Alt-SysRq-p</tt> and <tt>Alt-SysRq-t</tt> several times,
+
<tt>alt-sysrq-p</tt> and <tt>alt-sysrq-t</tt> several times,
and attach <tt>/var/log/messages</tt> to a request.
+
and attach <tt>/var/log/messages</tt> to request.
  
 
[[Category: Troubleshooting]]
 
[[Category: Troubleshooting]]
[[Category: Kernel]]
 

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)