These are the available SysRq functions:
0 - disable every SysRq function.
1 - enable every SysRq function.
2 - enable control of console logging level
4 - enable control of keyboard (SAK, unraw)
8 - enable debugging dumps of processes etc.
16 - enable sync command
32 - enable remount read-only
64 - enable signalling of processes (term, kill, oom-kill)
128 - allow reboot/poweroff
256 - allow nicing of all RT tasks
438
= 2 + 4 + 16 + 32 + 128 + 256
, so only the functions associated with those numbers are allowed. Read all about it in the documentation.
If you convert 438
to base 2 (110110110
) it is even easier to see.
1 1 0 1 1 0 1 1 0
^256 ^128 ^64 ^32 ^16 ^8 ^4 ^2 ^1
Depending on your distribution, you may be able to tell if the kernel was compiled with CONFIG_MAGIC_SYSRQ
using this command:
$ grep SYSRQ /boot/config-$(uname -r)
This works for me on Ubuntu.
Ah, it's just a linear combination of the individual bitmasks. Thanks very much. – user001 – 2012-01-07T18:08:26.920
One follow-up: If nothing happens when I do Alt+SysRq+(a command key), then I suppose this means that sysrq was not enabled when the kernel was installed. Is there a simple way to check whether sysrq is enabled or not (e.g., can I find the status of
CONFIG_MAGIC_SYSRQ
somewhere)? – user001 – 2012-01-07T18:14:24.1803I added a possible way to check for
CONFIG_MAGIC_SYSRQ
. – William Jackson – 2012-01-07T18:27:10.487Thanks. Worked for me on Debian as well. The output:
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_MASK=0x01b6
(01b6 in hex is 438 in decimal). I suppose they
means it has been enabled. Would give 2 up-votes if I could. – user001 – 2012-01-07T18:28:33.6271On many Linux distros, the configuration is kept in the kernel itself, not in
/boot
, so the check command would bezgrep SYSRQ /proc/config.gz
(orgunzip -c /proc/config.gz | grep SYSRQ
). – user1686 – 2012-01-07T19:16:17.013Thanks @grawity. There is no file
/proc/config.gz
on my system, however. – user001 – 2012-01-07T19:45:54.593I did say 'many', not 'all' -- Debian/Ubuntu do keep it in
/boot
. – user1686 – 2012-01-07T19:47:01.113