Safe Reboot of Locked Linux Machine

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 b
Perform a system crash. A crashdump will be taken if it is configured. c
Display all currently held Locks d
Send the SIGTERM signal to all processes except init (PID 1) e
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. g
Output a terse help document to the console. Any other key which doesn’t have an action should also do this. h
Send the SIGKILL signal to all processes except init i
Forcibly “Just thaw it” – filesystems frozen by the FIFREEZE ioctl. j
Kill all processes on the current virtual console k
Shows a stack backtrace for all active CPUs l
Output current memory information to the console m
Reset the nice level of all high-priority and real-time tasks n
Shut off the system o
Output the current registers and flags to the console p
Display all active high-resolution timers and clock sources. q
Switch the keyboard from raw mode, the mode used by programs such as X11 and svgalib r
Sync all mounted filesystems s
Output a list of current tasks and their information to the console t
Remount all mounted filesystems in read-only mode u
Forcefully restores framebuffer console, except for ARM processors, where this key causes ETM buffer dump v
Display list of blocked tasks w
Show global CPU registers (SPARC-64 specific) y
Dump the ftrace buffer z

Related post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.