Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload to Leonardo sometimes fails with Permission denied #11797

Open
dimich-dmb opened this issue Jun 15, 2022 · 1 comment
Open

Upload to Leonardo sometimes fails with Permission denied #11797

dimich-dmb opened this issue Jun 15, 2022 · 1 comment
Labels
Component: Uploading Uploading programs to an Arduino board Type: Bug

Comments

@dimich-dmb
Copy link

Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, /dev/ttyS0, /dev/ttyS4, /dev/ttyS5, } / {/dev/ttyS0, /dev/ttyS4, /dev/ttyS5, } => {}
PORTS {/dev/ttyS0, /dev/ttyS4, /dev/ttyS5, } / {/dev/ttyACM0, /dev/ttyS0, /dev/ttyS4, /dev/ttyS5, } => {/dev/ttyACM0, }
Found upload port: /dev/ttyACM0
//bin/avrdude -C//etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_862951/semaphore.ino.hex:i.

avrdude: Version 7.0
         Copyright (c) Brian Dean, http://www.bdmicro.com/
         Copyright (c) Joerg Wunsch

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

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
avrdude: opening programmer "avr109" on port "/dev/ttyACM0" failed

This happens because udev applies permissions to device files non-atomically: first it creates /dev/ACM* with root:root ownership and then GROUP="uucp" is applied. When SerialUploader detects port appearence it invokes avrdude immediately, even if ownership/permissions aren't yet applied.

Possible solution is to wait for port is accessible, e.g. with access(port, R_OK | W_OK).

@per1234 per1234 added Type: Bug Component: Uploading Uploading programs to an Arduino board labels Jun 15, 2022
@cropinghigh
Copy link

Same problem on Manjaro with udev rule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Uploading Uploading programs to an Arduino board Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants