Upgrading from old version Octopi and Raspbian

Intro

I currently run Octoprint 1.3.0 and would like to upgrade to OctoPrint 1.4.0. The latest version requires Python 3.6/3.7.

When I tried to upgrade to this version I've realized I still run Raspbian Jessie which only supports Python 3.4. I will have to upgrade Raspbian before I can upgrade OctoPrint.

A photo of hardware being upgraded

I want to keep all of my current prints, but this update install Octoprint in a new virtual environment so plugins will not be preserved

Plugins

These are OctoPrint Plugins that I use:

Backup

The upgrade process should preserve upldated files metadata and any timelapses but I would like to take backup just in case.

First go to OctoPrint Settings -> Backup and Restore -> Create backup

I checked off off Exclude timelapses from backup just because I don't really care about preserving timelapses then click Create Backup Now.

After backup is created download the file to your local computer.

Backup and restore dialog for octopi

Raspbian Upgrade

Upgrading from Jessie (oldoldstable) is a two-step process first upgrade to Stretch (oldstable) then upgrade to Buster.

Login as a pi user then become root with the command sudo -i

Add Stretch to /etc/apt/source.list repository

deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
deb http://raspbian.raspberrypi.org/raspbian/ jessie main contrib non-free rpi

Add Stretch to raspi repository /etc/apt/sources.list.d/raspi.list

deb http://archive.raspberrypi.org/debian/ stretch main ui
deb http://archive.raspberrypi.org/debian/ jessie main ui

Before running an upgrade I highly recommend connecting raspberry pi via ethernet port if possible as each upgrade is 500MB it may take a while to download that data over flaky wifi connection.

Upgrade your system and restart the raspberry pi. Write down the new ip address if you're using ethernet interface instead of wifi. You can check your ip address with 'ifconfig' command.

# apt update
# apt dist-upgrade -y
# reboot

Once Debian Stretch is installed, I'm going to move the system to Buster. Edit the same file removing 'jessie' entry and replace it with 'buster'.

/etc/apt/source.list

deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

/etc/apt/sources.list.d/raspi.list

deb http://archive.raspberrypi.org/debian/ stretch main ui
deb http://archive.raspberrypi.org/debian/ buster main ui

Don't upgrade haproxy.cfg if asked as it is used to forward connections from port 80 to port 5000 on which OctoPrint python service runs.

If you updated the config anyway, move old configuration in place of the new one.

# cd /etc/haproxy
# mv haproxy.cfg.dpkg-old haproxy.cfg
# service haproxy restart

Run upgrade one more time and restart the system.

# apt update
# apt dist-upgrade -y
# reboot

Upgrade Octoprint

Log in as 'pi' user and create venv to be use with octoprint systemd servie script

$ virtualenv -p python3 ~/OctoPrint/venv

Once venv is installed, activate it

$ source ~/OctoPrint/venv/bin/activate

Install the latest version of OctoPrint package

(venv) pi@octopi-12v:~/OctoPrint $ pip install OctoPrint

Old init scripts no longer work so OctoPrint will not start automatically without an updated to the system. Become root then go to /etc/systemd/system then download octoprint script into that directory and make it executable, enable octoprint service then restart the system.

$ sudo -i
# cd /etc/systemd/system
# wget https://raw.githubusercontent.com/foosel/OctoPrint/master/scripts/octoprint.service
# chmod 755 octoprint.service
# systemctl enable octoprint
# reboot

The system should now boot into newly updated octoprint.

Reinstalling plugins from command line

When attempting to reinstall plugins I keep getting errors in the web interface about raspberry pi being throttled because of low voltage on the system.

Throttled message

This has been happening for as long as I remember but I haven't had any stability issues, so I will install plugins from command line.

$ source ~/OctoPrint/venv/bin/activate
(venv)$ pip install https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip
(venv)$ pip install https://github.com/ntoff/OctoPrint-fanspeedslider/archive/master.zip
(venv)$ pip install https://github.com/imrahil/OctoPrint-NavbarTemp/archive/master.zip
(venv)$ pip install https://github.com/fabianonline/OctoPrint-Telegram/archive/stable.zip

Reboot the system

$ sudo reboot

I'm currently having some issues with plugin. It is likely Python 3 compatibility, I'm trying to figure that out.