Leonardo BareMinimum Upload Failure with Linux

Hi Everyone: I have a little bit of programming and computer tech support experience albeit it is somewhat dated and I was never an expert. I am just getting started with the Leonardo.

My goal is to build button boxes for flight simulators using Leonardo because it has keyboard emulation and mostly I just want to send keyboard commands to the computer using buttons and switches and rotary encoders.

I have a genuine Leonardo, Linux Mint 18, and Arduino IDE 1.8.2. I followed the installation instructions and troubleshooting to get the IDE installed and then I went to YT and tried to follow some example code that a gentleman wrote to get the keyboard to work. When I tried to upload it I got a port not found error.

So I went back to troubleshooting guide at arduino.cc and ran the "sudo usermod -a -G dialout " command and seemingly the IDE could now see the board. I had to do some resets, but if I go to serial monitor at this point it displays "TEST OK" about every second or so.

The port shows up as /dev/ttyACM0 (Arduino Leonardo) on the title bar of the serial monitor window.

So thinking that part of my problem is that the example code from this guy is no good or that I have it pinned out wrong. I just wanted to start out with uploading basically a do nothing at all program to check if the upload process works and then try again at easing into this. Basically the short term goal would be to flick a toggle switch and send "g" to the computer for gear down, and then SHIFT + "g" (gear up in the flight simulator) using the same switch. So if the state of the switch is read LOW (gear up) and HIGH (gear down) or vice versa. That's my interim goal but the long term goal is to also work with rotary encoders, etc.

Anyway, so right now, just to eliminate incorrect pinning/wiring as being an issue all I want to do is to upload a do nothing program into Leonardo to make sure I can actually upload something. I don't care what the program is really, I just want to upload something. Anyway when I try to upload the "BareMinimum" example this is the error I get:

Arduino: 1.8.2 (Linux), Board: "Arduino Leonardo"

Sketch uses 3602 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 147 bytes (5%) of dynamic memory, leaving 2413 bytes for local variables. Maximum is 2560 bytes.
avrdude: ser_open(): can't open device "/dev/ttyACM0": Device or resource busy
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
processing.app.SerialException: Error opening serial port '/dev/ttyACM0'.
	at processing.app.Serial.<init>(Serial.java:139)
	at processing.app.Serial.<init>(Serial.java:78)
	at processing.app.SerialMonitor$3.<init>(SerialMonitor.java:95)
	at processing.app.SerialMonitor.open(SerialMonitor.java:95)
	at processing.app.AbstractMonitor.resume(AbstractMonitor.java:110)
	at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2185)
	at processing.app.Editor.access$2200(Editor.java:78)
	at processing.app.Editor$DefaultExportHandler.run(Editor.java:2163)
	at java.lang.Thread.run(Thread.java:745)
Caused by: jssc.SerialPortException: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
	at jssc.SerialPort.openPort(SerialPort.java:164)
	at processing.app.Serial.<init>(Serial.java:128)
	... 8 more
Error opening serial port '/dev/ttyACM0'.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

So I have attached the verbose output here as well.

Anyway, even after I get this error if I go back to serial monitor it is still going "TEST OK". So I don't know what to try as the port appears to be working. Any help much appreciated.

verboseerror.txt (5.04 KB)


if you have installed "modem manager" on your Linux box (it's default on many distros) you can try to disable or uninstall it (services - How can I remove modem-manager from boot? - Ask Ubuntu)

Modem manager tries to open any serial port checking if it's a modem and this usually creates conflicts with the upload mechanism.
Because you probably don't have a modem on your PC you can safely uninstall the package to solve the issue.

I hope this helps



Yup that worked like a charm! THANK YOU SO MUCH!

Please note that for LinuxMint and Ubuntu you can probably uninstall modemmanager using the GUI (Software Manager for Mint and Ubuntu Store (I believe) for Ubuntu).

The modemmanager issue should be on the installation and troubleshooting webpages. Linux is open source and very much at the forefront of the movement and is very empowering to economically challenged individuals and regions in the world.

Also, sorry for the long delay but in utter frustration I put the IDE on my Windows 10 gaming machine where it connected. But I am SOOOOO glad to have it working on my Linux machines which I use for everything but games (i.e. work, social media, etc.).

I've been tearing my hair out trying to program the Leonardo on a LattePanda Alpha 864s. Uninstalling modemmanager fixed the issue!

I know this is a long dead thread but I figured I try to throw in the key words for others having the same issue.