[SOLVED] Dash buttons not working anymore

Platform information:
Hardware: NUC7CJYH with 8 GB RAM and 32 GB SSD + zwave: Aeotec Z-Stick Gen5 (ZW090)
Ubuntu Server 20.04
OH 3.1 stable

I followed the steps in this thread and read the others, too, but I got errors on the log and cannot test it with the tools (SendArpRequest)

The dash buttons are stuck in INITIALIZING
These buttons worked before I migrated from RPi to the NUC.
I also changed the ethernet device from eth0 to eno1

I deleted one dash and created it again, without a change.

Log shows after activating the binding:

java.lang.NoClassDefFoundError: Could not initialize class org.pcap4j.core.NativeMappings
        at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:56) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapUtil.getAllNetworkInterfaces(PcapUtil.java:40) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapNetworkInterfaceService.determineBoundNetworkInterfaces(PcapNetworkInterfaceService.java:168) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapNetworkInterfaceService.lambda$0(PcapNetworkInterfaceService.java:56) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(Unknown Source) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]

and I cannot find anything manually like pcap4j, so it’s obviously not included in libpcap-dev

openhab.log shows:

java.lang.NoClassDefFoundError: Could not initialize class org.pcap4j.core.NativeMappings
        at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:56) ~[?:?]
        at org.pcap4j.core.Pcaps.getDevByName(Pcaps.java:125) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapUtil.getNetworkInterfaceByName(PcapUtil.java:56) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.handler.AmazonDashButtonHandler.lambda$0(AmazonDashButtonHandler.java:62) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]

I also removed libpcap-dev, but this did not help either.

Because no one here seems to have similar issues, I guess this is related to my “special” HW resulting in a different name for the ethernet connection (eno1 instead of eth0).

Anyway, any idea would be greatly appreciated.

Really no one With the same issue?

as the interface is part of the configuration it should work with your interface in case the configuration is correct/updated with regard to your new hardware.
The lib should install a shared library. I assume that it is the one that will be used.
The static library that is being installed and the .h files etc. are only used during development.

The class file that could not be initialized is located at:

7z l /var/lib/openhab/tmp/kar/openhab-addons-3.2.0.M1/org/openhab/addons/bundles/org.openhab.binding.amazondashbutton/3.2.0.M1/org.openhab.binding.amazondashbutton-3.2.0.M1.jar|grep NativeMappings.class
2019-08-17 14:14:16 .....         7731         2864  org/pcap4j/core/NativeMappings.class

My question would be:
did you grant the capabilites as described in the docs and did you grant it to the right java binary. May be you have more instances of java binaries and the wrong one was granted to get the capabilities.

Thank you Wolfgang for your response and the hint to check the jar as well
(I am obviously not a Linux guy, but willing to learn… :wink:

in my case it’s 3.1.0

I guess so with:

sudo setcap cap_net_raw,cap_net_admin=eip $(realpath /usr/bin/java)

and tried this as well (don’t know the difference though):

sudo setcap cap_net_raw,cap_net_admin=eip `realpath /usr/bin/java`
java --version

shows:

openhabian@nukem:~$ java --version
openjdk 11.0.11 2021-04-20 LTS
OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS)
OpenJDK Server VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)

Because I am using ubuntu server (see above), are the Runtime / Server Version running independently?
Might the (additional / comflicting) Server version the cuplrit, then?

I am using the NUC for OH only - so no other server functionality (exception: server functions coming with OH and local ftp server).

EDIT:
according to this output there is no conflict:

openhabian@nukem:~$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /opt/jdk/zulu11.48.21-ca-jre11.0.11-linux_i686/bin/java
Nothing to configure.
openhabian@nukem:~$

Just an FYI - I checked this (similar) thread as well, but it’s windows and seemed to be solved by a change in the dash button jar (back on 2.5).
So it’s obviously not applicable to my case.

Does the architecture of your PCAP lib match the architecture of the installed java binary ?
What I mean are both 32-bit resp. 64-bit files ?

hmmm…
How to check?
AFAIK java -version should return somthing with 64bit like this if it’s 64bit

java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)

otherwise it’s 32bit (like in my case):

libcap shows:

openhabian@nukem:~$ dpkg -l |grep pcap
ii  libpcap-dev:amd64                    1.9.1-3                           amd64        development library for libpcap (transitional package)
ii  libpcap0.8:amd64                     1.9.1-3                           amd64        system interface for user-level packet capture
ii  libpcap0.8-dev:amd64                 1.9.1-3                           amd64        development library and header files for libpcap0.8

So, there is a mismatch (unless I did something wrong).
This being said, means I need to remove libcap-dev 64bit and install 32bit - right?

yes.

Thanks for confirming.

I read in a few forums that this should work:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libcap-dev:i386

After that I:

  1. sudo setcap cap_net_raw,cap_net_admin=eip $(realpath /usr/bin/java)
  2. restarted the dash binding

No change

I still wonder, if the dashbutton NativeMappings is able to handle the right interface because of the Unknown source:

Could not initialize class org.pcap4j.core.NativeMappings
        at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:56) ~[?:?]
        at org.pcap4j.core.Pcaps.getDevByName(Pcaps.java:125) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapUtil.getNetworkInterfaceByName(PcapUtil.java:56) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.handler.AmazonDashButtonHandler.lambda$0(AmazonDashButtonHandler.java:62) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]

I just found some time to look into this again.
After installing the i386 as mentioned above I don’t get this error anymore:

2021-12-23 19:26:19.199 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.UnsatisfiedLinkError: Unable to load library 'pcap':
libpcap.so: cannot open shared object file: No such file or directory
/lib/x86_64-linux-gnu/libpcap.so: wrong ELF class: ELFCLASS64
/lib/x86_64-linux-gnu/libpcap.so.1.9.1: wrong ELF class: ELFCLASS64

Which is good, I guess.

I just have these left:

2021-12-24 09:05:02.022 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.NoClassDefFoundError: Could not initialize class org.pcap4j.core.NativeMappings
        at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:56) ~[?:?]
        at org.pcap4j.core.Pcaps.getDevByName(Pcaps.java:125) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapUtil.getNetworkInterfaceByName(PcapUtil.java:56) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.handler.AmazonDashButtonHandler.lambda$0(AmazonDashButtonHandler.java:62) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]
2021-12-24 09:05:02.026 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.NoClassDefFoundError: Could not initialize class org.pcap4j.core.NativeMappings
        at org.pcap4j.core.Pcaps.findAllDevs(Pcaps.java:56) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapUtil.getAllNetworkInterfaces(PcapUtil.java:40) ~[?:?]
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapNetworkInterfaceService.determineBoundNetworkInterfaces(PcapNetworkInterfaceService.java:168>
        at org.openhab.binding.amazondashbutton.internal.pcap.PcapNetworkInterfaceService.lambda$0(PcapNetworkInterfaceService.java:56) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(Unknown Source) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]

EDIT:
I got it!

There were actually two issues:

  1. the wrong libpcap installed (libpcap-dev instead of libpcap-dev:i386
  2. The standard interface name of my network card (eno1) was not working, so I renamed it to eth0 (see below)

To change the interface name of the network card:

sudo nano /etc/default/grub

change the following line:

GRUB_CMDLINE_LINUX=""

to

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

and run:

sudo update-grub

followed by a reboot.

The only issue I have is that eth0 is not up after a reboot.
So the following steps are required for my case:

sudo ifconfig eth0 up

and

sudo dhclient -v eth0

EDIT II:
This can be solved with changing:
sudo nano /etc/netplan/00-installer-config.yaml
(eno1 → eth0)

1 Like

Just a quick final update about this topic.

Because I had network issues after changing the device name to eth0
(see here: Network connection issues (http binding) - Setup, Configuration and Use / Beginners - openHAB Community), I thought I try to switch this back to see if it’s related (or a coincidence with my network provider problems.

It turned out, that the configuration of the dash button changed.
Previously the interface name needed to be specified in regular text.
Now there is a selection available - and voilá - even with eno1 it works like a charm after setting it correctly: