A-Star 32U4 Micro on Linux -> Can’t open device “/dev/ttyACM0”: Permission denied

Using Arduino IDE 1.8.19 on Manjaro Linux with LTS kernel 6.1.23-1. I want to upload code on the Pololu A-Star 32U4 Micro but I always get the following error: avrdude: ser_open(): can’t open device “/dev/ttyACM0”: Permission denied

This is what’s working:

  • the board appears as /dev/ttyACM0
  • arduino IDE can see the board, and can identify it (showing proper ID window)

This is what I have already tried to solve the problem:

  • I added myself to the “uucp” group with sudo usermod -a -G uucp $USER (logout and reboot) without success

  • I tried sudo chmod a+rw /dev/ttyACM0 - no success

  • I tried with other microcontrollers (Arduino Nano, Teensy 4.0) and uploading code was no problem.

  • Installing udev rules did not change anything

  • I updated my kernel.

  • I reinstalled Arduino IDE.

  • I read this post in the forum and I added the line "USB_DENYLIST=“1ffb:2300 1ffb:0101” to /etc/tlp.d/00-template.conf without totally understanding though.

  • Just in case, here is the output of dmesg -d:

[ 2060.192806 < 0,081086>] audit: type=1106 audit(1681916955.589:117): pid=4861 uid=1000 auid=1000 ses=2 msg=‘op=PAM:session_close grantors=pam_systemd_home,pam_limits,pam_unix,pam_permit acct=“root” exe=“/usr/bin/sudo” hostname=? addr=? terminal=/dev/pts/1 res=success’
[ 2060.192878 < 0,000072>] audit: type=1104 audit(1681916955.589:118): pid=4861 uid=1000 auid=1000 ses=2 msg=‘op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct=“root” exe=“/usr/bin/sudo” hostname=? addr=? terminal=/dev/pts/1 res=success’
[ 2070.579427 < 10,386549>] usb 1-6: USB disconnect, device number 16
[ 2070.942742 < 0,363315>] usb 1-6: new full-speed USB device number 17 using xhci_hcd
[ 2071.085370 < 0,142628>] usb 1-6: New USB device found, idVendor=1ffb, idProduct=0101, bcdDevice= 0.01
[ 2071.085389 < 0,000019>] usb 1-6: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 2071.085398 < 0,000009>] usb 1-6: Product: Pololu A-Star 32U4 Bootloader
[ 2071.085405 < 0,000007>] usb 1-6: Manufacturer: Pololu Corporation
[ 2071.088501 < 0,003096>] cdc_acm 1-6:1.0: ttyACM0: USB ACM device
[ 2074.567022 < 3,478521>] audit: type=1101 audit(1681916969.961:119): pid=5086 uid=1000 auid=1000 ses=2 msg=‘op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct=“hz” exe=“/usr/bin/sudo” hostname=? addr=? terminal=/dev/pts/1 res=success’
[ 2074.568172 < 0,001150>] audit: type=1110 audit(1681916969.961:120): pid=5086 uid=1000 auid=1000 ses=2 msg=‘op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct=“root” exe=“/usr/bin/sudo” hostname=? addr=? terminal=/dev/pts/1 res=success’
[ 2074.568425 < 0,000253>] audit: type=1105 audit(1681916969.961:121): pid=5086 uid=1000 auid=1000 ses=2 msg=‘op=PAM:session_open grantors=pam_systemd_home,pam_limits,pam_unix,pam_permit acct=“root” exe=“/usr/bin/sudo” hostname=? addr=? terminal=/dev/pts/1 res=success’

I guess I’m still missing something. Your help will be very much appreciated.

Hello.

Have you tired disabling ModemManager as described at the end of the “Programming using the Arduino IDE” section of the A-Star 32U4 user’s guide?

If that does not resolve the issue, can you post the output from running these commands:

groups
ls -l /dev/ttyACM0

- Patrick

Hi Patrick,
disabling ModemManger did not change the error message but I noticed that the LED on the microcontroller is now blinking when I upload the code.

groups
sys tty lock network power vboxusers uucp lp disk wheel hazet
ls -l /dev/ttyACM0
crw-rw-rw- 1 root uucp 166, 0 19. Apr 21:16 /dev/ttyACM0

The output of those commands looks okay. Just in case your membership in the uucp group has not taken full effect, can you try rebooting your computer? Then can you post the full, verbose output when you try to upload to the board?

- Patrick

I have done the reboot it did not help though.
Here’s the verbose output:

Sketch uses 10318 bytes (35%) of program storage space. Maximum is 28672 bytes.
Global variables use 463 bytes (18%) of dynamic memory, leaving 2097 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, /dev/ttyUSB0, } / {/dev/ttyUSB0, } => {}
PORTS {/dev/ttyUSB0, } / {/dev/ttyACM0, /dev/ttyUSB0, } => {/dev/ttyACM0, }
Found upload port: /dev/ttyACM0
/home/hazet/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/home/hazet/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_405425/sketch_jan26a.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/hazet/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
         User configuration file is "/home/hazet/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

Problem uploading to board.  See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.
avrdude done.  Thank you.

It seems like there is probably something on your computer connecting to the bootloader’s serial port (perhaps briefly) and preventing it from being used by AVRDUDE. I suggest you try running commands like ps auxw to see all your computer’s processes and stop any of them that might be using serial ports.

Another work around you could try is following the “bootloader-before-uploading” procedure in the “Reviving using the Arduino IDE” section of the A-Star 32U4 user’s guide, which might work if whatever program is using the serial port disconnects quickly and does not leave the bootloader in a bad state.

- Patrick

Figuring out which of the processes use serial ports is not something I could do off the cuff. However, I tried the “bootloader-before-uploading” procedure you mentioned - but again no success. Thank you for your help even tough I could not find a solution. I would still be interested to find a solution if you or someone else has more ideas I could try. For now I have to keep up my productivity and I decided to work with a windows machine to finish this project.