What is the problem?
octoprint cannot connect to my printer on fresh boot, consistently.
More specifically, after I finish a print, I come back and try another (often days later), my octokit instance cannot connect to the serial port.
The "fix" is a plain container reboot on my pi (e.g. docker restart abc123). Here's my compose.yml:
version: '2.4'
services:
octoprint:
image: octoprint/octoprint
restart: always #unless-stopped
ports:
- 80:80
privileged: true
devices:
- /dev/ttyACM0:/dev/ttyACM0
- /dev/ttyAMA10:/dev/ttyAMA10
What did you already try to solve it?
Compared the logs in the bad state (pre-restart), and the good state (post docker restart)
Bad:
2025-08-30 06:41:10,478 - octoprint.util.comm - INFO - Serial detection: Performing autodetection with 7 port/baudrate candidates: /dev/ttyACM0@115200, /dev/ttyACM0@250000, /dev/ttyACM0@230400, /dev/ttyACM0@57600, /dev/ttyACM0@38400, /dev/ttyACM0@19200, /dev/ttyACM0@9600
2025-08-30 06:41:10,479 - octoprint.util.comm - INFO - Serial detection: Trying port /dev/ttyACM0, baudrate 115200
2025-08-30 06:41:10,479 - octoprint.util.comm - INFO - Connecting to port /dev/ttyACM0, baudrate 115200
2025-08-30 06:41:10,481 - octoprint.util.comm - INFO - Failed to connect: Port /dev/ttyACM0 is busy or does not exist
...SNIP...
2025-08-30 06:41:10,502 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting serial connection" to "Error"
2025-08-30 06:41:10,503 - octoprint.util.comm - INFO - Changing monitoring state from "Error" to "Offline after error"
Good:
2025-08-30 06:41:56,287 - octoprint.util.comm - INFO - Connecting to port /dev/ttyACM0, baudrate 115200
2025-08-30 06:41:56,295 - octoprint.util.comm - INFO - Serial detection: Handshake attempt #1 with timeout 2.0s
2025-08-30 06:41:56,297 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2025-08-30 06:41:56,300 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting serial connection" to "Operational"
Have you tried running in safe mode?
I haven't!
Did running in safe mode solve the problem?
I haven't!
Systeminfo Bundle
octoprint-systeminfo-20250830065930.zip (12.4 KB)
Additional information about your setup
- pi5
- Docker version 27.4.0, build bde2b89
- $ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble