0

I use arduino ide on arch linux with arduino uno connected via USB. I am sure that I choosed right port and board in ide menu.

when I run ls -l /dev/ttyACM* I get:

crw-rw---- 1 root uucp 166, 0 14. dub 12.44 /dev/ttyACM0
crw-rw-rw- 1 root uucp 166, 1 14. dub 12.54 /dev/ttyACM1

but when I click upload I get this error:

Sketch uses 440 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

avrdude: Version 6.3, compiled on Jul  7 2020 at 19:38:43
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "//etc/avrdude.conf"
         User configuration file is "/home/john/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM1
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "/dev/ttyACM1": Input/output error

avrdude done.  Thank you.

the selected serial port 
 does not exist or your board is not connected

Error remains on newest linux kernel and LTS.


My device is Lenovo thinkpad X390: Linux 5.11.14-arch1-1


When I plug arduino to usb and then run sudo dmesg I get this messages:

[ 1605.378324] usb 1-4: new full-speed USB device number 14 using xhci_hcd
[ 1605.520509] usb 1-4: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
[ 1605.520517] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 1605.520521] usb 1-4: Manufacturer: Arduino (www.arduino.cc)
[ 1605.520523] usb 1-4: SerialNumber: 7583434383935150E152
[ 1605.523881] cdc_acm 1-4:1.0: ttyACM1: USB ACM device
[ 1630.618749] usb 1-9: reset full-speed USB device number 10 using xhci_hcd
[ 1630.792727] audit: type=1130 audit(1618567069.016:82): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=fprintd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 1632.601215] audit: type=1100 audit(1618567070.822:83): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:authentication grantors=? acct="john" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=failed'
[ 1635.720577] audit: type=1100 audit(1618567073.942:84): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:authentication grantors=pam_faillock,pam_permit,pam_faillock acct="john" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[ 1635.721507] audit: type=1101 audit(1618567073.942:85): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="john" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
[ 1635.722751] audit: type=1110 audit(1618567073.946:86): pid=29714 uid=1000 auid=1000 ses=1 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'
[ 1635.727018] audit: type=1105 audit(1618567073.949:87): pid=29714 uid=1000 auid=1000 ses=1 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'

How can I fix this ?
Thank you for help

PS: If you need any more information, comment below and I will add it soon as possible.

6
  • 1
    What are you typing on the LInux side to start avrude? If it's a USB device, shouldn't it be opening /dev/ttyUSB0 - or some other number then 0? Try it with "-p usb" or without anything specifying the ports. – Cinaed Simson Apr 15 at 19:26
  • @CinaedSimson I am not starting avrude by my self. I just click upload in arduino IDE. – Jan Černý Apr 15 at 20:03
  • 1
    But there should be config file in the directory where you installed the software. In any case, unplug the arduino uno from the unknown hardware running arch linux, then plug it back in. Type "dmesg" and then near the bottom of the output should be the device name that your arch linux system sees the uno as - which should probably contain the words "uart" and "usb". – Cinaed Simson Apr 16 at 2:06
  • @CinaedSimson I added dmesg output to question. I installed arudino package using pacman. – Jan Černý Apr 16 at 10:02
  • 1
    @ofirule I tried that and got the same result. – Jan Černý Apr 21 at 7:46
2
+50

I had the same problem and the only fix that helped me was to disable the usb auto suspend inside the grub config.

After disabling it I could use my arduino board fine.

So I did:

  1. sudo vim /etc/default/grub
  2. search this line GRUB_CMDLINE_LINUX_DEFAULT="" (it may be already filled with different stuff inside the quotation marks)
  3. change it to contain usbcore.autosuspend=-1 somewhere inside the quotes
  4. run sudo update-grub
  5. and then reboot

This helped me because I realized after a lot of googling that the problem was actually that the arduino reconnected whenever I tried to use it. So when using minicom to access the serial output the arduino was disconnected and connected again immediately. I only noticed it when using watch -n 1 ' sudo dmesg | tail -n 20' to see what happens when running minicom.

This behavior should change after disabling autosuspend inside grub.

1
  • Hello, thank you for your answer. Unfortunately I do not use grub and do not have it even installed. I use systemdboot. – Jan Černý Apr 22 at 8:29
1

Looks like the latest Manjaro updates somehow caused the cdc_acm module to break.. In order to fix this issue, I ran the following commands:

  1. sudo modprobe -r cdc_acm
  2. sudo modprobe cdc_acm
  3. sudo chmod 666 /dev/ttyACM0
2
  • I did what you suggested and issue still remains. Still thank you for answer. – Jan Černý Apr 22 at 8:31
  • It's just a temporary fix until a permanent fix will be provided.. do the modprobe remove-install steps and right after that try to upload the sketch, need to be fast, there is some sort of a race bug in this cdc_acm driver. – Ben Peretz Apr 22 at 15:36
1

A solution sourced here that worked for me:

I was doing some more testings and got to another working solution for me. Do you, by any chance, have tlp installed and enabled?

Apparently there is this thing called usb autosuspend and tlp enables it by default (which might be sensible). All I did was to edit the file /etc/tlp.conf and change #USB_AUTOSUSPEND=1 -> USB_AUTOSUSPEND=0. After a reboot I was able to upload to the arduino, even on the latest kernel 5.11.16.

I was trying to disable the autosuspend via udev rules but I couldn't do it. I'm thinking that maybe tlp configuration takes precedence over udev rules although I'm not sure at all.

New contributor
peter.babic is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.