JMRI 2.11.2 Error during loading /dev/ttyUSB0 not found while opening connection


The device is recognised:


[ 2019.583226] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[ 2019.583271] usb 6-2: Detected FT232RL

[ 2019.584338] usb 6-2: FTDI USB Serial Device converter now attached to ttyUSB0

And we are in the correct group and the device has ‘rw’ permissions to us:

anotheruser@dnpp:/dev$ ls /dev/ttyU* -al
crw-rw—- 1 root dialout 188, 0 2011-02-17 23:13 /dev/ttyUSB0

anotheruser@dnpp:/dev$ groups
anotheruser adm dialout cdrom plugdev lpadmin admin

But there is a lock file, and we don’t have rights to remove it (since the first user logged out):

anotheruser@dnpp:/var/lock$ ls -l
total 4
-r–r–r– 1 firstuser firstuser 11 2011-02-17 23:14 LCK..ttyUSB0

anotheruser@dnpp:/var/lock$ rm LCK..ttyUSB0
rm: remove write-protected regular file `LCK..ttyUSB0′? y
rm: cannot remove `LCK..ttyUSB0′: Operation not permitted

And neither does JMRI as shown in the JMRI System Console, except that the error message chases you down the no USB or no permission path for hours:

log4j:ERROR setFile(null,false) call failed. messages.log (Permission denied)
at Method)

(but confusingly this is added)

688 gridconnect.GcSerialDriverAdapter   ERROR – Serial port /dev/ttyUSB0 not found [main]
690 configurexml.ErrorHandler   ERROR – /dev/ttyUSB0 not found while opening connection [main]

But from the command line, you can see more information interleaved between the log entries:

RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB0
RXTX Error:  Unable to     remove stale lock file: /var/lock/LCK..ttyUSB0
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB0
RXTX Error:  Unable to     remove stale lock file: /var/lock/LCK..ttyUSB0

So maybe JMRI is not the source of the problem, but rather RxTx?!?

The bigger question is however, why does JMRI (or RxTx) leave a “stale lock file” every time it exits? If you run JMRI the very first time, you create the lock file, so when you run it again, you have permission to remove the lock file…unfortunately when someone else tries to run JMRI, they can’t delete your stale lock file!

======= 3.5 years later =======

On Ubuntu 12.04 using JMRI 3.5.1: “no ports found” and when you manually enter it in the config file, can not open, it does not exist, so the fix was:

user@ubuntu:/dev$ sudo chmod 666 /dev/ttyUSB0
user@ubuntu:/dev$ ls /dev/ttyU* -al crw-rw-rw- 1 root dialout 188, 0 Aug  8 07:44 /dev/ttyUSB0

(Also have to admit that this Ubuntu 12.04 is running in a virtual machine using VMware Player 5.0.2 on a Windows 8 netbook! And the USB FTDI serial port is connected through the “Removable Devices”, works pretty well!!!)


~ by nambabwe on 2011/02/18.

%d bloggers like this: