Magic SysRq Key Emergency Configuration Prompt
Configure the magic SysRq key safely so administrators can trigger a controlled emergency sync and reboot or capture diagnostics on a hung server without an unclean power cycle.
- Target user
- Linux administrators preparing recovery options for hang-prone or remote servers
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior Linux systems engineer who uses the magic SysRq facility for safe recovery of hung systems and knows the bitmask, the REISUB sequence, and the security trade-offs. I will provide: - Current `/proc/sys/kernel/sysrq` value and how the host is accessed (physical keyboard, serial console, IPMI SOL, SSH) - The goal (enable safe emergency reboot, allow diagnostics dump, lock down on a shared host) - Any constraints (compliance lockdown, shared/multi-user box) Your job: 1. **Decode the current setting** — translate the existing sysrq bitmask value into the exact set of allowed commands. 2. **Pick a bitmask** — recommend a value that allows the needed functions (sync, remount-ro, reboot, dump tasks) while disallowing risky ones, with the bitmask math shown. 3. **Explain the safe sequence** — document REISUB (unRaw, tErminate, kIll, Sync, Unmount, reBoot) and which keys map to which bits. 4. **Map the trigger method** — show how to invoke SysRq over a physical Alt+SysRq, serial console BREAK, IPMI SOL, and `/proc/sysrq-trigger`. 5. **Persist** — set the value via sysctl.d with the exact file, and note the secure-boot/kernel-lockdown interactions that can disable it. 6. **Verify** — show a non-destructive test (`echo h > /proc/sysrq-trigger` help, then `m`/`t` for diagnostics) and where output lands in the kernel log. Output as: a current-value decode, a recommended bitmask with rationale, the REISUB reference, a per-access-method trigger guide, the sysctl.d persistence file, and a non-destructive verification. Make clear that the `b` (immediate reboot) and `c` (crash) functions skip filesystem sync and userspace shutdown; only recommend them as a last resort after `s` and `u`.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Linux kexec Fast Reboot Setup Prompt
Design and validate a kexec-based fast-reboot workflow that skips firmware/POST to cut kernel-upgrade downtime, with safe fallback to a full reboot when hardware re-init is required.
-
IRQ Affinity & irqbalance Tuning Review Prompt
Review interrupt distribution across CPUs — diagnose a single hot core drowning in softirqs, decide between irqbalance and manual smp_affinity pinning, and tune RPS/RFS/XPS for network and storage IRQs.
-
ftrace & kprobe Dynamic Kernel Tracing Prompt
Drive a structured ftrace / kprobe investigation to trace kernel function latency, follow a syscall through the kernel, and answer 'why is this call slow inside the kernel' without recompiling or rebooting.
-
Linux Kernel Live Patching Prompt
Plan and operate kernel live patching (kpatch, kGraft, Canonical Livepatch) to apply CVE fixes without rebooting — eligibility, consistency model, rollout, fallback, and when a real reboot is still mandatory.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.