Why Does My Raspberry Pi Randomly Reboot or Corrupt Its SD Card?
Last updated 14 July 2026 · 7 min read
Direct Answer
Random Raspberry Pi reboots and SD card corruption are most commonly caused by undervoltage at the board's power input, not a software fault. Check `vcgencmd get_throttled` immediately after a reboot — a non-zero result (particularly bit 0, undervoltage detected) confirms the power supply, not firmware or the OS, is the root cause. The two most common sources are an underrated power supply that sags under peripheral or CPU load, and a USB-C cable (Pi 4 and Pi 5) with resistance high enough to drop the supply voltage below the board's minimum operating threshold under load, even when a multimeter reading at idle looks fine.
Detailed Explanation
Random reboots, unexplained freezes, and SD card filesystem corruption on a Raspberry Pi are three of the most commonly reported field symptoms — and in the large majority of cases, none of them are a software bug. They are downstream symptoms of the board's supply voltage sagging below its minimum operating threshold, usually under transient load rather than continuously, which is why the problem is often intermittent and hard to reproduce on the bench at idle.
This page covers how to confirm undervoltage as the root cause, the two most common physical sources of it, and how to fix each — as distinct from debugging a CM4 carrier board's own power supply design, which covers the same underlying voltage-sag failure mode from the PCB design side for a custom product rather than a stock Pi board.
Confirming Undervoltage With vcgencmd
Before investigating any specific cause, confirm undervoltage is actually occurring. Raspberry Pi OS includes a built-in undervoltage detection circuit and reporting tool:
vcgencmd get_throttled
This returns a hexadecimal bitmask. The bits that matter most for reboot/corruption troubleshooting:
| Bit | Hex value | Meaning |
|---|---|---|
| 0 | 0x1 | Undervoltage detected — right now |
| 1 | 0x2 | ARM frequency capped — right now |
| 2 | 0x4 | Currently throttled — right now |
| 16 | 0x10000 | Undervoltage has occurred since last boot |
| 17 | 0x20000 | ARM frequency capping has occurred since last boot |
| 18 | 0x40000 | Throttling has occurred since last boot |
A result of 0x0 means no power or thermal event has been detected since boot — if the fault reproduces while this reads clean, undervoltage is not the cause and the investigation should move to the SD card or OS instead (see the FAQ above). A non-zero result with bit 0 or bit 16 set confirms undervoltage is either happening now or has happened at least once — the practical starting point for the rest of this page.
The classic lightning bolt icon in the top-right corner of the desktop, or a Under-voltage detected! kernel log message (dmesg or journalctl -k), are the same underlying condition surfaced through the desktop UI and kernel log respectively — any of the three (icon, log message, or get_throttled bit) confirms the same root cause.
The Two Most Common Sources
1. Underrated or Marginal Power Supply
The Raspberry Pi's peak current draw under full CPU load plus attached peripherals (USB storage, HATs, displays) is substantially higher than its idle draw. A power supply rated for the board's idle or light-load current, or a generic phone charger not designed to hold its rated voltage under a sustained load, sags under real operating conditions even though it appeared adequate during a quick bench check. Raspberry Pi's own documentation specifies a minimum supply current rating for each board generation — always use the specific supply rating for the board in use (it increases with each generation, particularly the Pi 4 and Pi 5) rather than assuming a supply that worked for an earlier Pi model is adequate for a newer one.
2. USB-C Cable Resistance (Pi 4 and Pi 5)
This is a well-documented, Pi-4/Pi-5-specific issue distinct from PSU sizing: some USB-C cables — particularly cheaper or longer cables, and certain "e-marked" cables intended for high-power laptop charging that were not designed with thin, low-resistance conductors for this current range — have enough conductor resistance that the voltage drop across the cable alone, under the Pi's peak current draw, is enough to pull the board below its undervoltage threshold, even when the source supply itself is correctly rated and measures full voltage at its own output. This is why swapping only the power supply sometimes doesn't fix the symptom — the cable itself is the resistive element causing the drop.
Diagnosis Workflow
- Confirm undervoltage with
vcgencmd get_throttledas described above — don't proceed further based on assumption alone. - Reproduce under sustained full load, not idle. Run a CPU stress tool across all cores while any attached peripherals (USB storage, HAT, display) are active simultaneously — the fault is a transient load condition, and idle-only testing frequently fails to reproduce it.
- Measure at the board's power input under that load, not at the source supply's own output terminals — the difference between the two measurements, if any, quantifies exactly how much the cable (or any connector/wiring in between) is contributing to the drop.
- Isolate cable versus supply by substituting a short, known-good, thick-conductor USB-C cable (or, for boards with a barrel/GPIO power input, a short low-gauge wire directly to the source) while keeping the same supply, and separately substituting a supply rated well above the board's minimum current spec while keeping the same cable — whichever substitution resolves the undervoltage flag identifies the actual faulty element.
- Check SD card health separately once undervoltage is ruled out or fixed — a clean
get_throttledresult during a reproduced fault points away from power and toward the SD card or OS instead (see the FAQ above).
Design Considerations
- Size the power supply and cable to the board's peak load, not idle — see the FAQ above for why a static multimeter reading at idle is not sufficient evidence that the power path is adequate.
- For a custom product built around a Compute Module rather than a stock Pi board, the same undervoltage failure mode applies to the carrier board's own power supply design — see CM4 carrier board power supply sizing for the PCB-level version of this problem, including decoupling and regulator sizing for peak current.
- Prefer a short, low-resistance cable over a long or thin one for any Pi 4/Pi 5 deployment where the power source can't be placed close to the board — cable-induced voltage drop scales with both length and conductor gauge.
- Treat repeated undervoltage-triggered reboots as a data-integrity risk, not just a nuisance — an ungraceful power interruption during a filesystem write is a leading cause of SD card corruption on any embedded Linux device, so fixing the power supply also protects storage integrity, not just uptime.
- Zeus Design's embedded engineering team diagnoses field power and reliability issues on deployed Raspberry Pi and Compute Module products as part of embedded Linux and firmware development support.
Common Mistakes
- Assuming a multimeter reading full voltage at idle rules out undervoltage — transient sag under load is the actual failure mode and an idle-only measurement misses it entirely (see the FAQ above).
- Replacing only the power supply without also checking the cable, missing a Pi-4/Pi-5-specific cable-resistance issue that persists even with a correctly rated new supply.
- Treating random reboots as a software or OS bug and spending debugging time there first, when
vcgencmd get_throttledwould have confirmed or ruled out the power-related root cause in seconds. - Reusing a power supply rated for an earlier Raspberry Pi generation without checking the current-generation board's higher minimum current rating.
- Not checking
get_throttledimmediately after the fault, rather than sometime later — the "since boot" bits (16, 17, 18) persist until the next reboot, so checking any time before the next reboot still captures a historical undervoltage event, but checking after a subsequent reboot loses that history.
Frequently Asked Questions
- How do I decode the vcgencmd get_throttled bitmask?
- `vcgencmd get_throttled` returns a hex value where each bit reports a specific power or thermal condition. Bit 0 (value 0x1) means undervoltage is currently detected; bit 1 (0x2) means the ARM frequency is currently capped; bit 2 (0x4) means currently throttled. Bits 16, 17, and 18 report the same three conditions but for whether they occurred at any point since boot, rather than right now — a value of 0x50005, for example, means undervoltage is happening right now (bit 0) and has also occurred at least once since boot (bit 16), with the same true for throttling. A result of 0x0 means no power or thermal issue has been detected since the last boot.
- The multimeter reads 5.1V at the power input but the Pi still shows undervoltage — why?
- A static multimeter reading at idle or light load does not reveal the problem — voltage sag happens under transient current spikes (CPU burst load, a USB peripheral spinning up, Wi-Fi transmit bursts) that a multimeter's averaging response is often too slow to catch, and that only last milliseconds. The Pi's own undervoltage detection circuit samples much faster than a typical handheld multimeter's display update rate. Measure under sustained full load (a stress-test tool exercising all CPU cores plus attached peripherals) rather than at idle, and if possible use an oscilloscope on the 5V rail to see transient sag directly rather than relying on a multimeter's averaged reading.
- Can a bad SD card cause the same symptoms as undervoltage, or is it always the power supply?
- A failing SD card can independently cause filesystem corruption and unexpected reboots, so it isn't always the power supply — but undervoltage is disproportionately the more common root cause in the field, and it also accelerates SD card wear and corruption indirectly (an ungraceful power interruption mid-write is one of the most common causes of filesystem corruption on any embedded Linux device). Always check `vcgencmd get_throttled` first, since it directly answers whether undervoltage occurred; if it reports clean (0x0) across a period when the fault reproduces, then investigate the SD card and OS separately rather than continuing to suspect power.
References
Related Questions
Should You Use the Raspberry Pi CM4 in a Product?
Learn when to use the Raspberry Pi CM4 in a product: carrier board design, eMMC storage strategy, boot mode strapping, and RCM certification.
Raspberry Pi Models Compared: Pi 5, Pi 4, CM4, Zero 2W, and Pico
Compare Raspberry Pi models: Pi 5 and Pi 4 for full Linux compute, CM4 for product integration, Zero 2W for compact IoT, and Pico/Pico 2 for MCU tasks.
Raspberry Pi vs Microcontroller: When Should You Choose Each?
Choosing between a Raspberry Pi and a microcontroller? Covers real-time requirements, power consumption, compute needs, and product design trade-offs.
How to Interface Sensors and Peripherals with Raspberry Pi GPIO
Interface sensors and peripherals with Raspberry Pi GPIO: 3.3 V limits, level shifting, I2C/SPI/UART device tree configuration, lgpio API, and i2cdetect.
How Do You Design PCB Power and Ground Plane Layouts?
PCB power and ground planes distribute power and provide a low-impedance return path for every referenced signal. Here's how to design them well.
How Do You Integrate a Camera Module with a Raspberry Pi CSI Interface?
Integrating a camera with a Raspberry Pi's CSI interface: ribbon/FFC connection, D-PHY differential pair routing for CM4 carrier boards, and libcamera bring-up.