I'm trying to upload anything to my Arduino Uno Wifi Rev2, I'm on Arch Linux, but I'm failing with the following error be it via IDEv2 or arduino-cli
:
avrdude: usbdev_open(): cannot open device: Permission denied
avrdude: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2145
The device permissions:
crw-rw-rw- 166,0 root uucp 9 Jan 23:22 /dev/ttyACM0
My udev rule:
KERNEL=="ttyACM[0-9]",MODE="0666",GROUP="uucp",TAG+="uaccess"
lsusb
:
Bus 001 Device 005: ID 03eb:2145 Atmel Corp. ATMEGA328P-XMINI (CDC ACM)
First two entries from udevadm info -a -n /dev/ttyACM0
:
looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1/tty/ttyACM0':
KERNEL=="ttyACM0"
SUBSYSTEM=="tty"
DRIVER==""
ATTR{power/control}=="auto"
ATTR{power/runtime_active_time}=="0"
ATTR{power/runtime_status}=="unsupported"
ATTR{power/runtime_suspended_time}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1':
KERNELS=="1-3:1.1"
SUBSYSTEMS=="usb"
DRIVERS=="cdc_acm"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="02"
ATTRS{bInterfaceNumber}=="01"
ATTRS{bInterfaceProtocol}=="01"
ATTRS{bInterfaceSubClass}=="02"
ATTRS{bNumEndpoints}=="01"
ATTRS{bmCapabilities}=="6"
ATTRS{iad_bFirstInterface}=="01"
ATTRS{iad_bFunctionClass}=="02"
ATTRS{iad_bFunctionProtocol}=="01"
ATTRS{iad_bFunctionSubClass}=="02"
ATTRS{iad_bInterfaceCount}=="02"
ATTRS{physical_location/dock}=="no"
ATTRS{physical_location/horizontal_position}=="left"
ATTRS{physical_location/lid}=="no"
ATTRS{physical_location/panel}=="top"
ATTRS{physical_location/vertical_position}=="upper"
ATTRS{supports_autosuspend}=="1"
I feel like I've tried everything so far:
sudo chmod a+rw /dev/ttyACM0
sudo usermod -a -G uucp $USER
- adding udev rule with all different configs (although if chown/chmod doesn't work what will it change??)
- changing ownership to my user...
- I checked the process for the IDE to make sure it runs on my user and it does
- After all these steps I always either restarted and/or reloaded everything with
sudo udevadm control --reload-rules && sudo udevadm trigger
- Went through plethora of similar topics, no clues
I feel like I must be doing something awfully stupid here, it doesn't make any sense to me why it wouldn't work even after I chown'ed it to my user...
1 Answer 1
Looking at the board definition for the UNO WIFI R2, it doesn't use the serial port for upload. It's using an mdbg chip that it speaks to over a non-cdcacm USB protocol. Getting yourself into the group-owner for the serial device is good for communicating to the board through the serial monitor though.
The megaavr board package seems to come with a file for creating your udev rules that you should find at:
"${USER}/.arduino15/packages/arduino/hardware/megaavr/1.8.8/scripts/create_dfu_udev_rule"
The 1.8.8 subdirectory of megaavr is current as of writing. It will no doubt change. I still have 1.8.7 on my system.
Running it should create the necessary udev rule for allowing avrdude to speak directly to the USB device. Specifically they're adding this:
SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2145", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
They seem to be creating a udev rule for the tty device as well, though that shouldn't strictly be necessary given what you've already done with becoming a member of the serial device's group. Basically you're doing it by becoming a member of the owning group where what they did was just open the device up to RW permissions for everyone.
-
It worked! Thank you so much for that insight, I wouldn't have figured it out in a reasonable time on my own for sure, I just ran the script to add both tty and usb rules, and removed the one I made previously. I haven't tested if adding just the usb rule works but afair the perms on the tty device were alright (rw for the owner group)nieomylnieja– nieomylnieja2023年01月10日 07:55:56 +00:00Commented Jan 10, 2023 at 7:55
-
could u send the exact commands u used to fix the error? @nieomylniejaS G– S G2023年09月16日 22:11:03 +00:00Commented Sep 16, 2023 at 22:11
-
You can try
sudo "${USER}/.arduino15/packages/arduino/hardware/megaavr/1.8.8/scripts/create_dfu_udev_rule"
It may work. I can't practically do that for every version of every distribution of Linux in combination with every core version and executed from every command shell. In case this isn't clear, "${USER}" will evaluate to your user name. Or rather it will in bash. 1.8.8 is current as of this comment.timemage– timemage2023年09月17日 02:06:34 +00:00Commented Sep 17, 2023 at 2:06