Octoprint returning iotcl error always


What is the problem?
When hitting the "connect" button on the OctoPrint dashboard, I get this error in the terminal: Error: IOError: '[Errno 25] Inappropriate ioctl for device'
regardless of whether any printers are plugged into/on the same network as the RPi, making me think this is an issue with the RPi. I am using dev/ttl/AMA0 as my serial port and have tried with printers plugged into the Ethernet and USB ports of the RPi. I'd really appreciate any help on the matter, thank you!

What did you already try to solve it?
Updating pyserial, editing cmdline.text to try to permit use of serial ports, reinstalling Octopi image, installing GBX plugin for flashforge printer

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
OctoPrint version : 1.3.8
OctoPi version : 0.15.1
Running on Raspberry Pi 3 Model B, 1GB RAM
Printer: Ultimaker 3 (wireless) and Flashforge (wired USB)

Exact Terminal output:
Connecting to: /dev/ttyAMA0
Changing monitoring state from "Offline" to "Opening serial port"
Connected to: Serial<id=0x6ba4a990, open=True>(port='/dev/ttyAMA0', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=10.0, xonxoff=False, rtscts=False, dsrdtr=False), starting monitor
Starting baud rate detection
Changing monitoring state from "Opening serial port" to "Detecting baudrate"
Unexpected error while reading serial port, please consult octoprint.log for details: IOError: '[Errno 25] Inappropriate ioctl for device' @ comm.py:_readline:2417
Changing monitoring state from "Detecting baudrate" to "Offline (Error: IOError: '[Errno 25] Inappropriate ioctl for device' @ comm.py:_readline:2417)"
Connection closed, closing down monitor


I'm not aware that the UM3 supports serial printing, and for the Flashforge it strongly depends on what exact model you have whether the GPX plugin will be able to help you or not.

Also: /dev/ttyAMA0 is usually the serial port of the Raspberry Pi itself (so completely unrelated to the printer) and you shouldn't have to enable anything in cmdline.txt to get serial-over-USB printers to run with OctoPrint/recognized by OctoPi.


Ok thank you! Does this seem to be an issue of me not having the right plugin for the Flashforge printer then? It seems strange that I get the same error message even when there are no printers connected to the RPi. And we have the FlashForge Inventor model, which according to their website supports STL/OBJ input file types and G/GX output file types, which is not the s3g/x3g supported by GPX, but when we upload files it accepts the x3g file type so I would expect the plugin to work, but it did not change the error


Sorry one more thing does what you said about tty/AMA0 mean that port can read/write through any physical port and the network? Or do I need to assign it to whichever physical port/network input is connected to the printer


The error is the underlying operating system telling OctoPrint (and by extension you) that something goes wrong while trying to configure the serial port. Which I could imagine it's due to the fact that you try to configure an already confused serial port bringing to the pi (and completely unrelated to your printer).

OctoPrint can only talk to the printers that understand gcode or - thanks to the gpx plug-in - x3g (which the plug-in converts to on the fly from gcode) through a serial connection (network is currently not supported).

I'm not aware that the Inventor supports either, or that the UM3 supports serial, so I fear you are out of luck with both of those printers.

I don't understand the question. You can't "assign" anything, either your printer has a serial interface that can be detected by the operating system and that supports the above protocols, or it doesn't. You won't be able to change that by editing around in the pi config.


Thank you so much for your help, I will continue to look into serial connections with the printers to see if I can make it work. For the AMA0 question, what I was asking is in the Octoprint dashboard there is a drop down for "Serial Port" in the connection menu, and I was wondering if I select dev/ttyAMA0 in that menu, would the Pi be able to search for printers through all of its USB ports (I'm guessing not the Ethernet because only serial connections work), or does AMA0 somehow only correspond to one of the USB ports.


Each entry in that drop down (besides AUTO) corresponds to one detected serial port. Serial ports don't have to correspond to a USB port - the Pi has its own serial port exposed on its GPIO pins (that's usually /dev/ttyAMA0, and why I said this port is most likely not any of your printers), and a USB device could provide any number of serial ports as well.

OctoPrint will show you serial ports in that drop down it detected that match patterns known to relate to serial ports provided by USB serial converters. If you don't see any port in there besides /dev/ttyAMA0 (which btw shouldn't even show up there by default, I guess you have added it as additional port?) then the underlying operating system OctoPrint is running on (Linux if you are using OctoPi) is not seeing any additional serial ports, meaning your printer isn't being detected as one. Sometimes that can be fixed by some configuration of the drivers of the underlying operating system, but usually it can't.

My guess is here it can't. If I were you I'd try to find some people with the same printer online that can tell you whether it can communicate via a regular serial connection (e.g. with Pronterface, OctoPrint, Repetier Host) or if it definitely only works with this proprietary Flashprint thingy. Flashforges past couple of printers all had a proprietary interface completely locking out common tooling, so I wouldn't be surprised if that one shares that fate.

And as I mentioned, AFAIK the UM3 only has a network interface and that's currently not yet support in OctoPrint (someone with access to a UM3 would need to add support through a plugin, as far as I know nobody has done this yet).


I understand now, thank you so much for your help!