How to make Arduino (Snap) access serial port /dev/ttyUSB0 (or /dev/ttyACM0)?

Solution 1:

2020 update

The arduino-mhall119 snap is outdated and should not be used anymore. Use the arduino snap instead.

See this answer for up to date info on how to get serial working with the arduino snap.

Old instructions

Install the snap in classic mode to allow access to ports

$ snap install arduino-mhall119 --classic

It's that simple. You should now have access to your serial ports! Happy Hacking!

Note: info below are needed for old Arduino 1.6.10.



Some interesting links that helped find the answer

Auto connected serial port interface

Lundamar says: Until the serial-port gadget/interface is improved to give access to all system serial devices you can get your snap working by simply installing it non-confined like so:

$ snap install tio --classic

It’s better than nothing but it surely would be best to run it confined with allowed access to serial tty devices.

Interfaces - serial-port

Interfaces reference:

serial-port
Can access serial ports. This is restricted because it provides privileged access to configure serial port hardware. Note that the slot is meant to be implemented by a gadget snap (this is not provided by the core snap).

Gadget providing serial-port slot

Solution 2:

The arduino-mhall119 snap is outdated and should not be used anymore. Use the arduino snap instead.:

snap install arduino

Using that snap, the only thing you need to do is add your own user to the dailout group:

sudo usermod -a -G dialout $USER

After this, reboot your device and open Arduino IDE.

Solution 3:

The solution of Joshua did not work for me anymore since I got the error:

Warning: flag --classic ignored for strictly confined snap arduino-mhall119

However, when using devmode instead it worked fine:

$ snap install arduino-mhall119 --devmode

Not sure if there are any further consequences with devmode though..