I've been having fun today trying to get the Magic Sysrq key to work on my Ubuntu 10.04
system (most recent kernel .config was for 2.6.37-rc7). I noticed it wasn't working by
accident when I tried to use it (which presumably means I haven't used it since I was
using Gentoo - ouch, a while ago.)
This is probably not strictly a kernel issue - I apologise if you think it doesn't
belong here, but I thought I'd share my adventure with the list in case anyone else had
this problem and looks for help here.
I always build the Sysrq into the kernel so I went back to check that my .config was
right - sure enough, CONFIG_MAGIC_SYSRQ was set to "y".
Documentation/sysrq.txt states:
'When running a kernel with SysRq compiled in,
/proc/sys/kernel/sysrq controls the functions allowed to be invoked via
the SysRq key. By default the file contains 1 which means that every
possible SysRq request is allowed (in older versions SysRq was disabled
by default, and you were required to specifically enable it at run-time
but this is not the case any more).'
Hmm, not on my machine:
julie@zeus:/proc/sys/kernel$ cat sysrq
0
After a considerable amount of faffing about and searching I managed to find the solution,
which is to find the sysctl.conf file (/etc/sysctl.conf) and add the following line:
kernel.sysrq = 1
The system now boots with the Magic Sysrq key enabled by default.
Note that trying to sudo echo a value into /proc/sys/kernel/sysrq doesn't work:
julie@zeus:/proc/sys/kernel$ cat sysrq
0
julie@zeus:/proc/sys/kernel$ sudo echo "1" > sysrq
bash: sysrq: Permission denied
julie@zeus:/proc/sys/kernel$ ls -l sysrq
-rw-r--r-- 1 root root 0 2010-12-29 19:37 sysrq
Instead, I have to explicitly log in as root:
julie@zeus:/proc/sys/kernel$ cat sysrq
0
julie@zeus:/proc/sys/kernel$ su
Password:
root@zeus:/proc/sys/kernel# echo "1" > sysrq
root@zeus:/proc/sys/kernel# exit
exit
julie@zeus:/proc/sys/kernel$ cat sysrq
1
or sudo a shell:
julie@zeus:/proc/sys/kernel$ sudo bash
[sudo] password for julie:
root@zeus:/proc/sys/kernel# echo "1" > sysrq
root@zeus:/proc/sys/kernel# exit
exit
julie@zeus:/proc/sys/kernel$ cat sysrq
1
Which I presume might be counter-intuitive for some Ubuntu users, as AFAICR
they're not encouraged to create an explicit root account but are expected to sudo
everything instead - in other words they're likely to simply tag 'sudo' in front of
any CL operation that would normally be root-only and expect it to work.
.............................................
I don't know enough about things that are outside the kernel tree to know whether
the /proc/sysrq configuration default is a distro thing or whether it's resulted
from the recent kernel discussions about restricting access for security reasons to
files/settings exposed by /proc. Does anyone know this or might anyone point me to
the corresponding discussion?
Thanks
Julie
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies