Arduino Linux Ubuntu, arduino cant access /dev/ttyUSB0 [SOLVED]

I have Arduino 1.8.5 and Linux Ubuntu 18.04. I'm using an Arduino Uno board.

Hi, I'm very new to both Arduino and Linux, but since the board had the same problem on Windows, I thought I'd try a Linux computer.

I have basically tried doing everything the internet has told me to do so far.

This is the error message I get when I try running a simple "Blink" program.

Arduino: 1.8.5 (Linux), Board: "Arduino/Genuino Uno"

Sketch uses 928 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "/dev/ttyUSB0": Permission denied
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I have tried following the official guide to solve this, which is;

  1. Typing this in the terminal: ls -l /dev/ttyACM*
    you will get something like: crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACM0
  2. Adding myself to the dialout group: sudo usermod -a -G dialout <username>
  • I have also added myself to the tty group, uttc, and disk group, because I saw other people added themselves to those groups and it helped.

I have also tried using sudo chmod a+rw /dev/ttyUSB0]

I have also tried using $ snap install arduino-mhall119 --classic

And I have tried doing sudo -i to get temporary root acces, and then doing all of these things again.

I rebooted my computer numerous times and reinstalled Arduino twice.

Nothing has worked.

I don't know enough about this to really be sure that I did it all right. It seems like my user has access to /dev/ttyUSB0, but my Arduino doesn't, for some reason.

So, if you have any ideas left, I would really appreciate some help.

Hello,

Your Arduino IDE is looking for a /dev/ttyUSB0 and you haven't got one. You have a /dev/ttyACM0.

Open the Arduino IDE and go to the Tools menu. Click on port and change it to /dev/ttyACM0.

Hope it works.

Hopefully kayel's suggestion will resolve your problem.

If not, there have been previous reports of this type of issue being caused by using the 3rd party unofficial arduino-mhall119 Snap package. The problem was resolved after uninstalling it and then installing the official Arduino IDE, downloaded from:

kayel:
Hello,

Your Arduino IDE is looking for a /dev/ttyUSB0 and you haven't got one. You have a /dev/ttyACM0.

Open the Arduino IDE and go to the Tools menu. Click on port and change it to /dev/ttyACM0.

Hope it works.

The only port that Tools>Port shows is /dev/ttyUSB0, it doesn't show /dev/ttyACM0, and I can't find it under any groups in the terminal either, as if it doesn't exist.

But thank you.

If you installed the Arduino IDE with apt-get or synaptic then you should uninstall it using the same method. I've heard the Debian-based packages are not maintained. Then follow pert's link.

If you plug in your Arduino and type "ls /dev" you should get the "tty x" (at the end of all the "tty" stuff) that the Arduino IDE is looking for. If not, uninstall and follow pert's link.

Never install stuff as root, if you do, it will belong to root, not you. Use sudo.

Type "groups " to make sure you really are in the "dialout" group

Out of ideas for now.

I solved the problem, but thanks for the help!

I ended up having to reinstall arduino using snap install arduino-mhall119 --classic.

pert:
Hopefully kayel's suggestion will resolve your problem.

If not, there have been previous reports of this type of issue being caused by using the 3rd party unofficial arduino-mhall119 Snap package. The problem was resolved after uninstalling it and then installing the official Arduino IDE, downloaded from:
http://www.arduino.cc/en/Main/Software

Actually, the problem was solved by using the snap package, I wouldn't know why though...But thank you!

That was unexpected. Well, I'm just glad it's working now!

However, you should note that the arduino-mhall119 provides an IDE version that's over a year outdated. There have been a lot of bug fixes and improvements since that time. If you ever want to enter the modern age of Arduino, consider installing the official Arduino IDE.

When an app runs on flatpak that could cause a problem. Flatpak by default blocks all (or most) devices. By adding --device=all you get it work. See here monodevelop - Accessing Serial Ports with an Application Runs in Flatpak - Stack Overflow