Sometimes your Linux machine will lock up, it just happens. But before you reach for the reset button try and use the magic SysRq key combination to try and perform a safe reboot.
The magic SysRq (system request) allows you to access a low-level message system in the kernel. This will work as long as there hasn’t been a kernel panic, and can provide you with a way of rescuing the system. To access the key combination you need to hold
Alt + SysRq + Command where command is the specific feature you want to access. The SysRq key is usually the same as the Print Screen key. A table of the available commands are found at the table at the bottom of this article, but the main one you will probably use is:
Alt + SysRq + REISUB (slowly type the R E I S U B)
This will kill all process except init, sync the mounted file systems, remount the file systems in read-only mode and reboot the system. There are a few ways to try and remember the order REISUB, the one I use is “Reboot Even If System Utterly Broken”, you could also just remember that it is ‘BUSIER’ backwards. Hope it comes in handy, here is the table of all the commands:
|Set the console log level, i.e. change the type of kernel messages that are output
|0 through 9
|Immediately reboot the system, without unmounting or syncing filesystems
|Perform a system crash. A crashdump will be taken if it is configured.
|Display all currently held Locks
|Send the SIGTERM signal to all processes except init (PID 1)
|When using Kernel Mode Setting, provides emergency support for switching back to the kernel’s framebuffer console. If the in-kernel debugger ‘kdb’ is present, enter the debugger.
|Output a terse help document to the console. Any other key which doesn’t have an action should also do this.
|Send the SIGKILL signal to all processes except init
|Forcibly “Just thaw it” – filesystems frozen by the FIFREEZE ioctl.
|Kill all processes on the current virtual console
|Shows a stack backtrace for all active CPUs
|Output current memory information to the console
|Reset the nice level of all high-priority and real-time tasks
|Shut off the system
|Output the current registers and flags to the console
|Display all active high-resolution timers and clock sources.
|Switch the keyboard from raw mode, the mode used by programs such as X11 and svgalib
|Sync all mounted filesystems
|Output a list of current tasks and their information to the console
|Remount all mounted filesystems in read-only mode
|Forcefully restores framebuffer console, except for ARM processors, where this key causes ETM buffer dump
|Display list of blocked tasks
|Show global CPU registers (SPARC-64 specific)
|Dump the ftrace buffer