Update to Raspberry Pi 4 (from working Pi 3+) [solved]

Hi :grinning:

I got my new Raspi 4 a few days ago and tried to update my 3+ system in order to get it to work on it.
So I did a dist-upgrade to buster (besides of rpi-update and updating and resizing the boot partition).
Afterwards octoprint didn't start anymore (everything else works as far as I know).

The octoprint server was installed with help of this great tutorial.

For now I'm back on my 3+ and a backup of the old sd card.

Octoprint latest, octoprint.log doesn't show anything after the uptates.

Any ideas what went wrong and/or what I can do to get it working again?

edit: I tried to start the server manual - this is what happens:

pi@raspi-3D:~ $ source venv/bin/activate
(venv) pi@raspi-3D:~ $ ~/OctoPrint/venv/bin/octoprint serve
Traceback (most recent call last):
  File "/home/pi/OctoPrint/venv/bin/octoprint", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/pi/OctoPrint/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 82, in <module>
  File "/home/pi/OctoPrint/venv/local/lib/python2.7/site-packages/pkg_resources/extern/__init__.py", line 61, in load_module
ImportError: The 'packaging.requirements' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
(venv) pi@raspi-3D:~ $

I don't know if this is relevant but to be sure:

(venv) pi@raspi-3D:~ $ python --version
Python 2.7.16

Thanks :slight_smile:

That error message sounds like some crucial bits are missing in that virtual environment. That is very strange though on a fresh install :thinking: Were there any errors or warnings shown on creation?

No on creation everything was fine.
Maybe I described it bad. The error showed up after I upgraded my existing stretch system to buster (which I had to do for the Raspberry Pi 4 support).

I guess something broke when upgrading. If you have an idea what I should change in my upgrade progress I would gladly try it again :slight_smile:
I still got a backup of my working systems sd card and also the working system is printing on my "old" 3+ right now :smiley:

If not I guess I'll set up a fresh install :slight_smile:

It could be that the python version changed between the stretch and the buster image and that made things break in the virtual environment (it's somewhat isolated, but not fully isolated).

You could try recreating just the virtual environment and see if that fixes things.

In general the backup plugin + reflashing is the recommended way to migrate to new images.

Alright. Will test this tomorrow :slight_smile:

Thank you very much

Have a good night :slight_smile:

Ok done :slight_smile:
In the end I flashed a new image and migrated the settings as you suggested.
I thought even if I get the venv issues fixes there will maybe new ones in the future and it's not worth the trouble.
I'll mark this problem as solved :slight_smile:

1 Like

Just wondering... did we just learn that attempting to do a dist-upgrade to Buster from a working 0.16.0 OctoPi-imaged setup doesn't work...?

Well it was my own setup but I guess it was as close to octopi as it could be.
Is the newest octopi image still on stretch? I could test it.

From what I understand, the newest production version is 0.16.0 and therefore is based upon Stretch and isn't compatible with the Pi4. Guy provided a link to his nightly build from June 20th which is based upon Buster and which therefore is.

Ok I tested it.
I flashed the latest stable image ( 0.16.0 ), run the webinterface wizard and updated to the latest octoprint.
Then I dist-upgraded to buster.
After that the same arror as in my case - venv seems broken.

(oprint) pi@octopi:~ $ ~/oprint/bin/octoprint serve
Traceback (most recent call last):
  File "/home/pi/oprint/bin/octoprint", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 74, in <module>
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pkg_resources/extern/__init__.py", line 61, in load_module
ImportError: The 'packaging.requirements' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
(oprint) pi@octopi:~ $

I guess it's safe to say normal users shouldn't dist upgrade to buster.


I have ran into the same problem
I have a Pi3 Raspbian Stretch with OctoPrint installed
I the Upgraded to Buster and now OctoPrint fails to start

I had to rename the /home/pi/OctoPrint folder to /home/pi/OctoPrint.org
then I proceeded to follow Setting up OctoPrint on a Raspberry Pi running Raspbian
to rebuild the virtualenv venv
and Now OctoPrint is running on Buster via a Pi3

by the way Buster has been made Stable in the repo


Glad to hear you got a solution.
I thought before there are potential problems in the future like installing plugins fails or updating octoprint itself etc I'm safer if I just set up a clean fresh install.

Good work :+1:

To run on pi 4 (advanced):

  • (optional but recommended, on the pi3) apt update + upgrade
  • take the working pi3 SD (from now on sd).
  • put it in a pc running any linux distro (easier).
  • download the buster raspbian image for a pi4 (this .img has 2 partitions fat/ext)
  • (optional but recommended) resize sd partitions. fat should be 256 mb.
  • loop mount both partitions in the img file and in the SD. At this point you have both "disks" accesible.
  • copy recursive from [buster/FAT]/ to the [sd/FAT]/ EXCEPT the config files. Leave old config files to preserve settings.
  • copy recursive from [buster/ext]/lib/modules/ to [sd/ext]/lib/modules
  • copy recursive from [buster/ext]/lib/firmware/ to [sd/ext]/lib/firmware
  • unmount
  • put the sd into the raspberry 4
  • power it on

..everything works on my end (BUT STILL ON STRETCH)

I'm guessing that you'd also need to reinstall all third-party plugins as well.

Well, that's an interesting method. I wonder if it would survive a sudo apt-get update && sudo apt-get upgrade cycle, though.

it definitely does survive because update channel is still stretch.
the only thing which doesn't get updated is stretch kernel (because buster runs on 4.19.57-v7l+ while stretch is a previous version)
...oh... by the way...in this case, if you want to update the kernel/firmware (from github), you can do a sudo rpi-update

....as I said I'm running on it...


Oh man, wrong answer. As I've posted many times on the Internet and here, rpi-update should only be used by the people who are actually coding kernel drivers, for example, for Raspbian. It will pull from the next branch of Raspbian's repository rather than from master. It will often brick a Raspi, by the way.

Well it shouldn't be used for regular updates - that's right.
But if you want the new things from the next branch it's the thing you want do.

I only did it if I wanted the new branch and had never issues with it. That doesn't mean that others can't have issues. I'm just saying it went fine for me.

It very much depends upon your timing ("your mileage may vary"). There are nights when the build on a next/development branch result in something that really doesn't work. The wi-fi/ethernet stack didn't load the last time I tried this on a Raspi 3B, for what it's worth.

1 Like