I am trying to use an “Arduboy,” based on the Arduino Leonardo, with the Arduino IDE. I cannot upload the example code, however, because of the following error:
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
Before you mark this as a duplicate, here are all of the things I have tried
- Adding myself to the
dialout
group that/dev/ttyACM0
can be modified by - Running
chmod a+rw /dev/ttyACM0
every time I plug in the board - Making this udev rule:
KERNEL=="ttyACM0", MODE="0666"
None of these things worked. What did work was running it with xdg-su
like so: xdg-su -c ./arduino
. However, I think it’s not the best idea to run the thing as root every time. Is there anything I can do?
I am running openSUSE Tumbleweed.
Advertisement
Answer
The Arduino Leonardo based boards interrupt the communication with ttyACM* for a short moment (like logging in and out) during an upload. For some reason, the permissions change during this process. See the output of a repeated ls -l --full-time /dev/ttyACM0
during a failed upload:
crw-rw-rw- 1 root dialout 166, 0 2019-08-11 17:28:31.974025089 +0200 /dev/ttyACM0 ls: cannot access '/dev/ttyACM0': No such file or directory crw------- 1 root root 166, 0 2019-08-11 17:42:15.523439213 +0200 /dev/ttyACM0 crw-rw---- 1 root dialout 166, 0 2019-08-11 17:42:16.083442857 +0200 /dev/ttyACM0
I also use Tumbleweed. The only workaround that I currently know is to start the Arduino IDE as root.