I was using Arduino IDE on my Arch Linux laptop without problems, after some time /months I'm not able to upload the sketch because of permissions:
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
I can access and write to the device with minicom
without problems, because permissions are good:
crw-rw-rw- 1 root uucp
My user is in the uucp
group. But when I start sketch uploading, regarding to the dmesg
, the usb device is being reconnected and in that moment I can see different permissions:
rw------- 1 root root
And after some time (seconds) permissions are back as they were. dmesg
output here:
[ 313.042695] usb 2-1.2: USB disconnect, device number 3
[ 313.253085] usb 2-1.2: new full-speed USB device number 4 using ehci-pci
[ 313.352387] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[ 321.234517] usb 2-1.2: USB disconnect, device number 4
[ 321.439445] usb 2-1.2: new full-speed USB device number 5 using ehci-pci
[ 321.541392] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
...
I've tried to solve that with several custom udev rules, but without success:
SUBSYSTEMS="usb", ATTRS{idVendor}== "2341", GROUP="uucp", MODE="0666"
KERNEL=="ttyACM[0-9]*", SYMLINK+="%k", GROUP="uucp", MODE="0666"
How to force group or mode from the first moment when appeared in the system? I hope this is not just a bug in the Arduino 1.8.3. Kernel version 4.11.9-1-ARCH.
EDIT #1:
I found that usb reconnection behavior occurs after exiting minicom
too, but in case of avrdude
this is problem because it is happening when program needs to access the device.
Screencast here
EDIT #2:
After some time I came back to this issue and I found I have problem just with ttyACM0
(Yun/Micro/etc. connected with microUSB cable) and ttyUSB0
(Uno connected with USB-B) is ok. But even this is interesting clue I can't figure it out.
I'm monitoring the rights on the tty devices:
watch -n 0.1 'ls -la /dev/ttyUSB* /dev/ttyACM*'
- when uploading to
ttyUSB0
just the date/time is changing and everything is working - when uploading to
ttyACM0
device disappeared for a moment then a new one with wrong rights (androot:root
) has been created, upload failed and then right are set properly by udev (withroot:uucp
) ... and then another one cycle (disappear-wrong-correct)
My user is in the lock
and uucp
groups, I've tried to add some udev rules or disable them but without success ...
I'm for 99% sure this is something before udev rule is touching it.
avrdude
from resetting port upon the upload.