怎样使用sysrq
来源:互联网 发布:linux打包文件夹 编辑:程序博客网 时间:2024/05/17 22:40
* What is the magic SysRq key?
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.
* How do I enable the magic SysRq key?
You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when configuring the kernel. When running a kernel with SysRq compiled in, /proc/sys/kernel/sysrq controls the functions allowed to be invoked via the SysRq key. By default the file contains 1 which means that every possible SysRq request is allowed (in older versions SysRq was disabled by default, and you were required to specifically enable it at run-time but this is not the case any more).
/proc/sys/kernel/sysrq
Here is the list of possible values in /proc/sys/kernel/sysrq:
0 - disable sysrq completely
1 - enable all functions of sysrq
You can set the value in the file by the following command: echo "number" >/proc/sys/kernel/sysrqNote that the value of /proc/sys/kernel/sysrq influences only the invocation via a keyboar/proc/sysrq-trigger.d.
/proc/sysrq-trigger.
On all - write a character to /proc/sysrq-trigger. e.g.:echo t > /proc/sysrq-trigger
* What are the 'command' keys?
'b' - Will immediately reboot the system without syncing or unmounting your disks.
'c' - Will perform a system crash by a NULL pointer dereference. A crashdump will be taken if configured.'d' - Shows all locks that are held.
'e' - Send a SIGTERM to all processes, except for init.
'f' - Will call oom_kill to kill a memory hog process.
'g' - Used by kgdb (kernel debugger)
'h' - Will display help (actually any other key than those listed here will display help. but 'h' is easy to remember :-)
'i' - Send a SIGKILL to all processes, except for init.
'j' - Forcibly "Just thaw it" - filesystems frozen by the FIFREEZE ioctl.
'k' - Secure Access Key (SAK) Kills all programs on the current virtual console. NOTE: See important comments below in SAK section.
'l' - Shows a stack backtrace for all active CPUs.
'm' - Will dump current memory info to your console.
'n' - Used to make RT tasks nice-able
'o' - Will shut your system off (if configured and supported).
'p' - Will dump the current registers and flags to your console.
'q' - Will dump per CPU lists of all armed hrtimers (but NOT regular timer_list timers) and detailed information about all
clockevent devices.
'r' - Turns off keyboard raw mode and sets it to XLATE.
's' - Will attempt to sync all mounted filesystems.
't' - Will dump a list of current tasks and their information to your console.
'u' - Will attempt to remount all mounted filesystems read-only.
'v' - Forcefully restores framebuffer console 'v' - Causes ETM buffer dump [ARM-specific]
'w' - Dumps tasks that are in uninterruptable (blocked) state.
'x' - Used by xmon interface on ppc/powerpc platforms.
'y' - Show global CPU Registers [SPARC-64 specific]
'z' - Dump the ftrace buffer
'0'-'9' - Sets the console log level, controlling which kernel messages will be printed to your console. ('0', for example would make
.
* I hit SysRq, but nothing seems to happen, what's wrong?
There are some keyboards that produce a different keycode for SysRq than the pre-defined value of 99 (see KEY_SYSRQ in include/linux/input.h), or which don't have a SysRq key at all. In these cases, run 'showkey -s' to find an appropriate scancode sequence, and use 'setkeycodes <sequence> 99' to map this sequence to the usual SysRq code (e.g., 'setkeycodes e05b 99'). It's probably best to put this command in a boot script. Oh, and by the way, you exit 'showkey' by not typing anything for ten seconds.
我们可以不用记住那些讨厌的组合键,而使用sysrq-trigger的方法:通过help命令得到支持的command,再选择使用
All commands
SysRq : HELP :
loglevel(0-9)
reBoot
Crash
terminate-all-tasks(E)
memory-full-oom-kill(F)
kill-all-tasks(I)
thaw-filesystems(J)
saK show-backtrace-all-active-cpus(L)
show-memory-usage(M)
nice-all-RT-tasks(N)
powerOff
show-registers(P)
show-all-timers(Q)
unRaw
Sync
show-task-states(T)
Unmount
show-blocked-tasks(W)
为什么使用 sysrq?
虽然,我们可以从crash dump中得到许多信息,但这需要dump 文件,当然可以手动dump.
最后是在系统运行的时候得到更多信息:
1.串口信息;
2.sysrq;
3.ftrace.
4.?
能通过sysrq得到当前处在可运行状态的进程吗?
- 怎样使用sysrq
- 使用SysRq
- sysrq-trigger的使用
- SysRq使用详解
- Sysrq
- sysrq
- Linux中SysRq的使用
- 使用 SysRq 查看系统信息
- 如何使用sysrq及添加自己的sysrq
- 在Fedora 14中使用SysRq键
- 键盘的 SysRq按键使用详解
- 使用reboot命令失败的处理方法(/proc/sys/kernel/sysrq 和 /proc/sysrq-trigger )
- 使用 SysRq 键安全重启挂起的 Linux
- sysrq.txt
- 怎样使用?
- vncserver+ sed+ sysrq
- /proc/sysrq-trigger说明
- /proc/sysrq-trigger使用说明
- MapReduce编程System.out.println输出在哪里可找到?
- javascript中IE浏览器不支持NEW DATE()带参数的解决方法 (转)
- ffmpeg教程
- SGU 271Book Pile(模拟 deque+stack)
- linux好的博客
- 怎样使用sysrq
- vim 环境配置
- _("Neither Pillow nor PIL could be imported: %s") % err django.core.exceptions.ImproperlyConfigu
- 进程的深入理解与分析
- UNIX环境高级编程 chat1 从标准输入中读取命令执行
- eclipse常用的快捷键
- 关于产品的一些思考——七牛云存储
- sublime text 2 小窗口并列显示
- mapreduce调试查询System.out的结果