Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] Magic SysRq keys  (Read 1806 times)

Offline sunrat

  • User
  • Posts: 406
[EN] Magic SysRq keys
« on: 2019/03/11, 01:45:31 »
I haven't had to do an emergency shutdown/reboot on my siduction system for as long as I can remember, but a post in another forum (MX) got me to check its status out of curiosity:
Code: [Select]
$ cat /proc/sys/kernel/sysrq
0
which is disabled. Is that default in siduction or have I changed it somehow?

Offline melmarker

  • User
  • Posts: 2.799
    • g-com.eu
Re: Magic SysRq keys
« Reply #1 on: 2019/03/11, 02:56:57 »
it should be default - one can change it. Thank you for pointing to it, i was about to enable the recommend setting by default but are not sure if i really implement it for the next release, anyway, it would be nice to have.

On my system
Code: [Select]
% cat /proc/sys/kernel/sysrq
1

EDIT:

Kernel documentation: https://www.mjmwired.net/kernel/Documentation/sysrq.txt

my /etc/sysctl.conf
Code: [Select]
###################################################################
# Magic system request Key
# 0=disable, 1=enable all, >1 bitmask of sysrq functions
# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html
# for what other values do
#kernel.sysrq=438

#  ^^^ default

###################################################################
# Alf seine Settings
###################################################################

# 64 =  0x40 - enable signalling of processes (term, kill, oom-kill)
# 128 =  0x80 - allow reboot/poweroff
# 256 = 0x100 - allow nicing of all RT tasks
kernel.sysrq=438

# swappiness 0 was a bad idea times ago
vm.swappiness=5


As i'm not eager to patch default debian files i out it into sysctl.d
Code: [Select]
cat x01-sysrequest.conf

#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#

###################################################################
# Magic system request Key
# 0=disable, 1=enable all
# Debian kernels have this set to 0 (disable the key)
# See https://www.kernel.org/doc/Documentation/sysrq.txt
# for what other values do
kernel.sysrq=1

I guess i should put the modified file with mask 438 into our default configuration for the next release - the 438 is a mask that don't allow the most destructive things and is recommended in common ;)
« Last Edit: 2019/03/11, 03:22:38 by melmarker »
Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. (Benjamin Franklin, November 11, 1755)
Never attribute to malice that which can be adequately explained by stupidity. (Hanlons razor)

Offline sunrat

  • User
  • Posts: 406
Re: Magic SysRq keys
« Reply #2 on: 2019/03/11, 04:04:44 »
Interesting. I note that 438 disables the E and I of the commonly recommended REISUB sequence. An interesting answer at StackExchange proposes that only the U and B of that sequence are essential to reboot cleanly anyway, and that U executes the function of S initially making it redundant.
https://unix.stackexchange.com/questions/106094/how-long-should-i-wait-between-keystrokes-when-doing-sysrq-reisub   Interesting contentions and discussion. It seems 438 would be fine.

This article explains the bitmask clearly:
https://superuser.com/questions/375816/how-to-check-which-sysrq-functions-are-enabled
« Last Edit: 2019/03/11, 04:16:43 by sunrat »