The Wikipedia page isn't great, here's a TLDR for forcing a clean shutdown, even if the computer locked up, as long as the kernel is still alive:
- Hold the SysRq key and press this sequence of keys, with a short pause between each:
- R = switch keyboard from "raw" mode (so X/Wayland can’t intercept)
- E = send SIGTERM to most processes
- I = send SIGKILL to most processes
- S = sync disks (flush writes)
- U = remount filesystems read-only
- B = immediately reboot (no further shutdown steps)
Mnemonic I personally use, bet others have better ones: "Reboot Even If System Utterly Broken", REISUB!