Data Corruption :(

RGB Matrix Display

Back Home

So, while attempting to solve a problem with my RGB Screen, I rebooted it using the plug. I have heard so many people say not to use the plug to reboot your system, and you should always use the poweroff command to shut down the rpi. I also know why. The problem is I’ve been in the clear for so long shutting down the RPI this way that I figured I’d never run into this problem. Well guess again!

I’m assuming by the title of this post you’ve already figured out that… it happened. Data Corruption.

The RPI would power itself on and operate normally, yet I could never get the wifi back online. Turns out. corrupted the drivers for the wifi. When it booted, I did see some kernel panic’s (never took a screen grab, sorry!) but thought nothing of it. After further inspection, the error messages basically said it couldn’t load the drivers for the wifi and it just went about its merry way.

In an attempt to fix this issue, I spent 2 or 3 hours (into the wee hours of the morning) trying to run fsck on the sd card. First I attempted to mount the card on my MacBook, but macOS doesn’t support the ext4 filesystem. So then I tried to install and run an Ubuntu vm on my MacBook. However getting the SD Card to connect involved too many steps and ended up not working after I followed all of them. I then attempted to use ext4fuse provided by homebrew, but because I was moving too fast, I missed the fine print that says ext4fuse is read only (sad face).

My next desperate attempt was to pull out my work Windows 10 computer and try to use windows to repair the disk. Plugging it into windows didn’t prompt any “this drive is corrupt” error, so I tried to run a fix myself. I was pretty sure it wouldn’t do anything but i figured “hey, let’s give it a try”. For some reason I’m reminded of my coworker who, after something doesn’t work and I try it again, said “if it didn’t work the first time, it won’t work the second time”.

My next and final attempt was to use the ubuntu desktop VM that I use for work. After starting the VM and connecting my sdcard, the vm … didn’t see the card.

So after 4 [failed] attempts, I gave into frustration and did the only thing I knew would NOT fail: rebuild. Luckily the project is under git version control and all I really had to do was to clone the repo. So, these are the steps I followed to build anew:

  1. flash the SD card with ubuntu 18.04 LTS
  2. connect it to WIFI (easy with netplan)
  3. apt update && apt upgrade
  4. clone the repo and made some changes to the easyrobitics library
  5. copied the startup script to /etc/systemd/system
  6. systemctl rpiScreen enable
  7. reboot

Done and done! It’s now working as new.

Something I think i’m going to do is to take an image of the SD card so that if this happens again, I’ll be able to recover easily. If I end up doing that, I’ll be sure to write a post here!