56
votes

I am running Debian 7 (Linux Crunchbang) and wanted to use The Arduino IDE to program my Arduino UNO. To do that I installed the package arduino. When I started the Arduino I was asked to add my user to the dialout group. So I did with sudo usermod -a -G dialout <my-username>.

However when I start the Arduino IDE using arduino in the commandline the IDE opens but I am not able to load my program to the Arduino. The error message is "Serial port COM1 not found. Did you select the right one from the Tools > Serial Port menu?" And when I went to select the Serial Port, the option "Tools > Serial Port" is greyed out.

I thought it is because I did not grant read and write permissions on my usb port (ttyACM0). So I did sudo chmod a+rw /dev/ttyACM0 but the option is still greyed out.

17

17 Answers

44
votes

chdmod works for my under debian (proxmox):

# chmod a+rw /dev/ttyACM0

For installing arduino IDE:

# apt-get install arduino arduino-core arduino-mk

Add the user to dialout group:

# gpasswd -a user dialout

Restart Linux.

Try with the File > Examples > 01.Basic > Blink, change the 2 delays to delay(60) and click the upload button for testing on arduino, led must blink faster. ;)

7
votes

sudo arduino is the only way I get the Arduino IDE working (serial port and upload) on ubuntu 12.04 (64) Indeed the serial port to use is /dev/ttyACM0 in my case too. The other two (ttyS4 and ttyS0) gave an error when trying to upload to Uno. Have fun

3
votes

Close all instances of the arduino IDE open ~/.arduino/preferences.txt and look for the line:

serial.port=<not your port>

and change it to your port:

serial.port=/dev/ttyACM0

you may have to log out for it to take effect

2
votes

Try Disconnecting the usb and plugging it back in. Its only grayed out because the ide cannot find any com ports that the uno has been plugged into.

another solution is to try all the com ports and see which one works.

finally if all fails try restarting your computer.

2
votes

open $arduinoHome/arduino in text editor and modify last string:

java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base "$@"

to

java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dgnu.io.rxtx.SerialPorts="/dev/ttyACMN" processing.app.Base "$@"

(set property gnu.io.rxtx.SerialPorts to /dev/ttyACMN,where ttyACMN is name of serial port which you use)

it may temporary fix bug in rxtx library. helped me to upload sketch with arduino1.0.5 IDE.

Maybe would helpful for someone.

2
votes

In my case I solved this issue by uninstalling the version of Arduino that I installed via apt-get and instead installed via the official website.

With the latest version of Arduino I didn't have the problem described on Ubuntu 18.04.

1
votes

So I did with sudo usermod -a -G dialout <my-username>.

You need to log out after you add yourself to a group so those changes are applied. Just log out and log in again and the menu should be available.

1
votes

In my case this turned out to be a bad USB hub.

The 'lsusb' command can be used to display all recognized devices. If the unit is not plugged in the option to set the speed will be disabled.

The lsusb command should output something like the string 'Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)' if your device is recognized. Mine was an RFDuino

1
votes

install rx-tx lib for java run this command in terminal

sudo apt-get install librxtx-java -y

output port

sudo usermod -aG dialout $USER 
sudo apt-get install gnome-system-tools 

help regconize usb device

0
votes

Same comment as Philip Kirkbride. It wasn't a permission issue, but using the Arduino IDE downloaded from their website solved my problem. Thanks! Michael

0
votes

The following steps install the IDE and remove the error java.lang.NullPointerException thrown while loading gnu.io.RXTXCommDriver which usually comes with arduino installed with apt-get command in Ubuntu.

Install the IDE

sudo apt-get install arduino

for removing java error in IDE

sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-set-default

This also shows the Serial Port which was grayed out due to the error.

0
votes

I had the same problem, with which I struggled for few days, reading all the blog posts, watching videos and finally after i changed my uno board, it worked perfectly well. But before I did that, there were a few things I tried, which I think also had an effect.

  • Extracted the files to opt folder, change the preference --> behavior --> executable text files --> ask what to do. After that, double clicked arduino on the folder, selected run by terminal
  • added user dialout like described in other answers.

Hope this answer helps you.

0
votes

I solved following serial port related problems in ubuntu 18.04 as follows:

Problem 1 : Cannot open /dev/ttyACM0: Permission denied
Solution : Grant permissions to read/write to the serial port with this terminal command ---> sudo chmod a+rw /dev/ttyACM0 Here replace tty port with your respective ubuntu port.

Problem 2 : Failed to open /dev/ttyACM0 (port busy) Solution : This problem appears when serial port is busy or already occupied. So kill the busy serial port with command ---> fuser -k /dev/ttyACM0. Here replace tty port with your respective ubuntu port.

Problem 3 : Board at /dev/ttyACM0 is not available Solution : In this case your serial port in tools menu will be greyed out. I googled a lot for this, but I none of solution worked for me. Atlast I tried different arduino board and usb connector and it was working for me. So, if you are having old arduino board (can be solved using required drivers) or defected arduino board then only this problem arises.

-1
votes

For a Windows solution I've found that disabling and re-enabling the Arduino in Device Manager, then restarting the Arduino IDE does the trick without fail (no unplugging necessary). Why this error occurs in the first place is beyond me. Perhaps the corresponding method for Linux will fix your problem.

Slightly related (not really), I had an issue with an AVR board a while back which was fixed by setting the device to a new COM port in the driver settings. Again, however you linux bunnies do it, I'm sure it'll be cookies and cream.

Cheers brother,

-1
votes

I encountered the same issue. My solution was to install and use java7:

sudo apt-get install openjdk-7-jre
sudo update-alternatives --config java

Select the number referring to the java-7 path.

-1
votes

You probably don't have the correct permissions. Try adding yourself to these groups.

sudo adduser username ttyl
sudo adduser username serial
sudo adduser username uucp

Then restart your system and check if you got added to the groups.

groups username

Good Luck!

-1
votes

Try to run as an administrator... Run terminal, type sudo arduino, type your root password, and... :)