Using AltSysRq : The last resort before hard reboot on Linux February 14, 2011Posted by Tournas Dimitrios in Linux.
Linux is without doubt one of the most stable operating system . I always hack kernel parameters via the terminal ( just for learning purposes) . But sometimes , it can go unresponsive , and the most obvious reaction is the well known ” Ctl + Alt + Del ” combination .
Using system requests can be useful to diagnose the problem , they are activated by special key-combinations . By default system requests are disabled (for security reasons) , but passing the proper parameter to the kernel , they can be enabled . When activated , anyone at the console can execute these system requests without being logged into the system and without entering additional authentication information . So , this “state ” should only be enabled to diagnose problems with the system and when the box is in a secure location or monitored by physical presence of an administrator . To enable system request functionality , just pass the value “1” (one) to the kernel :
echo 1 > /proc/sys/kernel/sysrq or
sysctl -w kernel.sysrq=1
Passing values to the /proc/sys virtual filesystem with the echo command takes effect immediately ,but temporarily until the next reboot of the computer, read my previous article .
As the system request functionality is enabled , use the key combination “Alt- SysRq -hotkey ” .Most modern keyboards have the SysRq key labeled , others are using the PringScreen key for this function . Alternatively go to console mode “Ctrl -Alt -F1 ” , “Ctrl -Alt -F2 ” ….
The table below list the available<hotkey> keys for executing system requests :
|-h||Display all hot-keys for reference|
|-e||Terminate all proccesses except init with a SIGTERM signal|
|-l (el)||Kill all processes including init (this will log-out ) like Ctrl -Alt-Backspase|
|-o||Shut down now|
|-t||Display current task list to the console|
|-m||Display current memory information|
|0-9||Set what type of messages will be displayed on the console . If set to 0 only kernel panic . The higher the number the more messages are printed|
||Perform a Kexec reboot so a crash dump can be taken
The packages Kdump and kexec must be installed for this functionality
|-u||Remount all file systems as RO if posible|
|-s||Sync filesystems . This should be used before reboot to minimize data loss|
|-k||Kill all programs on the current virtual console|