If you are lucky the system stucks but you are able to login from a remote machine by ssh. You can kill the process
kill -9 ... or reboot the system shutdown -r now. Most of the times a jam is caused by one or more processes consuming too many recourses. Symtomps are extreme high CPU usage, high load, high memory usage, a high queue of waiting processes ect. If there are no resources left the kernel might still be running but the system doesn't responed to keystrokes, CTRL+ALT+DEL won't help and login from an other system with ssh is also impossible, as there are no resources left to start a new shell.
In this case sysrq is the magic key if enabled on the system. By the default the magic sysrequest feature is disabled. You can enable all sysrq features by typing:
echo 1 > /proc/sys/kernel/sysrqIf you want to enable this at boottime edit
/etc/sysctl.conf and replace the line
kernel.sysrq=0by
kernel.sysrq=1
The magic sysrq key combination consists of ALT+SYSRQ+key A good combination to safely reboot the system is typing REISUB while holding down ALT+SYSRQ. This will stop all processes, sync the filesystems, unmount the drives and reboot.
The list of all commands:
b - Immediately reboot the system without syncing or unmounting your disks.
c - Perform a system crash by a NULL pointer dereference. A crash dump will be taken if configured.
d - Shows all locks that are held.
e - Send a SIGTERM to all processes, except for init.
f - Call oom_kill to kill a memory hog process.
g - Used by kgdb on ppc and sh platforms.
h - Display help (actually any other key than those listed
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.
l - Shows a stack backtrace for all active CPUs.
m - Dump current memory info to your console.
n - Used to make RT tasks nice-able
o - Shut your system off (if configured and supported).
p - Dump the current registers and flags to your console.
q - Dump per CPU lists of all armed hrtimers and detailed information about all clockevent devices.
r - Turns off keyboard raw mode and sets it to XLATE.
s - Attempt to sync all mounted filesystems.
t - Dump a list of current tasks and their information to your console.
u - Attempt to remount all mounted filesystems read-only.
v - Dumps Voyager SMP processor info to your console.
w - Dumps tasks that are in uninterruptable (blocked) state.
x - Used by xmon interface on ppc/powerpc platforms.
z - Dump the ftrace buffer
0-9 - Sets the console log level, controlling which kernel messages will be printed to your console.
Some security considerations:
Having the magic sysrq enabled on the system is a security risc. Anyone with physical access to the system can bring the system down. Remotely sending break to the system will be interpreted as ALT+SYSRQ.
