Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The file /proc/sys/kernel/sysrq contains a single number, such as 1 (enable all sysrq commands), 0 (disable all), or a base-10 positive integer which functions as a binary bitmask, enabling a subset of functions. Could someone please tell me which sysrq functions are allowed/disallowed when the bitmask is set to 438?

cat /proc/sys/kernel/sysrq

438

share|improve this question

1 Answer 1

up vote 11 down vote accepted

These are the available SysRq functions:

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.

share|improve this answer
    
Ah, it's just a linear combination of the individual bitmasks. Thanks very much. –  user001 Jan 7 '12 at 18:08
    
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 Jan 7 '12 at 18:14
1  
I added a possible way to check for CONFIG_MAGIC_SYSRQ. –  William Jackson Jan 7 '12 at 18:27
    
Thanks. 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 the y means it has been enabled. Would give 2 up-votes if I could. –  user001 Jan 7 '12 at 18:28
    
On many Linux distros, the configuration is kept in the kernel itself, not in /boot, so the check command would be zgrep SYSRQ /proc/config.gz (or gunzip -c /proc/config.gz | grep SYSRQ). –  grawity Jan 7 '12 at 19:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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