SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By lugnut
#196190
Here's a long story about troubles uploading a sketch to Sparkfun Pro Micro.

I'm using an Arch Linux based distro with Arduino IDE for the first time. Installation went smooth, but the sketch would not upload. Many errors about missing serial ports or port permissions and other errors. The /dev/ttyACM0 port would appear after a double reset click, then disappear in a few seconds. Trying to upload in this window of time did not work. More errors about port permissions, port busy, etc.
sudo arduino did not help
I added my user to the uucp group to get access to ttyACM0. That changed things, but still no upload.

After a few hours of web search and trials, this looked interesting:
http://starter-kit.nettigo.eu/2015/seri ... nardo-eth/

Many Linux distros use systemctl for init and include something called ModemManager. ModemManager thinks any new serial port is a modem and checks it for network access. It grabs the port faster than arduino IDE can upload. The port is always busy when arduino IDE tries. Avrdude crashes or hangs as a result.

Step 1
sudo systemctl stop ModemManager This stopped the service. Suddenly arduino IDE started uploading. ttyACM0 stopped disappearing. It's a temporary fix since ModemManager will start at next PC boot.
Step 2
Thanks to the link above, a udev rule can be written to stop this port grabbing behavior.
Create a file with root permission in /etc/udev/rules.d Let's call it 99-arduino.rules Specify VID numbers for ModemManager to ignore. I put this text in the file:
# for arduino brand, stop ModemManager grabbing port
ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1"
# for sparkfun brand, stop ModemManager grabbing port
ATTRS{idVendor}=="1b4f", ENV{ID_MM_DEVICE_IGNORE}="1"

Save the rules file (as root) and reboot the PC. Arduino IDE then works great with the Pro Micro.

Your system might be different, be careful. A distro with SysVinit probably won't see this issue. I hope this long story helps someone with Linux and sketch upload issues.

Regards,
Bob U.