I love the Raspberry Pi. They are small, cheap and don’t need much power. Most of the time use them in projects that need extra computing punch. Stuff like Over-engineered man hole covers, installations for travelling science exhibits and fish-detecting aquariums.

For these sorts of projects the Raspberry Pi isn’t connected to the Internet or a screen. The Pi is just lurking out the back, with some code controlling sensors, lights or something. But when I was developing this projects I ran into some sort of stability problem with the Raspberry Pi. Randomly the Pi would crash, it could be after 5 minutes, or 5 hours. But eventually the Raspberry Pi will get into a state where it looks like it is on, but doesn’t do anything.

I’m not the only one, many others have had similar issues:

“If I left the Pi running without interacting with it for some time and try to ssh or VNC to it after a while, it stops responding back. But the ethernet lights and the Power (red) LED keeps glowing without indicating any activity. I tried unplugging and reconnecting the LAN wire, pendrives, etc. but the only way was to unplug the power cord and restart the RPi.”

Provide enough Power

Raspberry Pi 3 Model B plugged into a 5V wall wart adapter.

Make sure you are running a 5-volt power supply that provides at least 2.5 Amps.

And if you are attaching USB peripherals, like a webcam or something. Go with an external powered USB hub. Although this is something that has improved, the earlier variants didn’t like USB devices drawing much power at all. All the same, I still go with a cheap generic hub for powering all USB peripherals plugged into a Raspberry Pi.

Use a high quality Micro SD Card

You want to add a decent SD card, something with wear levelling and a decent amount of space. The cheap generic cards tend to quickly become corrupted. I usually throw something like a 16GB SanDisk Extreme into my Raspberry Pi.

Remove GVfs

Raspbian comes has a package called ‘GVfs’ (GNOME virtual file system). For me, GVfs seems to do nothing but cause kernel panics (crashes). It is the first thing I uninstall:

  $ apt-get purge --auto-remove gvfs-backends gvfs-fuse

Naturally if you are using the GNOME desktop environment or working with data accessed via GVfs, this won’t be an option for you.

Blacklist the cfg80211 module

I try to disable the cfg80211 module whenever I can. This is something you won’t be able to do if you are using Wi-Fi (you need cfg80211 for Wi-Fi to work). But I sometimes get kernel panics from this module, especially when it is not in use.

Edit raspi-blacklist.conf and add cfg80211:

  $ sudo vim /etc/modprobe.d/raspi-blacklist.conf
  blacklist cfg80211



You can join the conversation on Twitter or Instagram

Become a Patreon to get early and behind-the-scenes access along with email notifications for each new post.