OctoPrint won't start after Pi updates; "OctoPrint server is currently not running"

What is the problem?

OctoPrint is stuck on the "The OctoPrint server is currently not running" screen;

I noticed it says it's running via. Python2, and I don't know if this is an issue. Got the following when typing the ps -ef (...) command from the error screen;

This happened after the Pi had executed the following lines via SSH;

sudo apt -y update
sudo apt install -y python3-pip python3-dbus
yes | sudo pip3 install pyyaml requests python-crontab dbus-python

By bet is that one of these lines - probably the Python install one, resulted in this happening, but I am not 100% sure sadly...

On newer Raspberry Pi's (newly flashed ones, within at least a year), this issue has not occurred once, and exactly the same lines as above ^ are being executed every day, without issues.

What did you already try to solve it?

I tried serving OctoPrint myself via. SSH, and it gave me the following error, which has the full error trace;
octoprint_log.log (5.5 KB)

My guess is that the issue is Python2/3 related.

Have you tried running in safe mode?

No, after the error above I did not think trying safe mode would make a difference.

Complete Logs

There were nothing in the logs, as OctoPrint never made it to log anything after the issues started happening. Nothing in the old logs either.

  • OctoPrint version: 1.5.1
  • Problem occurred on a Pi 2 this time, but has happened on a Pi 3B before as well (without me having the log to be 100% certain, but the issue with the other user seemed identical; after updating OctoPrint won't start)
  • I have not been able to re-create this problem myself, as both times I have encountered it, it's been a user seeking our help. This time I went into TeamViewer and everything in this post is from what I have gathered there.
  • It doesn't necessarily seem to be a Pi 2-related issue, as the error doesn't indicate that it simply doesn't have enough power. It didn't run or or anything.

Hope the error above ^ makes sense to someone in here! :smiley: Thanks, and sorry for the long read.

Are those pis also on octopi 0.16.0?
0.16.0 is based on debian strech and 0.17.0 and higher are based on debian buster

There is also an update script (python 2 to python 3) by @Charlie_Powell but unfortunately it's made for buster based systems :confused:

If nobody got a solution for you I would suggest you back up what you need via WinSCP and start over with a fresh image.

Will figure out which OctoPi version it is - you're probably on to something. I know this is most likely fixed by a fresh install, just wanted to see if there was possible to get it fixed, in case it happens again and the next user isn't too happy about a re-flash.

The 'address already in use' means there was an incomplete shutdown of OctoPrint. Reboot the Pi, it should start again.

Then, post the list of plugins installed and I'll look and see if there is any I recognize. I had an issue where running a plugin with multiprocessing would block shutdown if there were non-daemon threads, since OctoPrint only waits 15 secs for them to terminate. Some reason with multiple processes the server bindings are not released properly.

For clarification, I have seen this issues several times before (some people on discord even pinged me since I had done quite a lot of work into this), and I don't think it is python 2/3 related at all, usually bad shutdown.

And contributed a PR to core OP to make this less likely, since there was a util method (octoprint.util.ResettableTimer) that was not daemon by default and was causing this.

One I am aware has an issue is 'DiscordRemote' since it used non-daemon threads.

Awesome! Thanks for the points. We did try restarting quite a few times, which didn't help. Might be best to boot, make sure the OctoPrint service doesn't start automatically, so the "bad startup" will be monitored with a manual serve of OP?

I'll contact the guy who had the issue tomorrow, and do as you suggested :slight_smile:

It is indeed 0.16.0, so the update script is probably not good for stretch

These are all the packages (with the ones that I know for sure are plugins, in the top).

But if this was a plugin issue, wouldn't OctoPrint start in safe mode automatically, and it'd work?

Change-Filament==0.3.1
M73-Progress-Plugin==0.2.1
Octolapse==0.4.1
OctoPrint==1.5.1
OctoPrint-Cancelobject==0.4.4
OctoPrint-CuraEngineLegacy==1.0.2
OctoPrint-Display-ETA==1.1.1
OctoPrint-FilamentManager==0.5.3
Octoprint-FilamentReload==1.1.0
OctoPrint-FileCheck==2020.8.7
OctoPrint-FirmwareCheck==2020.9.23
OctoPrint-IFTTT==1.2.1
OctoPrint-PrintTimeGenius==2.2.6
OctoPrint-PSUControl==0.1.9
OctoPrint-TabOrder==0.5.12
OctoPrint-Telegram==1.6.2
OctoPrint-WebcamTab==0.2.0
argh==0.26.2
awesome-slugify==1.6.5
Babel==2.6.0
backports-abc==0.5
backports.csv==1.0.7
blinker==1.4
cachelib==0.1
certifi==2018.11.29
chainmap==1.0.3
chardet==3.0.4
click==7.1.2
emoji==0.5.4
enum34==1.1.10
feedparser==5.2.1
file-read-backwards==2.0.0
filetype==1.0.7
Flask==1.1.2
Flask-Assets==2.0
Flask-Babel==1.0.0
Flask-Login==0.5.0
Flask-Principal==0.4.0
frozendict==1.2
future==0.18.2
futures==3.3.0
idna==2.8
install==1.3.0
ipaddress==1.0.23
itsdangerous==1.1.0
Jinja2==2.11.2
logging==0.4.9.6
Markdown==3.1.1
MarkupSafe==1.1.0
monotonic==1.5
netaddr==0.7.19
netifaces==0.10.9
pathtools==0.1.2
Pillow==6.2.2
pkg-resources==0.0.0
pkginfo==1.5.0.1
Preheat==0.5.1
psutil==5.7.2
pyasn1==0.4.5
pybonjour==1.1.1
pylru==1.2.0
pyserial==3.4
python-dateutil==2.6.1
pytz==2018.9
PyYAML==5.3.1
regex==2019.1.24
requests==2.23.0
RPi.GPIO==0.7.0
rsa==4.0
sarge==0.1.5.post0
scandir==1.10.0
semantic-version==2.8.5
sentry-sdk==0.17.3
SimplyPrint==1.6.6
singledispatch==3.4.0.3
six==1.12.0
speaklater==1.3
SQLAlchemy==1.1.18
Themeify==1.2.2
tornado==5.1.1
TouchUI==0.3.17
typing==3.7.4.1
Unidecode==0.4.21
uritools==2.1.1
urllib3==1.24.1
watchdog==0.10.3
webassets==2.0
websocket-client==0.57.0
Werkzeug==1.0.1
wrapt==1.12.1