22

The magic SysRq key does not work on my Ubuntu 16.04 desktop. I imagine it's now disabled by default. My attempts to enable it did not work, and the only thing Google finds is a 2007 forum post from when it was apparently enabled by default.

Can I enable it? If so, how?

[Added the following after the first answer:]

According to https://en.wikipedia.org/wiki/Magic_SysRq_key "In Ubuntu the combination of Alt+SysReq acts as "print screen" command." This is in fact the behaviour I observe on a non-hung system, even after doing sudo sysctl -w kernel.sysrq=1 I get some kind of screen capture on my desktop. Not what I want.

It's not practical to write to /proc/sysrq-trigger from a system that's basically hung, trying to get information to debug the problem.

1
  • Looks like a dup to me too, or more correctly it looks like the answers also answer my question, which is not really the same - I'm not just interested in one specific non-working sysrq option. I'll try the suggestions there, and see whether they still work; it's possible that additional changes to Ubuntu have made them out of date. (The question dates to 2013.) May 5, 2017 at 3:48

1 Answer 1

25

To enable sysrq magic keys temporarily:

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

or # sysctl -w kernel.sysrq=1

This enables sysrq magic keys for the current user session. You can disable it again by exchanging 1 with 0 in the above commands. Or go back to the standard value of 176.

To enable these changes at boot time one has to create config file in the sysctl.d directory (e.g. /etc/sysctl.d/90-sysrq.conf) with this line:

kernel.sysrq=1

So setting /proc/sys/kernel/sysrq to 1 enables the sysrq magic keys, setting it to 0 disables it.

7
  • 4
    I tried that. Unfortunately this is ubuntu. Quoting wikipedia " In Ubuntu the combination of Alt+SysRequest acts as "print screen" command." And that's what I got May 4, 2017 at 14:56
  • Well, sorry about that. I'm using KDE Neon, which is based on Ubuntu 16.04, and it worked for me.
    – jarleih
    May 4, 2017 at 18:58
  • 1
    Unity strikes again :-( May 5, 2017 at 3:42
  • 4
    @ArlieStephens no you can, just edit /etc/sysctl.d/10-magic-sysrq.conf to change at the value you wish. Read more carefully wikipedia ;-)
    – tmow
    May 4, 2018 at 8:58
  • 2
    Still doesn't work, even after /proc/sys/kernel/sysrq and /etc/sysctl.d/10-magic-sysrq.conf are both set to '1'
    – Coder Guy
    May 1, 2020 at 22:33

Not the answer you're looking for? Browse other questions tagged .