Pages: [1] 2   Go Down
Author Topic: trouble uploading on ubuntu 12.04  (Read 10269 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OS: Ubuntu 12.04 LTS
Board: Arduino Uno
IDE: latest version in Ubuntu universe  1:1.0+dfsg-9   installed via synaptic
Problem: can't upload code, something about /var/lock/

Command line dump (ran as root per tip on Troubleshooting page):
Code:
$ sudo arduino
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyACM0
Binary sketch size: 1010 bytes (of a 32256 byte maximum)
processing.app.SerialException: Error opening serial port '/dev/ttyACM0'.
at processing.app.Serial.<init>(Serial.java:146)
at processing.app.Serial.<init>(Serial.java:76)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:75)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:88)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:66)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1624)
at processing.app.Sketch.exportApplet(Sketch.java:1578)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2314)
at java.lang.Thread.run(Thread.java:679)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:213)
at processing.app.Serial.<init>(Serial.java:136)
... 9 more
processing.app.debug.RunnerException: Error opening serial port '/dev/ttyACM0'.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:99)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:88)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:66)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1624)
at processing.app.Sketch.exportApplet(Sketch.java:1578)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2314)
at java.lang.Thread.run(Thread.java:679)


I am successfully able to upload from my mac (OS 10.7.4).  I was able to upload from my linux box last week using the arduino, but after a system update (possibly including a kernel update?) I started having these /var/lock issues.  At first I could still upload to my arduino by running the IDE as root, but that no longer works.  The code I had been trying to upload used the serial port, but now I'm just trying to upload the blink example.  I successfully uploaded the blink example using my mac, but I can't upload blink from my linux computer anymore...   smiley-sad
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You should not need to run as root. I'm using 12.04, but I only downloaded/installed the repository version. I have not run it yet. I downloaded IDE v1.0.1 from the Arduino site, and unpacked it in a local directory. Then I created a link to the arduino shell script in that directory, and moved the link to my desktop. Don't move the arduino shell script. It is "current directory" dependent.

Log in as your user (no sudo). Start a command prompt terminal. Enter this:
Code:
groups

Among many, one of the groups should be dialout. If not, you must add that group to your user.
Code:
sudo usermod -aG dialout myusername
Then you must log out and log in again for the change to work. If that is not it, let me know.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I forgot to mention that I'm running Ubuntu 12.04 LTS 64 bit.  I'm not sure if the 64 bit is a problem or not.

I checked which groups my account belongs to, and dialout is definitely included.

I'm having permissions issues with my device, that's why I tried running as sudo.

I installed the 1.0.1 version from the arduino page.  If I call the arduino script from the command line as my a normal user, the Arduino IDE indicates (in the bottom right corner) "Arduino Uno on /dev/ttyACM0" (which is accurate).  Unfortunately, if I click Tools->Serial Port only /dev/ttyS0 is available.  I see the following print out to the command line when I launch the Arduino IDE:
Code:
$ arduino
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyACM0
RXTX Error:  Unable to remove stale lock file: /var/lock/LCK..ttyACM0
I see the same behavior with Arduino IDE version 1.0 that I installed via Ubuntu's package manager.

If I instead call the Arduino IDE with sudo from the command line, I see the following in the command line:
Code:
$ sudo arduino
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyACM0
When I run the Arduino IDE as root from the command line, the IDE correctly indicates (in the bottom right corner) that my arduino is located at /dev/ttyACM0.  Now when I go to Tools->Serial Port I see two options, /dev/ttyS0 and /dev/ttyACM0 (which is checked by default, sweet!).  Unfortunately, I see the following error at the command line when I try to upload the blink example:
Code:
$ sudo arduino
Binary sketch size: 1010 bytes (of a 32256 byte maximum)
processing.app.SerialException: Error opening serial port '/dev/ttyACM0'.
at processing.app.Serial.<init>(Serial.java:146)
at processing.app.Serial.<init>(Serial.java:76)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:75)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:88)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:66)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1624)
at processing.app.Sketch.exportApplet(Sketch.java:1578)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2314)
at java.lang.Thread.run(Thread.java:679)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:213)
at processing.app.Serial.<init>(Serial.java:136)
... 9 more
processing.app.debug.RunnerException: Error opening serial port '/dev/ttyACM0'.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:99)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:88)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:66)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1624)
at processing.app.Sketch.exportApplet(Sketch.java:1578)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2314)
at java.lang.Thread.run(Thread.java:679)

This is very frustrating.  What is going on?  I am still able to successfully reprogram my arduino on my Mac.  It looks like there is some kind of permission error on the serial port...?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

On ubuntu 12.04, I have no problem for uploading to Arduino Mega (1280) through the IDE 1.0.1
The official package is still IDE 1.0… and so I can't ran it. I uninstalled this version smiley-wink
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't run arduino from the terminal like that. It runs the repository version. If you want the downloaded version 1.0.1, use this:
Code:
cd /home/user/arduinodirectorywhereunpacked
./arduino

edit: or the way I do it is navigate to that directory using the GUI, right click on the arduino shell script and create a link. Then move the link to your desktop. Then double-click the link to run the new version.

Do not run as root! No sudo! If you have problems, check your user home directory. There is a hidden directory there named ".arduino" that has a "preferences.txt" file. It may have been changed to owner=root in the sudo stuff you tried. If it is, you must change it back to you as the owner.
« Last Edit: September 16, 2012, 07:00:29 am by SurferTim » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Haha, sorry for running that incorrectly.

When I run IDE v 1.0.1, I still get a lock error when trying to open the serial port.

Code:
$ ./arduino
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Binary sketch size: 1,084 bytes (of a 32,256 byte maximum)
processing.app.SerialException: Error opening serial port '/dev/ttyACM0'.
at processing.app.Serial.<init>(Serial.java:178)
at processing.app.Serial.<init>(Serial.java:77)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:679)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:171)
at processing.app.Serial.<init>(Serial.java:163)
... 9 more
processing.app.debug.RunnerException: Error opening serial port '/dev/ttyACM0'.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:101)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:679)

When I try to again, I get something like:
Code:
$ ./arduino
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyACM0
RXTX Error:  Unable to remove stale lock file: /var/lock/LCK..ttyACM0

I took a look at ~/.arduino/preferences.txt, I am definitely still the owner with rw privileges.

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds like you might need to take a look at "/var/lock", and see if there is still a stale lock on that device. You may need to remove that lock as root.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think the Arduino IDE, or maybe one of the libraries it is using, is creating the lock after I start the IDE and subsequently prevents the IDE from communicating with the serial port.

Before running the IDE, I tried the following:
Code:
$ ls /var/lock
LCK..ttyACM0  multiload-icons-PwgnzL  whoopsie
$ sudo rm /var/lock/LCK..ttyACM0
[sudo] password for user:

Then I run the arduino IDE and try to upload Blink:
Code:
$ ./arduino
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Binary sketch size: 1,084 bytes (of a 32,256 byte maximum)
processing.app.SerialException: Error opening serial port '/dev/ttyACM0'.
at processing.app.Serial.<init>(Serial.java:178)
at processing.app.Serial.<init>(Serial.java:77)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:679)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:171)
at processing.app.Serial.<init>(Serial.java:163)
... 9 more
processing.app.debug.RunnerException: Error opening serial port '/dev/ttyACM0'.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:101)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:679)

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Gotta ask. Who is whoopsie, and why is that device locked? My IDE does not lock the arduino and leave it like that.
Quote
$ ls /var/lock
LCK..ttyACM0  multiload-icons-PwgnzL  whoopsie
Did you go back and check that the device is not locked again?
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe this is whoopsie?
http://www.ubuntuupdates.org/package/core/precise/universe/base/whoopsie
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First I checked for the lock, then removed it, then verified the lock was gone, then started the Arduino IDE, then closed the arduino IDE w/o trying to upload anything, checked for the lock, and finally started the IDE and tried to upload Blink.

Here I'm using Arduino IDE 1.0.1 from the repo.

Code:
$ ls /var/lock
LCK..ttyACM0  multiload-icons-PwgnzL  whoopsie

$ rm /var/lock/LCK..ttyACM0
rm: remove write-protected regular file `/var/lock/LCK..ttyACM0'? y

$ ls /var/lock
multiload-icons-PwgnzL  whoopsie

$ ./arduino
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7

$ ls /var/lock
multiload-icons-PwgnzL  whoopsie

$ ./arduino
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Binary sketch size: 1,084 bytes (of a 32,256 byte maximum)
processing.app.SerialException: Error opening serial port '/dev/ttyACM0'.
at processing.app.Serial.<init>(Serial.java:178)
at processing.app.Serial.<init>(Serial.java:77)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:679)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:171)
at processing.app.Serial.<init>(Serial.java:163)
... 9 more
processing.app.debug.RunnerException: Error opening serial port '/dev/ttyACM0'.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:101)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:679)

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How many times have you removed that lock now? How many times has it come back?


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have no idea how many times I've removed that lock, but at least 50 times.

The lock comes up every time I try to upload to my arduino.  The lock is not there before I click "upload", but once I click upload I get the error about how the Arduino IDE can't open the serial port and the lock appears.

Clearly the Arduino IDE or one of its libraries is locking the serial port and preventing the IDE from talking to the device.  It sure sounds like a bug in the IDE, an incompatibility between the IDE and a library on my system, or a driver issue.  Any thoughts on how to debug?
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using the Arduno IDE from the Arduino site? I am with no problem. Or are you still using the Ubuntu version? What does the top of the Arduino IDE window say when you open it?

Mine today says "sketch_sep16a | Arduino 1.0.1". Is that what yours says? If it is the Ubuntu version, it will say so there.



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using Arduino IDE version 1.0.1 which is in fact indicated at the top of the IDE.  This is the version I pulled off the site, not the one in the Ubuntu universe repository. 
Logged

Pages: [1] 2   Go Up
Jump to: