🇺🇦 We stand with Ukraine! 🇺🇦

Upgrade has seemingly failed

What is the problem?
After upgrade Octoprint will not start. Hoping to not have to re-install. /usr/bin/octoprint no longer exists.

What did you already try to solve it?
Several restarts and trying to manually start the service

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
Running OctoPi and cannot determine Octoprint version , but the update was for the latest as of 2 hours ago

Ok, so it seems that Octopi installs everything under /home/pi/.octoprint and after adjusting the init.d script to the new location, I can kinda get things working. Octoprint starts in Safe Mode every time, and when I do a restart the service, I get the following entry in the octoprint.log:

2019-05-27 22:19:00,096 - octoprint.startup - INFO - ******************************************************************************
2019-05-27 22:19:00,099 - octoprint.startup - INFO - Starting OctoPrint 1.3.11
2019-05-27 22:19:00,100 - octoprint.startup - INFO - ******************************************************************************
2019-05-27 22:19:00,163 - octoprint.util.connectivity_checker - INFO - Connectivity changed from offline to online
2019-05-27 22:19:00,167 - octoprint.startup - INFO - Blacklist processing done, adding 1 blacklisted plugin versions: roomtemp (any)
2019-05-27 22:19:00,207 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2019-05-27 22:19:01,200 - py.warnings - WARNING - /home/pi/oprint/local/lib/python2.7/site-packages/pkg_resources.py:1049: UserWarning: /home/pi/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
warnings.warn(msg, UserWarning)

2019-05-27 22:19:01,889 - octoprint.plugin.core - INFO - Plugin Printer Safety Check is disabled.
2019-05-27 22:19:02,291 - octoprint.plugin.core - INFO - Plugin Nautilus (1.20) is disabled.
2019-05-27 22:19:02,428 - octoprint.plugin.core - INFO - Plugin OctoLapse (0.2.2) is disabled.
2019-05-27 22:19:02,686 - octoprint.plugin.core - INFO - Plugin Cost Plugin (0.1.3) is disabled.
2019-05-27 22:19:02,823 - octoprint.plugin.core - INFO - Plugin Enclosure Plugin (3.51) is disabled.
2019-05-27 22:19:02,998 - octoprint.plugin.core - INFO - Plugin DisplayLayerProgress Plugin (1.7.1) is disabled.
2019-05-27 22:19:03,039 - octoprint.plugin.core - INFO - Found 44 plugin(s) providing 38 mixin implementations, 48 hook handlers
2019-05-27 22:19:03,498 - octoprint.server.heartbeat - INFO - Starting server heartbeat, 900.0s interval
2019-05-27 22:19:03,531 - octoprint.server - INFO - Intermediary server started
2019-05-27 22:19:03,532 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2019-05-27 22:19:03,786 - octoprint.plugin.core - INFO - Found 44 plugin(s) providing 38 mixin implementations, 48 hook handlers
2019-05-27 22:19:03,822 - octoprint.filemanager.storage - INFO - Initializing the file metadata for /home/pi/.octoprint/uploads...
2019-05-27 22:19:04,263 - octoprint.filemanager.storage - INFO - ... file metadata for /home/pi/.octoprint/uploads initialized successfully.
2019-05-27 22:19:04,288 - octoprint.plugins.mqtt - ERROR - No broker URL defined, MQTT plugin won't be able to work
2019-05-27 22:19:04,323 - octoprint.plugins.softwareupdate - INFO - Loaded version cache from disk
2019-05-27 22:19:04,335 - octoprint.plugins.multi_colors - INFO - MultiColors init
2019-05-27 22:19:06,770 - octoprint.util.pip - INFO - Using "/home/pi/oprint/bin/python -m pip" as command to invoke pip
2019-05-27 22:19:09,267 - octoprint.util.pip - INFO - Version of pip is 9.0.1
2019-05-27 22:19:09,269 - octoprint.util.pip - INFO - pip installs to /home/pi/oprint/lib/python2.7/site-packages (writable -> yes), --user flag needed -> no, virtual env -> yes
2019-05-27 22:19:09,270 - octoprint.util.pip - INFO - ==> pip ok -> yes
2019-05-27 22:19:09,276 - octoprint.plugin.core - INFO - Initialized 38 plugin implementation(s)
2019-05-27 22:19:09,295 - octoprint.cli.server - ERROR - Uncaught exception
Traceback (most recent call last):
File "/home/pi/oprint/bin/octoprint", line 9, in
load_entry_point('OctoPrint==1.3.11', 'console_scripts', 'octoprint')()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/init.py", line 609, in main
octo(args=args, prog_name="octoprint", auto_envvar_prefix="OCTOPRINT")
File "/home/pi/oprint/local/lib/python2.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/pi/oprint/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/pi/oprint/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/oprint/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/cli/server.py", line 206, in serve_command
ignore_blacklist)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/cli/server.py", line 118, in run_server
octoprint_server.run()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/init.py", line 478, in run
extra=dict(plugin=plugin._identifier))
UnboundLocalError: local variable 'plugin' referenced before assignment

One of your plugins is failing and causing this issue (your log looks like it is not from safe mode - does it start in safe mode?).

The fact that this stops the server from starting instead of just gracefully handling it is a bug that will be fixed in 1.3.12.

What plugins do you have installed? I see you have quite a number of them.

Also, no, you should not have to change anything in the init script and octoprint also doesn't install itself to .octoprint - that's where its settings live, not its program code. It would help if you could clarify the issues you ran into that made you change the init script (and in what way you changed it).

/usr/bin/octoprint also never did exist on OctoPi, the default file for the init script correctly configured things to use /home/pi/oprint/bin/octoprint.

[quote="foosel, post:3, topic:9824"]
/home/pi/oprint/bin/octoprint
[/quote] is where I changed the unit script to look, I wrote the wrong location here. Originally it was pointing to /usr/bin/octoprint.
So, is it possibly to downgrade Octoprint back to pre 1.3.11 to be able to upgrade all the plugins and try the upgrade to 1.3.11 again?

The init script is by default pointing there, but that gets overwritten by /etc/default/octoprint. Again, there should be no change at all to modify the init script in any way on OctoPi, everything should be correctly configured out of the box.

So I am not sure why I didn't catch that the variable was being re-assigned from /etc/default/octoprint, that was a dumb mistake on my part.
After downgrading back to 1.3.10 and restarting both octoprint and touchui services everything's back up as expected.
I will try to upgrade the plugins then try the upgrade to 1.3.11 again. Hopefully it's just an older plugin that caused the issue. If there's an easy way of exporting the list of plugins and versions I can paste them here for scrutiny.

Guess I should've just looked in the log first. Here's the plugins I have loaded:

2019-05-28 09:06:49,505 - octoprint.plugin.core - INFO - 44 plugin(s) registered with the system:
| Action Command Prompt Support (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/action_command_prompt
| Announcement Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/announcements
| Anonymous Usage Tracking (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/tracking
| Application Keys Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/appkeys
| Backup & Restore (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/backup
| Bed Leveling Wizard (0.2.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_bedlevelingwizard
| Core Wizard (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/corewizard
| Cost Estimation (2.1.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_costestimation
| !Cost Plugin (0.1.3) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_cost
| !CuraEngine (<= 15.04) (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/cura
| Cyborg Theme (0.1.6) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_cyborgtheme
| Discovery (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/discovery
| Display ETA (1.0.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_eta
| !DisplayLayerProgress Plugin (1.7.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_DisplayLayerProgress
| DisplayProgress (0.1.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_displayprogress
| DisplayZ (0.1.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_displayz
| EEPROM Repetier Editor Plugin (0.1.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_eeprom_repetier
| !Enclosure Plugin (3.51) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_enclosure
| Extra Distance Buttons (0.1.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_extradistance
| Fan Speed Control (0.2.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_fanspeedslider
| Force Login (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/forcelogin
| Fullscreen Plugin (0.0.4) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_fullscreen
| GcodeEditor (0.1.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_GcodeEditor
| HeaterTimeout (0.0.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_HeaterTimeout
| LED Strip Control (0.3.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_LEDStripControl
| Logging (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/logging
| MQTT (0.8.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_mqtt
| Multi Colors (1.0.16) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_multi_colors
| !Nautilus (1.20) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_nautilus
| !OctoLapse (0.2.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_octolapse
| Pi Support Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/pi_support
| Plugin Manager (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/pluginmanager
| Preheat Button (0.3.1) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_preheat
| Print History Plugin (1.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_printhistory
| !Printer Safety Check (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/printer_safety_check
| Printer Stats (1.0.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_stats
| PSU Control (0.1.8) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_psucontrol
| Software Update (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/softwareupdate
| Tempsgraph Plugin (0.3.4) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_tempsgraph
| Terminal Commands (0.1.6) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_TerminalCommands
| The Spaghetti Detective (Beta) (0.5.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_thespaghettidetective_beta
| Themeify (1.2.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_themeify
| TouchUI (0.3.12) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_touchui
| Virtual Printer (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/virtual_printer

I'd suggest to take a look into the startup log of 1.3.10 because I'm fairly sure it should log an error for the affected plugin there as well. Might help to narrow it down.

Please format your log file to make it easier to read.

You have a lot of plugins installed.

Yeah, more than I realized and so I did clean some of them, but the two offending plugins that were having errors during startup were DisplayETA and LED Strip Control.
So, I should be able to upgrade, but I guess it begs the question that why from 1.3.10 to 1.3.11 broken plugins crash everything, and the fix is planned in 1.3.12?

The upgrade took without an issue and everything seems to be working as expected.