OctoPrint in docker timing out with a CR-10 S Pro

I installed OctoPrint on an Ubuntu server machine using the Docker install, with the external port at 8999 internal 80 I used a Stack in Portainer to complete the installation. I connected my CR10 S Pro to the server via USB, with a cable that was given to me by the previous owner, and is known to be working. The cable only modification is the 5V voltage that was cut from the USB A port.

What is the problem?

When I tried to connect Octoprint to the printer in the web interface, I always get the following timeout error:

Changing monitoring state from "Offline" to "Opening serial connection"
Connecting to port /dev/ttyUSB0, baudrate 115200
Changing monitoring state from "Opening serial connection" to "Connecting"
Connected to: Serial<id=0x7ca25e5e6110, open=True>(port='/dev/ttyUSB0', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=20.0, xonxoff=False, rtscts=False, dsrdtr=False), starting monitor
There was a timeout while trying to connect to the printer
Changing monitoring state from "Connecting" to "Offline"
Connection closed, closing down monitor

I cannot figure out what is wrong with it.

What did you already try to solve it?

I've tried the auto port/baudrate and then manual (/dev/ttyUSB0 and 115200 bps)

Have you tried running in safe mode?

Yes, same result!

Did running in safe mode solve the problem?

No

I did look into different logs and such, but nothing really get me over the issue. Any help will be greatly appreciated.

Hello @Jamon !

So please attach the systeminfo bundle to your next post.

It seems that the main problem is that your docker container probably doesn't have the right access to the USB device. By default, Docker keeps devices separate, so even if /dev/ttyUSB0 is on the host, octoprint inside the container can't touch it unless you tell it to.

Try running your stack with something like this:

--device=/dev/ttyUSB0:/dev/ttyUSB0

and check that the person using the container has permission to read and write to the device (the dialout group on Ubuntu). Also, make sure that the change to the USB cable isn't causing problems. Cutting the 5V line can sometimes cause strange handshakes, even if it powers the printer separately. Once the container sees the port and gets permission, octoprint usually connects at 115200 without any timeouts.

1 Like

Hello all, and thank you for your reply and suggestions.

Tonight I wanted to log into a new computer and while I was sure I had the correct password, nothing worked. I changed the password on my main computer and then I was locked out from this one too. That showed me that something was really bad or corrupted.

I then decided to do a "nuke and pave" and I deleted the stack/container/image/volume for OctoPrint. With a backup copy of my stack composer file I rebuilt the docker container and reconfigured OctoPrint from scratch. When I was in the interface I tried connecting to the printer and it worked flawlessly the first time.

I suppose I had something corrupted in my container that caused the issue. My last try with the first container added a line telling me the printer returned an invalid character, maybe that was a sign that a file was corrupted.

In any case now it’s working fine with the few tests I did.

Thank you all