Can't Login to Octoprint


#1

What is the problem?
I can't login in to octoprint through my browser. I am able to connect via ssh though.
What did you already try to solve it?
I did everything on the error page you get in your browser.
Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
Latest version of octoprint, octopi 3B+, klipper firmware.

ValueError: bad marshal data (unknown type code)

2018-12-21 01:25:21,770 - octoprint.startup - INFO - ******************************************************************************

2018-12-21 01:25:21,772 - octoprint.startup - INFO - Starting OctoPrint 1.3.9

2018-12-21 01:25:21,775 - octoprint.startup - INFO - ******************************************************************************

2018-12-21 01:25:21,811 - octoprint.startup - CRITICAL - Could not initialize event manager: EOF read where object expected

2018-12-21 01:25:21,812 - octoprint.startup - CRITICAL - There was a fatal error starting up OctoPrint.

2018-12-21 01:36:59,931 - octoprint.startup - INFO - ******************************************************************************

2018-12-21 01:36:59,933 - octoprint.startup - INFO - Starting OctoPrint 1.3.9

2018-12-21 01:36:59,934 - octoprint.startup - INFO - ******************************************************************************

2018-12-21 01:36:59,945 - octoprint.startup - CRITICAL - Could not initialize event manager: EOF read where object expected

2018-12-21 01:36:59,946 - octoprint.startup - CRITICAL - There was a fatal error starting up OctoPrint.

2018-12-21 01:37:40,390 - octoprint.startup - INFO - ******************************************************************************

2018-12-21 01:37:40,392 - octoprint.startup - INFO - Starting OctoPrint 1.3.9

2018-12-21 01:37:40,393 - octoprint.startup - INFO - ******************************************************************************

2018-12-21 01:37:40,406 - octoprint.startup - CRITICAL - Could not initialize event manager: EOF read where object expected

2018-12-21 01:37:40,407 - octoprint.startup - CRITICAL - There was a fatal error starting up OctoPrint.


#2

Welp, there are errors. You see those too, right?


#3

Yeah I have no clue what they mean though.


#4

Could be that the *.pyc files are trashed (didn't compile).

Klipper firmware. Do you run the client side of that?


#5

What do you mean by client side?


#6

The Klipper firmware requires you to run something on the Raspberry Pi in this case.

I might suggest that if you're not a rocket scientist, then Klipper could be too complicated for you. It's a great solution for people who've been 3D printing for about a year, they have one or more 3D printers and they've built one from scratch. It's a bit advanced and requires knowledge of many things.


#7

Well I’m a mechanical engineer and klipper has been running great for me so I’d rather just trouble shoot it and learn


#8

Did you follow the instructions on the link I provided?

Has it ever worked with Klipper before?


#9

Oh sorry on my phone so I missed that. I’ve had octopi and klipper running for 3 months now. It just randomly stopped working.


#10

I'm searching the Klipper repository's issues for anything like this but I'm not seeing it.

Honestly, I'd take it there and see what that author makes of it. I've been through the OctoPrint code and I'm just not seeing what could be throwing those error messages. That doesn't mean it's not an OctoPrint problem but I just can't find it. The OctoPrint code doesn't include the word "marshal" anywhere, for example. Neither does Klipper unfortunately.

If Klipper weren't involved and this were on my own instance, I'd consider stopping the OctoPrint service, deleting all the *.pyc files and starting OctoPrint again. In theory, it will recompile Python in the absence of a compiled version in place. Of course, I'd do this having backed up the microSD as a fall-back.

I base this on the following StackOverflow thread.

This can happen if you have Python 2.7 .pyc files and you try to load them using Python 3.5.

Try this theory: OctoPrint uses Python 2.7 in its virtual environment and your Klipper's client install piece just dropped in some 3.5-compiled *.pyc files, causing the mismatch.


#11

Okay yeah I mean just starting from scratch is the next step I just wanted to see if it might be a common issue with an easy fix. My printer is still showing the klipper software in the led screen and I have a fine ssh connection to the pi. Maybe something just got corrupted idk


#12

There may be an easy fix as I've suggested. If you're considering starting from scratch (as I would do as a developer to ensure a pristine rig), I'd still try the following:

  1. Use ApplePi-Baker to backup the microSD at this point to an IMG file
  2. Back into the Pi, stop the OctoPrint service: sudo service octoprint stop
  3. Optionally if there is a Klipper service running, stop this as well
  4. Remove all the compiled *.pyc files within the OctoPrint space: rm -Rf ~/*.pyc
  5. Reboot

What should happen is that OctoPrint will take its own sweet time coming back up since it will need to recompile *.pc files into *.pyc versions. But it will do this within the ~/oprint virtual environment space in theory and it should then use Python 2.7 to do so.

I honestly don't know where Klipper's install script on the client places its code. If this isn't under the home directory of the pi user then this could be interesting. You want to make sure that Klipper is using the ~/oprint and its virtual environment that's been scaffolded because this includes Python 2.7. If you don't constrain the Klipper installation script within this virtual environment then it might repeat the mistake and compile under Python 3.

Klipper is an awesome project and I hope to use it myself on my own printer. I've reviewed the technique and I've done a lot of prep for this. I'm just not going to throw it onto my only printer until I've completely understood how this affects me. (I'm actually trying to figure out a way that I can install Klipper to a second Robo controller board rather than my primary.) It would be awesome if I could have something like an old-school KVM A-B switch and swap back and forth between the native Marlin fork and the Klipper setup. If I didn't have a girlfriend, I'd just buy a second printer and setup the 2nd with Klipper but that's not going to happen.


You can easily use Etcher to restore that ApplePi-Baker IMG file back to your microSD as a time machine. I do this routinely, even cloning at some point to create multiple cards.


#13

I've been busy but about to give this a go will let you know what happens


#14

Update I can't even log in to the pi now after backing it up.

Logans-MacBook-Pro:~ loganmorton1$ ssh pi@octopi.local

ssh_exchange_identification: read: Connection reset by peer


#15

scratch that its working now