Linux: Permission problem with /dev/ttyACM0

Hi.
I had a working OH1.8.3 installation on Windows. Now I’m trying to move it to Linux (CentOS7).
There isn’t an RPM for CentOS/RHEL, so I just moved my working directory from the Windows machine to my CentOS machine, with the changes detailed below.
But I keep get these errors:

 Serial Error: Port /dev/ttyACM0 does not exist

And

10:32:20.149 [DEBUG] [.z.internal.ZWaveActiveBinding:225  ] - internalReceiveCommand Called, But Not Properly Configure yet, returning.

I have followed all advices that I found…

  • I’ve verified that my port is /dev/ttyACM0 by diffing the output of ls /dev/tty* with and without the stick (AEON Gen5) plugged.
  • Updated openhab.cfg to use: zwave:port=/dev/ttyACM0
  • Added the user running openhab to dialout group, and rebooted
  • Couldn’t find no lock in /var/lock/
  • Added to start_debug.sh:
    -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 \

But still, nothing improves :worried:

Few additional points:

  • This is a ‘minimal’ installation of CentOS7, with few packages that I’ve added. Maybe I’m missing some package?
  • The computer is a MiniPC, from EGlobal

Thanks for the help…

(tried to ‘update’ my original post, but it failed…)

I’ve copied the directory aside, and run OH as root. And it works great!
So, it’s definitely permissions problems.
But I don’t want to run as root…

So - back to my original directory -
I tried also adding tty group, as it was mentioned somewhere, and of course, didn’t help.
What have have I missed?

Additional info, just to demonstrate the permissions:

$ ps -elf | grep 3399
0 S zvika     3399  3307  0  80   0 - 28281 wait   11:02 pts/4    00:00:00 /bin/sh ./start.sh
0 S zvika     3405  3399 39  80   0 - 346443 futex_ 11:02 pts/4   00:01:11 java -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 -Djetty.port=8080 -Djetty.port.ssl=8443 -Djetty.home=. -Dlogback.configurationFile=configurations/logback.xml -Dfelix.fileinstall.dir=addons -Dfelix.fileinstall.filter=.*\.jar -Djava.library.path=lib -Djava.security.auth.login.config=./etc/login.conf -Dorg.quartz.properties=./etc/quartz.properties -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar server/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar -console
$ id
uid=1000(zvika) gid=1000(zvika) groups=1000(zvika),5(tty),18(dialout)
$ ll /dev/ttyACM0 
crw-rw---- 1 root dialout 166, 0 Nov  7 10:57 /dev/ttyACM0

UPDATE

Maybe it’s related my Java version?
I’ve installed Orcale Java:

$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Server VM (build 25.111-b14, mixed mode)

I’ve also had problems with this but with the razberry gpio board.
I got it working by using a symbolic link.

crw-rw----  1 root dialout 204,  64 Nov  7 10:15 ttyAMA0
lrwxrwxrwx  1 root root           7 Nov  2 12:02 ttyUSB30 -> ttyAMA0

There are a lot of threads about this problem, so recommend looking through those threads.

Regards S

Yeah, I’ve read many threads. That’s the source for the things I’ve tried.
Simply running ln -s didn’t help.

However, since I’m going to buy also an RFX USB stick, I’ve decided to follow the sym link advice in https://github.com/openhab/openhab/wiki/symlinks.

It didn’t solve the problem, but I’ve discovered something strange…

Although the code there says:
GROUP="dialout", MODE="0666"

I actually see:

# ll /dev/USBzwave 
lrwxrwxrwx 1 root root 7 Nov  7 11:40 /dev/USBzwave -> ttyACM0

The group is not dialout but root and the permissions don’t seem to be 0666.
Maybe I have some problem with my dialout definition?

I have modified the udev rules file to look like this:

SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="USBzwave", OWNER="zvika", GROUP="zvika", MODE="0777"

Now I get this:

$ ll /dev/ttyACM0 
crwxrwxrwx 1 zvika zvika 166, 0 Nov  7 19:56 /dev/ttyACM0

But still not working.

I’ve also tried these:

(before changing permission of ttyACM0):

$ cat /dev/ttyACM0
cat: /dev/ttyACM0: Permission denied

That demonstrates that user zvika doesn’t have permission to read from ttyACM0 (BTW - it’s not saying device doesn't exist, or something similar, like seen in the log file)

And after changing permissions of ttyACM0:

$ cat /dev/ttyACM0
^C

(it behaved just like when root was catting it)

To summarize

When running OH as root, everything works fine.
When trying to cat /dev/ttyACM0 - it’s working (after fixing udev rules).
But when running OH as user - it fails.

What’s next?
How can I debug it?
@chris, maybe you can help?

Thanks

OK, more searching revealed the problem.

The user running OH needs permissions for 2 places:

  • The USB device in /dev directory
    • Almost all posts discuss this problem
  • /var/lock directory - in order to lock the device
    • Rarely mentioned, but important as well…

Found my solution at Another Aeon Gen 5 Issue - No Device

I’m not sure if it’s important, but I’ve also installed uucp package - it gave me better error messages in the log file, before fixing permissions for /var/lock.

Having the same issue on an Intell NUC.

You need to set 777 to ‘/run/lock’ directory.

The /run/lock directory (/var/lock is a symlink to this) will be recreated after each reboot. My wife did a writeup (look about half way down), with a way to make the permissions stick. It depends on your Linux distribution, but you can also install lockdev, recompile the nrjavaserial jar with the lockdev-devel headers, uninstall the existing bundle and then drop in your modified jar. Working on Fedora28. Much easier to just change the permissions, but this works too!

I believe its a 2 year old thread. But thanks for the fix anyway. CentOS /Fedora users might find it useful.

Sorry… meant to reply to @bastiaan_van_h. The issue is still open, and based on recent discussions, still affects a number of people.