How to reboot a frozen Linux box with REISUB

Upon the unlikely situation of a frozen Linux system that’s not responding to the Ctrl-Alt-Delete, it can still be restarted more safely than by pushing the power button, which is usually the last step. Sometimes we don’t have physical access to the server though.

Nevertheless, if you need to take control and gracefully restart a completely “frozen” Linux box, you’ll be happy to know that there is hope. Hold down the ALT+SysRq (which is the Print Screen key) key combination. While holding down ALT+SysRq, press R-E-I-S-U-B and watch your system reboot gracefully (e.g., no corrupted file systems). Here’s what R-E-I-S-U-B does while you’re holding down ALT+SysRq …

R: Switch the keyboard from raw mode to XLATE mode
E: Send the SIGTERM signal to all processes except init
I: Send the SIGKILL signal to all processes except init
S: Sync all mounted filesystems
U: Remount all mounted filesystems in read-only mode
B: Immediately reboot the system, without unmounting partitions or syncing

Note that it would only work if you have the SysRq subsystem enabled on your Linux system. This can be easily checked with:

# cat  /proc/sys/kernel/sysrq

A returning value of zero means disabled. In order to enable it just type:

# echo 1 > /proc/sys/kernel/sysrq

Or make this change permanent:

# echo "kernel.sysrq = 1" >> /etc/sysctl.conf 
# sysctl -p
kernel.sysrq = 1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s