3

when i press the key combination:

altr gr + prtscr + e

my session gets killed, either x or a tty. i discovered this by (repeated) accident... this was not an issue for me before. my current laptop (lenovo x230) has the prtscr key besides the right alt key rather than on the top right section of the keyboard, so i accidentally press them both sometimes.

standard keyboard layout

lenovo x230,t430s keyboard layout


how do i disable it?

thanks!

  • I disagree with Klaus that you "do not want to disable it". It can be helpful for power users, but most users who have a hanging system will just hold the power button for five seconds. For public places like a library it makes sense to disable SysRq as it could be used to bypass restrictions or learn more about the system. If you often press it by accident, then it is very worthwhile to disable SysRq. Please post the edits to your question as answer since they actually form an answer :-) – Lekensteyn Feb 18 '14 at 20:34
  • 1
    thanks for the tips. i've removed the confusing edits, accepted the answer and posted the other part of my question in a new question, for clarity: askubuntu.com/questions/422866/… – rrosa Feb 18 '14 at 23:44
  • @Lekensteyn You're definitely right on the public library and comparable places. SysRq may become a playground for the kids there: So much key combinations to try on a rainy day :D – Klaus-Dieter Warzecha Feb 19 '14 at 6:19
5

if so, how do i disable it?

You don't want to disable the Magic SysRq!

The key combination AltSysRq triggers the Magic SystemRequest and allows to enter combinations of single keys to shut down your system in a controlled way, even when everything else has become completely unresponsive.

This is your life-saver. Don't throw it over board ;)


EDIT: The behaviour of SysRq can be controlled by writing the bitmask for the allowed actions to the file /proc/sys/kernel/sysrq. A value of 0 disables everything, so

echo 0 > /proc/sys/kernel/sysrq

will do the job. But you have been warned ;)


EDIT: To disable permanently, add the line:

kernel.sysrq = 0

to /etc/sysctl.conf. either that or create a file in /etc/sysctl.d/* with the mentioned line.

  • i've never had to use the "magic sysrq", yet i've repeatedly shutdown my session because of this. i want to change it to a harder-to-hit combination, or disable it if it cannot be modified without recompiling the kernel – rrosa Feb 18 '14 at 18:24
  • 1
    thank klaus. i had to do this sudo sysctl -w kernel.sysrq=0 since sudo echo was giving me permission denied. anyway, i'd still like to know how modify the shortcut rather than having to disable everything. thanks! – rrosa Feb 18 '14 at 19:00
  • 1
    Why do you think it is such a big problem to disable the magic keys? If someone has a stable system it is not so important to have them enabled, IMHO. There are even some distribution which disable them by default, like Arch. – falconer Feb 18 '14 at 19:55
  • 1
    i've never had to use them myself, but i guess it would be useful to flush to disk before rebooting when something goes really wrong. also useful on a system to which i do not have access and can't reboot it manually (server) – rrosa Feb 18 '14 at 20:29
  • 1
    found sysrq doc with all possible values: kernel.org/doc/Documentation/sysrq.txt – rrosa Feb 18 '14 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.