OpenSUSE Linux Rants

OpenSUSE Linux Tips, tricks, how-tos, opinions, and news

My Resume  -  My LinkedIn Profile

September 11, 2007

Reboot a locked Linux box with the Magic SysRq Keys

by @ 3:25 pm. Filed under General Linux, How-To

I ran across this rather informative Wikipedia page about something called the “Magic SysRq key.” It is a mechanism built into the kernel that allows you to reboot a machine without having to hold in the Power button. Because your disks don’t have a chance to sync, and other complications that can occur with such a shutdown, this is a great alternative. If your system becomes completely unresponsive, this is a forceful way to reboot the machine, but more graceful than the 6-second power button charade.

First, to see if your machine is set up to do this, run this command:

cat /proc/sys/kernel/sysrq

If you see a “0”, it is disabled. If you see a “1”, it is enabled.

To enable it, do this:

echo 1 > /proc/sys/kernel/sysrq

To disable it, do this:

echo 0 > /proc/sys/kernel/sysrq

Once you have it enabled, you can proceed to perform the operation.

To do this, you will need to hold down the ALT and SYSRQ (or PRINT SCREEN) buttons while typing the following key sequence:

(taken from wikipedia)

Alt + SysRq + R – takes the keyboard out of raw mode.

Alt + SysRq + E – terminates all processes (except init).

Alt + SysRq + I – kills all processes (except init).

Alt + SysRq + S – synchronizes the disk.

Alt + SysRq + U – remounts all filesystems read-only.

Alt + SysRq + B – reboots the machine.

One thing to keep in mind, however, is that you will want to give the machine time to complete each command, especially time between the last three commands. You want to make sure that the machine syncs the disk before remounting the filesystems, and you want to wait a moment to reboot the machine after it performs the remount.

4 Responses to “Reboot a locked Linux box with the Magic SysRq Keys”

  1. Joseph Says:

    The nicest thing about SysRq is Alt + SysRq + K, which kills all prgrams at the current virtual console.

    Sadly, we still lack a real SAK. 🙁

  2. Stop Reading Here! » Gracefully Reboot an Unresponsive Machine Says:

    […] Scott’s Article Wikipedia Entry […]

  3. links for 2007-09-12 « Stand on the shoulders of giants Says:

    […] OpenSUSE Linux Rants » Blog Archive » Reboot a locked Linux box with the Magic SysRq Keys – suse linux opensuse (tags: sysrq keys how to) […]

  4. Stefan Reisinger » Gesperrtes oder abgestürztes Linuxsystem ohne Datenverlust mit Hilfe der [S-Abf]-Taste neu starten Says:

    […] habe kürzlich im suseblog gelesen, wie man ein abgestürztes Linuxsystem sicher und ohne Datenverlust neu starten kann. […]

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:


SUSE Resources

search blog:


March 2022
« Feb    

60 queries. 0.603 seconds