How to use Magic SysRq keys to reboot frozen machines

Q I've been trying to understand the Magic SysRq keys. I foolishly assumed it would be easy and that I would be able to do it without any problems. All it involved was pressing four keys at once. Still, I failed miserably and didn't get it to work. I'm using a Dell XPS M1719 laptop and whenever I press Fn+Alt+SysR+B the screenshot dialog box pops up (SysRq shares a button with Print Screen). I looked at the keyboard preferences but couldn't find a keyboard model for the XPS. Can you let me know how to fix this. It's making me a bit depressed not being able to follow the simplest instructions in the world.

A SysRq and Print Screen are often the same key, even on desktop keyboards, so you may not need the Fn key. On most laptop keyboards, features that need the Fn key are highlighted in a different colour. If this is not the case on your keyboard, try the standard three keys of Alt, SysRq and the command you want to use. Speaking of commands, B (reBoot) is probably not the best key to use for testing. S (Sync) is harmless, and you can see the results if you switch to a virtual console with Ctrl+Alt+F1. Press Alt+SysrRq+S and you should see

SysRq : Emergency Sync

printed to the console, and written to the system log. If nothing happens, the most likely explanation is that your kernel has been built without the necessary options, but first check whether the file /proc/sysrq-trigger exists. If it does, you do have Magic Key support in your kernel. That file is an alternate interface to the same functions, you can send the commands by writing to this file, which is useful for remote sessions

echo s >/proc/sysrq-trigger

If the file does not exist, your kernel certainly does not have the option CONFIG_MAGIC_SYSRQ set. This is more likely than your keyboard being unable to send the correct command, after all, the same key provides a common function for Windows. In this case, the only reasonable option is to recompile the kernel yourself. This is not a difficult task (see the Quick Reference box on p111 for instructions). The other possibility is that your kernel has Magic Key support but it is disabled on your system. Run, as root, sysctl kernel.sysrq. If this returns a value of zero, edit /etc/sysctl.conf to change this for the next boot, and change it with

sysctl kernel.sysrq=1

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar