invoke oomkiller via SysRq on Arch Linux on a Thinkpad T450s

Note: I have Ctrl/Fn swapped via bios.
Prerequisite: SysRq has to be enabled:

sysctl kernel.sysrq=1

Then

  1. Hold Fn+Ctrl+Alt+S
  2. Release all but Alt, keep holding Alt
  3. now we’re effectively in Alt+SysRq+…, and can hit the final key for magic function:
    b = reboot
    e = terminate all processes
    i = kill all processes
    h = dump help to kernel log, and finally:
    f = invoke OOM killer

Troubleshoot/test:

  • run a dmesg -w, watch what happens, especially with h
  • xev should report Sys_Req after Fn+Ctrl+Alt+S, among all the modifiers

Make persistent

# /etc/systemd/sysrq.service
[Unit]
Description=Enable SysRq key

[Service]
Type=oneshot
ExecStart=sysctl kernel.sysrq=1

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl enable sysrq.service