Preventing Damage After System Lockup

Hardware failures can lock up your system; no matter how stable the Linux kernel is. This topic finds a solution to the issues such as the cursor doesn’t even move in X, Ctrl + Alt + Backspace or Ctrl + Alt + F1 and the likes don’t seem to work anymore, maybe even Num Lock doesn’t turn on and off when you press the button. Rebooting is the only option if you ever encounter this issue. This piece of work describes a way to reboot your system that will do things like terminating all processes, syncing the remounting the disks, in order to prevent damage as much as possible. This can save you from data loss.

Initial Requirements
You will need to have a kernel with ‘Magic SysRq key (CONFIG_MAGIC_SYSRQ)’ enabled. The easiest way to check this at run time is :

# ls /proc/sys/kernel/sysrq

If the above command returns the name and location of the file “/proc/sys/kernel/sysrq”, you will most probably be able to use this solution. If it returns something like “cannot access /proc/sys/kernel/sysrq: No such file or directory”, you’ll have to get yourself a kernel with ‘Magic SysRq key’ support or this solution won’t work.

If you can’t find a SysRq key on your keyboard, try using the Print Screen key.

Solution:

When your system is locked up, the kernel might be in trouble that it won’t respond. In order to get rid off this situation use the following keyboard shortcut keys; wait at least 4-5 seconds while pressing it.

Alt + SysRq + r –>switch to “Raw” keyboard input
Alt + SysRq + s –>”Sync” mounted filesystems
Alt + SysRq + e –>send the “tErm” signal to all running processes
Alt + SysRq + i –> send the “kill” signal to all running processes
Alt + SysRq + u –>”remount” all mounted filesystems read-only
Alt + SysRq + b –>”reboot” the computer

After the last one the computer should reboot. If it doesn’t, the kernel probably was unable to accept the commands ie, it doesn’t support ‘Magic SysRq key’ or it is locked up totally. In that case, you’ll just have to reset the computer and hope you won’t lose anything.

Leave a Reply