SysRq
Use
SYSRQ is called the "Magic key combination" and is a debugging tool built into the Linux kernel. As long as the kernel is not fully locked, no matter what the kernel is doing, using these key combinations can collect system operation information including system memory usage, CPU task processing, process running state and so on.
" principle" "Kernel Help document Kernel/documentation/sysrq.txt"
First, the kernel configuration option is to enable the CONFIG_MAGIC_SYSRQ option so that after the system starts, the/proc/sysrq-trigger node is generated for debugging.
Second, the Kernel.sysrq=1 default enable SYSQ feature can be set in/etc/sysctl.conf. It is also possible to dynamically enable SYSRQ functions by writing/PROC/SYS/KERNEL/SYSRQ nodes. Different values are written to enable different functions:
0-disable SysRq completely |
1-enable all functions of SYSRQ |
2-enable control of console logging level |
4-enable Control of keyboard (SAK, Unraw) |
8-enable debugging dumps of processes etc. |
16-enable Sync Command |
32-enable remount read-only |
64-enable signalling of processes (term, kill, Oom-kill) |
128-allow Reboot/poweroff |
256-allow nicing of all RT tasks |
"Instructions for use"
#echo m >/proc/sysrq-trigger Exporting memory allocation information
#echo T >/proc/sysrq-trigger Export Current task status information
#echo p >/proc/sysrq-trigger Export current CPU register and flag bit information
#echo C >/proc/sysrq-trigger generates a null pointer panic event that causes the system to crash
#echo s >/proc/sysrq-trigger sync all mounted file systems instantly
#echo u >/proc/sysrq-trigger instantly re-mount all file systems as read-only
#echo w >/proc/sysrq-trigger dump tasks in uninterruptable blocking state
Summary of Linux kernel debugging methods SysRq