1

Dealing with this very common issue on IDE v2.0.0., but not sure why.

I should be fine group-wise:

adm tty dialout cdrom sudo dip plugdev lpadmin lxd sambashare docker

I've also seen numerous suggestions to change the device's permissions directly via chmod a+rw /dev/<device>. This is terrible advice, but nothing is working so far, so I tried it anyway. It also doesn't work, as at some point during the upload process, the device is removed and recreated, resetting the permissions.

edit: I've also ensured that ModemManager is not running, and has been purged from the system.

Running the IDE as root always fails, including when the --no-sandbox argument is passed.

I'm using the AppImage download on Ubuntu 22.04, but I tried the zip download, with the same results.

edit: Previously in this spot was a note about this problem not occurring on IDE v. 1.8. That wasn't actually the case - I was just testing with a board that doesn't remove and re-create the device on upload. Using a board where that does occur (Arduino Micro in this case), the error occurs in 1.8 as well.

Using avrdude directly (as my normal user account) also works just fine.

Additional observation - when the device is recreated by the OS after plugging the Arduino board in, it's first created with crw------- 1 root root permissions, and remains in that state for a very short period of time before switching to crw-rw----+ 1 root dialout permissions, at which point uploads work as expected.

14
  • 1
    You have since rebooted (or at least logged out and in) to be certain that any chances you made to your group membership has been inherited to all processes involved?
    – timemage
    Commented Oct 1, 2022 at 18:57
  • @timemage I've been a member of those groups for literally years, so I have extreme confidence that all my groups are correct. This isn't the first time I've head to deal with this, but nothing is working this time around. Again, 1.8 works fine.
    – x1a4
    Commented Oct 1, 2022 at 21:43
  • Well, I use the 2.0 IDE a little bit, but the system I'm no now is not Ubuntu, nor Debian based. If no new information shows up I may install Ubuntu in a VM may a USB device into it and see what happens when I try there. Given "using avrdude directly... works just fine", what exactly is producing this message? avrdude only as launched by the 2.0 IDE? When you tested avrdude did you test with a system installed one or the avrdude out of the .arduino15 directory? Do you see anything interesting in an strace?
    – timemage
    Commented Oct 1, 2022 at 22:05
  • 1
    Ah forgot to mention that in the original message, but yeah, ModemManager has already been purged from the system.
    – x1a4
    Commented Oct 2, 2022 at 0:57
  • 1
    You can drop all the Edit: stuff. So there's no saga to follow. Just have it be the symptom that people are likely to find with search terms and then move all the answer material into an answer. Offhand the only input I have on the answer is that it's solvable at different levels. One is removing the package entirely another being the specific edit.
    – timemage
    Commented Oct 2, 2022 at 23:11

1 Answer 1

2

After a long debugging session in chat, we've determined that a udev entry installed by the apt package laptop-mode-tools takes a long time to run, leading to the permissions not settling on the USB device until after the IDE has attempted to upload.

This problem happens even when laptop-mode isn't enabled because you're e.g. using AC. You don't need to be actually using a laptop for this problem to occur, as laptop-mode-tools is a generic power-saving package that can be installed anywhere.

The udev rule in question is ACTION=="add", SUBSYSTEM=="usb", RUN+="lmt-udev force" in the file /lib/udev/rules.d/99-laptop-mode.rules.

Commenting out that udev rule, or changing force to auto resolves the problem for me (without needing to restart udev, or anything else).

Larger hammers that can be used to resolve this include setting ENABLE_LAPTOP_MODE_TOOLS to 0 in /etc/laptop-mode/laptop-mode.conf, or simply removing laptop-mode-tools from the system entirely.

@timemage gets the credit for this fix.

1
  • 1
    Yeah. An Arduino user stands chance of finding this avoiding some grief with it. I may tack on some comments later that you can integrate (or not). The only one I'll mention now is just that this problem will not be particularly noticeable for a board that with a dedicated serial transceiver, e.g. the UNO, NANO, Mega, ESP8266 boards, because they don't re-enumerate on the USB bus during each reset/upload. Once the permissions become correct (quickly or slowly) the remain correct until disconnected.
    – timemage
    Commented Oct 2, 2022 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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