PlatformIO Community

USB permissions error

I am using platformio on Ubuntu and I am trying to upload my code to a teensy ++ 2.0, and i am getting this error.

Any help will be appreciated and thank you in advance.

Could you try this sudo adduser second_user dialout and restart PC?

Alright a friend of mine got, atom did not have sudo privileges so it couldn’t take control of the usb ports. To fix this, we just run the command “sudo atom” in the terminal and it started working.

This is bad idea, you should not run programs like Atom editor as root. Did you try to add your user to dialout group? This is the group that gives access to serial ports.

Okay, what exactly do I type because I typed “sudo adduser” then doubled tabbed, and a bunch programs came up. I couldn’t really find anything useful on google either.

First, check the current user ID

$ id

then added it to group

$ sudo adduser YOUR_USER_ID dialout
$ sudo usermod -a -G dialout YOUR_USER_NAME

Hi, I wanted to let everyone know that I encountered and resolved this by running Visual Studio Code as root. The “risk” is negligible, it worked for me.

Do you want to fix it correctly? Try this if so:

  • Login as your user;
  • Open a terminal/command line session and run the groups command.
  • Did you see dialout listed?
  • If not run sudo usermod -a -G dialout your-user-name.
  • Close the terminal, open a new one, run groups again. You should now see dialout.

Make sure you have installed the udev rules as per as well.


1 Like

Depending on which exact board you have and what operating system you’re running you should also be in the plugdev group. And the udev rules are really important, too. These also take effect only after reboot.


Group changes take effect after login so the user needs to log in and out to ensure they take effect (there are ways to do refresh them without needing to re-login, but it’s not straightforward).

Or reload and retriggering of udev (i.e. sudo udevadm control --reload-rules && sudo udevadm trigger). Because of the combination of the two, it’s often just easier to reboot.