Engineer's Asylum

Avrdude ser_open() can't open device /dev/ttyacm0 permission denied

#1

I have some problem with my Arduino Uno and newly installed Linux PC. The code just compiles fine but has a problem uploading to the board. It seems like Linux can’t open device /dev/ttyacm0. How to fix this issue with the USB port?

0 Likes

#2

By default, access to the serial and USB ports in Linux is restricted to root and dialout group users. To access your Arduino over USB, it is mandatory that your Linux user belongs to this group. What you need to do is make your user a part of the group associated with the USB device.

For this, you have to add the group dialout to your user using the usermod command. This command requires root privileges to run.

1 Like

#3

I am a novice in Linux OS. I am not all familiar with Linux command, especially the one with users and groups. How to use the usermod command?

0 Likes

#4

Open Terminal and type:

ls -l /dev/ttyACM*

you will get something like:

crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACM0

The “0” at the end of ACM might be a different number for you, or multiple entries might be returned. The data we need is “dialout”. The “dialout” is the group which own the file/usb ( Since everything in linux is a file ).

Now we just need to add our user to this “dailout” group. For this use the below code,

sudo usermod -a -G dialout <username>

where <username> is your Linux user name.

Note: You will need to log out and log in again for this change to take effect.

After this, you will be able to upload the code without any issues!!

Reference: https://www.arduino.cc/en/guide/linux

4 Likes