How to fix AVRDUDE: ser_open(): can’t open device en Arduino

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

In this article I will explain how to solve a common error in Arduino:


avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

Background

After a long time without using Arduino I have taken my two boards (original one and the Elegoo) to do some activities with my daughter. I connect them, I’m going to put the blink to see that everything is fine and when I’m going to send it to the board it returns me the well-known error.

Arduino:1.8.5 (Linux), Tarjeta:"Arduino/Genuino Uno"

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
 Problema subiendo a la placa. Visita http://www.arduino.cc/en/Guide/Troubleshooting#upload para sugerencias.

Both my PC and my laptop have Ubuntu 18.04 installed.

Solution

I start by following the link they suggest. And I follow the steps

In tools / board Arduino/Genuino Uno is marked

In tools / serial port /dev/ttyACM0

avrdude arduino problem solution

and as the documentation suggests in case there are problems with the Drivers and permissions I open the terminal and execute:

 sudo usermod -a -G tty yourUserName
 sudo usermod -a -G dialout yourUserName

where yourUserName is your user name 🙂

Now I log out and log in again. And just in case I restart the PC / laptop.

It still doesn’t work and the Arduino documentation doesn’t help anymore. So I have continued searching, in forums and blogs. If at this point it does not work for you and you are like me. Follow the next steps

ls /dev/ttyACM0 returns /dev/ttyACM0
ls -l /dev/ttyACM0 return crw-rw—- 1 root dialout 166, 0 nov 26 16:41 /dev/ttyACM

With this we confirm that the port exists.

We will give permissions and check if our user has the necessary permissions.

 sudo chmod a+rw /dev/ttyACM0
 id devuelve 20(dialout) 

And I see that the user is within the dialout group so this part is ok.

SEE ALSO  Arduino Super Starter Kit Elegoo UNO R3 Project

What has worked for me has been reinstalling Arduino.

If you check

which avrdude

And nothing returns you reinstalling Arduino should be fixed.

sudo apt install --reinstall arduino

And if you have not managed to solve the problem, leave me a comment and I will try to help you.

Tool to fix the AVRDUDE problem

There is a script to solve this problem. You can try to see if it helps you. I have not gotten to use it but I leave it because I think it can be a useful resource.

AVRDUDE

I leave some information to better understand what AVRDUDE is. The name comes from AVRDUDE – AVR Downloader / UploaDEr

AVRDUDE is a utility to download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers using the in-system programming technique (ISP).

https://www.nongnu.org/avrdude/

AVRDUDE was initiated by Brian S. Dean as a private project as a programmer for the Atmel AVR microcontroller series.

You can find the software and much more information on the project website.

Leave a Comment