Panel For Example Panel For Example Panel For Example

Using the Linux SysRq Key for Debugging

Author : Adrian September 03, 2025

The SysRq key is a powerful tool for system recovery and debugging. As long as the kernel is not completely frozen, it will respond to SysRq key combinations, allowing you to collect system information such as memory usage, CPU task handling, and process states.

 

Configuration

To use SysRq, you must enable the CONFIG_MAGIC_SYSRQ option in your kernel configuration. After booting, this will create the /proc/sysrq-trigger node for debugging purposes.

Enable SysRq by adding the following line to /etc/sysctl.confkernel.sysrq=1

Run the following command to apply the changes:

sysctl -p

You can also enable SysRq temporarily by writing a value to echo "number" /proc/sys/kernel/sysrq. Different values enable specific features:

Value Description
0 Disable SysRq completely
1 Enable all SysRq functions
2 Enable control of console logging level
4 Enable keyboard control (SAK, unraw)
8 Enable process debugging dumps
16 Enable the sync command
32 Enable remounting filesystems as read-only
64 Enable sending signals to processes (term, kill, oom-kill)
128 Enable reboot/power off
256 Enable real-time task priority adjustment

 

How to Use SysRq

To use SysRq, echo a command key to the /proc/sysrq-trigger node:

echo <command key> > /proc/sysrq-trigger

The <command key> is case-sensitive.

The available command keys are listed below:

Command Key Function

b

Immediately reboots the system without syncing or unmounting disks.

c

Performs a system crash, triggering a crash dump if configured.

d

Displays all held locks.

e

Sends a SIGTERM signal to all processes except init.

f

Calls the OOM killer to terminate a memory-intensive process. It will not cause a panic if no process is killed.

g

Used by kgdb (kernel debugger).

h

Displays help text. Any key not listed here will also show help.

i

Sends a SIGKILL signal to all processes except init.

j

Forcibly thaws filesystems frozen by the FIFREEZE ioctl.

k

Secure Access Key (SAK): Kills all programs on the current virtual console.

l

Shows a stack backtrace for all active CPUs.

m

Dumps current memory information to the console.

n

Resets the priority of all real-time tasks to normal.

o

Shuts down the system (if configured and supported).

p

Dumps the current registers and flags to the console.

q

Dumps information about all armed high-resolution timers and clock event devices for each CPU.

r

Switches the keyboard from raw mode to XLATE mode.

s

Attempts to sync all mounted filesystems.

t

Dumps a list of current tasks and their information to the console.

u

Attempts to remount all mounted filesystems as read-only.

v

Forcibly restores the framebuffer console.

w

Dumps tasks that are in an uninterruptible (blocked) state.

x

Used for xmon on ppc/powerpc. Shows global PMU registers on sparc64. Dumps all tlb entries on MIPS.

y

Displays global CPU registers (SPARC-64 only).

z

Dumps the ftrace buffer.

0-

9

Sets the console log level, which controls which kernel messages are printed to the console (e.g., '0' will only show emergency messages like PANICs or OOPSes).

 

Summary

SysRq is a well-established feature for safely handling system hangs and performing reboots.

Recommended Reading
Deploying Deep Learning Gait Recognition on Allwinner V853

Deploying Deep Learning Gait Recognition on Allwinner V853

March 23, 2026

Gait recognition on an embedded Allwinner V853 board using NPU acceleration, detailing PyTorch-to-NB model conversion, CPU preprocessing/postprocessing and CASIA-B evaluation.

Article
Differences: DSP vs Microcontroller vs Embedded Microprocessor

Differences: DSP vs Microcontroller vs Embedded Microprocessor

March 20, 2026

Compare DSP, microcontroller, and embedded microprocessor designs: DSP signal processing optimizations, microcontroller peripheral integration, and power/performance tradeoffs.

Article
Choosing Peripherals for Embedded Systems

Choosing Peripherals for Embedded Systems

March 20, 2026

Guide to selecting peripherals in embedded systems: compare memory, clock sources, timers, communication interfaces, I/O and ADCs with factors like speed, power, and stability.

Article
Two Embedded Microprocessor Architectures and Their Pros and Cons

Two Embedded Microprocessor Architectures and Their Pros and Cons

March 20, 2026

Overview of embedded microprocessor architectures (CISC vs RISC), trade-offs, advantages and limitations for embedded system design, power, performance, and integration.

Article
Tesla Cuts Prices $2,000 on Three Main Models

Tesla Cuts Prices $2,000 on Three Main Models

March 20, 2026

Analysis of Tesla's recent price cuts, FSD subscription reduction and 14,000 layoffs after Q1 delivery declines, and competitive pressure from Chinese EV makers like BYD.

Article
Three Main Components of an Embedded Microprocessor

Three Main Components of an Embedded Microprocessor

March 20, 2026

Technical overview of the embedded microprocessor architecture, summarizing its three cooperating subsystems and how the compute unit enables arithmetic and logical execution.

Article