Octoprint stops connecting to printer


What is the problem?

octoprint stops connecting

What did you already try to solve it?

change usb ports

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

anet a 8

ramps 1.4

OctoPi 0.15.1

marlin 1.9

terminal log:
Connecting to: /dev/ttyUSB0
Changing monitoring state from "Offline" to "Error: Connection error, see Terminal tab"
Unexpected error while connecting to serial port: /dev/ttyUSB0 SerialException: '[Errno 5] could not open port /dev/ttyUSB0: [Errno 5] Input/output error: '/dev/ttyUSB0'' @ comm.py:_openSerial:2478 (hook default)

tail -f /home/pi/.octoprint/logs/octoprint.log
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py ", line 2478, in _openSerial
serial_obj = factory(self, self._port, self._baudrate, settings().getFloat([ "serial", "timeout", "connection"]))
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py ", line 2468, in default
File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/serialutil.py", line 240, in init
File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/serialposix.py" , line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._p ort, msg))
SerialException: [Errno 5] could not open port /dev/ttyUSB0: [Errno 5] Input/out put error: '/dev/ttyUSB0'

On some occasion without doing anything, it has worked again, but it happens again without explanation


You might try putting it back into the original USB port. It's possible that the offending port is damaged or there's some sort of configuration change throughout that's affecting that one USB.

Q) Why change it if it worked before? A) "Because I needed that one for my webcam..." (If you've added anything else, also include this information since it's part of the troubleshooting process.) Why was it necessary to change the port?


Change usb port because I got that error and it comes out in the 4 ports I did not make any change just started to get the error out of nowhere, I printed off the raspberry I went to sleep and the next day I got that error ... I changed and restarted about 15 times and one of the times it worked for me and today it failed again


Hi @davlinares!

Test with another cable. Maybe a lead is broken and/or a connector is bend.
Test if you can get a USB connection to your PC/laptop.


I put 2 different cables ... Very bad luck would be that the 2 would be wrong ...


And the connectivity to the PC?


The raspberry pi to the pc or the printer to the pc?


The printer to the PC


I am going to buy a new cable tomorrow to see if it can be that because I have the printer away from the PC and it is very messy to move it.

but do you think that may be the problem? Should the new cable do the same thing, can it become the problem of the ramps?


If you cannot get a connection between the printer and the Raspberry pi, you have to check, if the printer can connect to another device, usually a PC to see if the printer can make a connection.

To check if the USB connectors of the Pi work, you may connect a USB cam to it and activate it in the settings. There you get an image if it works.


Temporarily use a rubber band or ponytail to securely hold the plug of the USB firmly in place. (When the printer gets going, vibrations can sometimes make/break connections, especially the ground.) If that works better, then troubleshoot this like a this-plug-isn't-firmly-connecting problem.