The OctoPrint server is currently not running - from immediate poweroff [Solution]

Hey Guys,
Don't need help but I thought I'd post for posterity. I've had plenty of times that my Raspberry Pi has powered off due to power outages or crashes, etc, then receive the "OctorPrint server is currently not running" error.

As a standard now, I run the following commands from SSH to reinstall python, regenerate the octoprint virtualenv and reinstall octoprint, all without having to reimage the sd card.;

sudo apt-get install --reinstall python-virtualenv/oldstable
sudo apt-get install --reinstall python2.7/oldstable libpython2.7/oldstable
rm -rf /home/pi/oprint.last
mv /home/pi/oprint /home/pi/oprint.last
rm -rf /home/pi/.cache
virtualenv oprint -p python2
source oprint/bin/activate
pip install
pip install --upgrade --no-cache
sudo reboot

Once the python 3 version is in stable release, you can omit the "-p python2" from the virtualenv command, and probably exclude reinstalling python 2.7 from oldstable.

Dude, plug it into a UPS. Backup your microSD card once per month using something like ApplePi-Baker or similar.

I do back it up. But if I have a power loss and the UPS runs out of power while I'm not around, it can corrupt the install. Rather than pull the SD card, reimage, reinsert and restore the image, I can just run the above through ssh and 9 times out of 10, it's back to full operation :slight_smile:

Just thought this could help others.