Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

Installation of Arduino on all Linux distributions

START

This is your "last hope", and should work for all Linux distributions.

  • If you already have a working Arduino IDE and you just want to update it, just go to IDE DOWNLOAD
  • Install openJDK from your repository or from http://openjdk.java.net/
    • Tip 1: If for some reason openJDK doesn't work for you, try the oracle JRE: http://www.java.com
  • It is highly recommended to use an Arduino IDE > 1.0.1, because it uses an internal pre-build gcc compiler. This excludes all tool-chain problems, or at least guarantees we all have the same problem.
    • Tip 2: If you still want to use an older IDE, install avr-gcc (aka "gcc-avr"), avr-gcc-c++, avr-lib (only if you plan to use the arduino-IDE prior 1.0.1)
    • Tip 3: Older arduino boards (like Arduino 2009, Mini, etc..) work perfectly on the IDE 1.0.1
  • Plug in your Arduino.
  • Prior to Arduino Uno you should find /dev/ttyUSBX where X is a number that may vary.
    Using an Arduino Uno you should find /dev/ttyACMX

If you find it, go to SET THE PERMISSION
If not, see the next chapter NO ttyUSBX or ttyACMX


No ttyUSBX or ttyACMX

Does Linux find the USB connection?

That's easy. Plug in your Arduino, then type in your terminal dmesg | tail
For Arduino < Uno, you will see something like

ftdi_sio 3-2:1.0: FTDI USB Serial Device converter detected
usb 3-2: Detected FT232RL
usb 3-2: Number of endpoints 2
usb 3-2: Endpoint 1 MaxPacketSize 64
usb 3-2: Endpoint 2 MaxPacketSize 64
usb 3-2: Setting MaxPacketSize 64

For Uno:

[  447.848039] usb 3-1: new full speed USB device using uhci_hcd and address 2
[  448.046079] usb 3-1: New USB device found, idVendor=2341, idProduct=0001
[  448.046085] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[  448.046089] usb 3-1: Product: Arduino Uno
[  448.046092] usb 3-1: Manufacturer: Arduino (www.arduino.cc)

For Leonardo (unless you're running a recent version of Ubuntu), type echo "0x1b4f 0x9204" > /sys/bus/usb/drivers/cdc_acm/new_id

This will create the /dev/ttyACMx file. If you want it done automatically, create a file named /etc/udev/rules.d/46-arduino.rules with the following two lines:

BUS=="usb", SYSFS{idVendor}=="1b4f", SYSFS{idProduct}=="9204", RUN+="/sbin/modprobe cdc_acm"
BUS=="usb", SYSFS{idVendor}=="1b4f", SYSFS{idProduct}=="9204", RUN+="/bin/sh -c 'echo 0x1b4f 0x9204 > /sys/bus/usb/drivers/cdc_acm/new_id'"


Where is UDEV putting the file?

This is not necessary to know, it's just to be sure everything work correctly. If this doesn't work, there's a weird problem going on on your Linux system, or some hardware is failing.

  1. Unplug Arduino
  2. From terminal: ls -Rla /dev > /tmp/output1
  3. Plug in Arduino
  4. From terminal: ls -Rla /dev > /tmp/output2
  5. And finally diff /tmp/output1 /tmp/output2
    This is where you will see where UDEV is putting the file.

Setting UDEV rule

  • From terminal: lsusb
  • Look for Arduino or FTDI (if prior Arduino Uno)
  • Type the two 4 digit IDs: they are like 093a:2510
    • 093a is the vendor ID
    • 2510 is the product ID
  • Now, navigate your terminal to /etc/udev/rules.d/
  • As root, create a file:
The name must be a two digit number (choose a big number like 99), followed by a hyphen, a name and .rules; for example "99-arduino.rules"
  • Inside the file, write the following, where XXXX is the product ID and YYYY the vendor ID:
    • For Uno:
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="XXXX", ATTRS{idVendor}=="YYYY", SYMLINK+="ttyACM%n"
    • For the others:
    SUBSYSTEMS=="usb", ATTRS{idProduct}=="XXXX", ATTRS{idVendor}=="YYYY", SYMLINK+="ttyUSB%n"
  • From terminal: udevadm control --reload-rules
  • Finally, reboot your system.

Serial port permissions

  • As normal user from terminal: ls -l /dev/ttyUSB* or ls -l /dev/ttyACM*
    You will get something like
crw-rw---- 1 root uucp 188, 0 5 apr 23.01 ttyUSB0 or
crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACM0
  • The "0" might be a different number, or multiple entries might be returned. In the first case the data we need is uucp, in the second dialout. (this is the group owner of the file)
  • Now we just need to add our user to the group: usermod -a -G group-name username
    group-name is the data found before, and username is your Linux user name. You will need to log out and in again for this change to take effect.


Lock permissions (1.5.5 and below only)

Arduino version 1.5.6 switched from the RXTX serial port library to JSSC. The latter does not seem to lock the serial ports, so you can skip this section when you use a recent IDE version.

We have to check whether you have permission on the lock folder:

  • If you have filesystem-2012.6-2 or newer, look for the folder with ls -ld /run/lock
    • This folder is created at boot time from the system, following the instruction from /usr/lib/tmpfiles.d/legacy.conf
    • We need to change the default permission on the conf file to respect our need. First of all, as root or with sudo, copy /usr/lib/tmpfiles.d/legacy.conf to /etc/tmpfiles.d/
    cp /usr/lib/tmpfiles.d/legacy.conf /etc/tmpfiles.d/
    • Now modify /etc/tmpfiles.d/legacy.conf and make the permission on /run/lock read+write for group, and change group from root to lock; it will be similar to
    chmod /run/lock 0775 root lock
    • Now we just have to be sure to be in the lock group:
    usermod -a -G lock yourUserName
    • Reboot your computer to make the changes take effect, or just run the following command to make a quick hack:
    chmod o+rwx /run/lock

  • If you have filesystem-2012.6-2 older, use ls -ld /var/lock
    • You should see something similar to this:
    drwxrwxrwt 2 root root 4096 9 dic 21.39 /var/lock
    • If the permission are not like this, then as root (or sudo) just run:
    chmod o+rwx /var/lock


Arduino IDE

Finally, we can download the latest Arduino IDE from http://arduino.cc/en/Main/Software

  • Unzip it. (it doesn't require installation, so put this directory in a safe place)
  • Open the directory arduino-XX. (where XX is the version of the IDE)
  • Just to be sure, check that the file "arduino" is executable.
  • Double click it and enjoy your new and shiny arduino.