I am a happy user of Raspbian on Raspberry Pi. I have some services there like VPN, Plex, Pi-Hole, etc.

Every 1-2 years it starts showing "segmentation fault", when running some commands. I need to take the card out, reflash it with a backup image and put it back in.

I know other people experience that too. Why is this happening? Is there something I can do to avoid it? Would mounting the SD card in r/o mode help?

  • 1
    Segmentation fault usually means "could not find that memory segment" problem. If your problem appears every one to two years, most likely the SD car's memory "cells" are getting too old, some "brain cells" are intermittently not working and become absented mined etc. When you rewrite you card, the write program might first check if there are cells cannot write then read back, and blacklist them, so not to use them again when reflashing. SDs like humans, get dementia when living over 80 years old, it is better to let RIP and find a new baby! SD cards also Ces't la vie :( – tlfong01 Jan 8 at 7:46
  • 1
    It first happened after around half a year of usage. Then around 1 year and now around 2 years. So it looks like the problem occured from the beginning. I bought a good SD card, but maybe it was flawed. Do people run their RPIs for longer period of times (let's say 3-4 years) without this issue? I am also doing lots of r/w operations, but not on the SD card, but an external drive. Maybe that's causing the problem? – Michal B. Jan 8 at 7:54
  • 2
    I've got RPi1B that have been running NON-STOP for four or five years. SEGFAULT is a programming error, usually caused by going out of bounds on a data array. – Dougie Jan 8 at 8:20
  • Well, like humans, every card is unique, though there is a rough probability of minimum/typical/average/mean/maximum read/write times. There are also MTBG (Mean Time Between Failures). Good brands might do high percentage sample check and high percentage or all tests check. Also "burn in" (high temperature oven) test, to calibrate or predict to aging rate. Some 30 years agoI happened to work in a memory core (yes, magnetic core) assembly and testing lab where "our" core memory system shipped to carriers and space ships. – tlfong01 Jan 8 at 8:22
  • 1
    Which commands in particular cause this ? Do you have logs (check in /var/log) ? An error message ? The question is just too broad and not enough details to provide meaningful guidance. – Anonymous Jan 8 at 20:50

Segmentation faults can affect ANY operating system, although they should be a RARE event on a well managed system which repairs most damage automatically.

They are usually indicative of a damaged file system.

To refer specifically to the Pi they are more likely if you do not shutdown properly and/or use poor SD Cards. SD Cards do wear out with use, although the risk is greatly overstated, and many of us have been using the same for years without problems.

Fortunately there is a simple UNIVERSAL solution - perform regular backups.

The method of restoration varies with OS - the most common Pi method is to re-image the SD Card (or preferably a new SD Card) from you backup.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.