:: Installation of arduino on all Linux version ::

START

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

tip1: if for some reason openJDK doesn't work for you, try the oracle JRE: http://www.java.com
  • it is HIGHLY recommended to use arduino IDE > 1.0.1, because it use an internal pre-build gcc compiler. This exclude all tool-chain problem, or at least guarantee we all have the same problem.
tip2: if you stll want to use 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
tip3:older arduino board (like arduino 2009, mini, etc..) works perfectly on the IDE 1.0.1
  • Plug In your arduino.
  • if prior to arduino UNO you should find
    /dev/ttyUSBX
where X is a number that may vary.
if arduino UNO you should find
/dev/ttyACMX
where X is a number that may vary

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


NO ttyUSBX or ttyACMX

Do Linux find the USB?

that easy. Plug your arduino, then from terminal:

dmesg | tail

you will see something like (for arduino < UNO):

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

and 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)

and for Leonardo (unless you're running a recent version of Ubuntu):

type

echo "0x1b4f 0x9204" > /sys/bus/usb/drivers/cdc_acm/new_id

and that will create the /dev/ttyACMx file. If you want it done automagically, create a file /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 UDEV is putting the file?

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

  1. unplug arduino
  2. from terminal: ls -Rla /dev > /tmp/output1
  3. plug arduino
  4. from terminal: ls -Rla /dev > /tmp/output2
  5. and finally diff /tmp/output1 /tmp/output2

here you will see where UDEV put the file.


Setting UDEV rule

  • from terminal: lsusb
  • look for arduino or FTDI(if prior arduino UNO)
  • write the two 4 digit ID: they are like 093a:2510
093a is the vendor ID
2510 is the product ID
  • now, with terminal go to /etc/udev/rules.d/
  • as root create and create a file.
The name must be a two digit number(choose a big number like 99), followed by a -, a name and .rules like "99-arduino.rules"
  • inside the file write: (where XXXX is the product ID and YYYY the vendor ID)
for UNO
SUBSYSTEMS=="usb", ATTRS{idProduct}=="XXXX", ATTRS{idVendor}=="YYYY", SYMLINK+="ttyACM%n"
the others:
SUBSYSTEMS=="usb", ATTRS{idProduct}=="XXXX", ATTRS{idVendor}=="YYYY", SYMLINK+="ttyUSB%n"
  • and now from terminal: udevadm control --reload_rules
  • reboot the system

SET THE PERMISSION

  • now as normal user from terminal:
    ls -l /dev/ttyUSBX
or
ls -l /dev/ttyACMX
you will get something like:
crw-rw---- 1 root uucp 188, 0 5 apr 23.01 ttyUSBX
or
crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACMX
in the first case the data we need is "uucp", in the second "dialout" (is the group owner of the file.
  • Now we just need to add our user to the group:
    usermod -a -G group-name username
where group-name is the data found before, and username is your linux user name.
  • Now we have to check if you have permission on the lock folder:

if you have filesystem-2012.6-2 or NEWER then look for the folder
ls -ld /run/lock
this folder is created at boot time from the system, following the instruction from /usr/lib/tmpfiles.d/legacy.conf
so we need to change the default permission on the conf file to respect our need.
first of all, as root or with sudo, copy the /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 like:
d /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 look for
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 file "arduino" is executable
  • double click it and enjoy your new and shiny arduino

Share