A Tip About Fixing the "USB Device: Permission Denied" Error (Linux Based Systems)

I was stuck in the Arduino IDE getting the following error:

avrdude: Warning: cannot open USB device: Permission denied

I searched all throughout the Move38 + Arduino Forums and could not find a working solution.

The Arduino Forum had suggested to add permissions to the user you were using. I tried that and it did nothing.

Just by chance, I was tired and decided “There’s nothing to lose, why not just try again?”

I ran *sudo* arduino rather than arduino, and it actually worked!

(It gave the Arduino IDE the correct permissions to access the serial port regardless)

In the end, I was able to upload code through the programmer.

I decided to post it here because there is no fully-defined/working solution, and because I thought other people might have had the same problem.

-ShatteredDisk

3 Likes

EDIT: Be careful where you save your .ino files. When running the IDE with sudo, the default save directory will be in a root location. (Trust me, I had to reflash Raspbian after accidentally saving a .ino in the /root directory because my desktop interface decided to stop working) After saving a file at least once, it should change the default save directory to where ever you last saved a file.

1 Like

You should not do that. The right solution is to give the correct udev permissions to a specific group that you can add users to and those users would then have the correct access rights.

http://www.krekr.nl/content/using-usbtinyisp-with-ubuntu/

3 Likes

This can be extrapolated for other Linux distributions.

Two things: First, I respect you giving me the correct answer, and I appreciate it. However, I have already tried this method and many others found online on Ubuntu, Linux, and Arduino forums and it does not seem to work for me. I agree, the method I gave is probably not the best option, however it works ever so slightly better for me, and that’s good enough from my view. The next thing I will say is that I’m not saying my answer is the best one, but it’s the one that works best for me, and might work the best for others.

-ShatteredDisk

If you did it like described on that link and it did not work, it is most likely because your dev-kit for some reason has different vendor/device ids. Can you post the output of lsusb when the dev kit is connected?

Your method, unfortunately, is a security risk. Even without a malicious actor involved, it could result in bad things simply because Arduino is running as root (like you mistakenly overwriting the wrong file). It is great that it worked for you but, as I said, you should not do that. For your own sake.

Bus 001 Device 005: ID 1781:0c9f Multiple Vendors USBtiny

is added to the list when the USBtiny is connected

Hmmm… It actually matches the ids from the link I posted. At the next opportunity I will see how the device is setup in my machine and you can compare to yours and check if anything is different.