Zigbee and zwave manual install script

I know there are something different on my system… I can´t SSH to openhab using openhab username/pw. I have to use openhabian.
But I can enter Karafe fine using openhab username/password. I have not got enough Linux knowledge to solve this issue or even how to search for it. This is probably not going to be fixed on my system, before I install a fresh copy of openhab 2.5, when it´s released, as I have given up trying to solve it.

But, you´re script has been working fine for several months even though I´ve had this issue. This is why I thought there was another change somewhere. which could be this…

I´m pretty sure this is the cause of the issue. I´ll give the script a new try one of these days, as I´m using 1.1.10 right now, and the latest is 1.1.11 as far as I know.

tried the script on a ubuntu 18.04 installation with the stable openhab2 packages (2.4.0) no good
couple of things

you are using the command “rename” which does not exist in bash, maybe use mv?

for some reason it is trying to access folders that do not exist for example it thinks my karaf installation is in
/usr/share/openhab2/userdata/etc
but it is actually in /var/lib/openhab2/etc/

I did my best to only use native commands… missed that one. I’ve changed this.

There is nothing in the script that is doing anything in /usr/share/openhab2/userdata/etc. For a repository installation, addons are in /usr/share/openhab2/addons/, and from there, the client console is located at ../runtime/bin/client. I assume you’re seeing errors when running the script… could you please post them?

as i’ve fixed my issue i’m reluctant to try it again on my production machine

ill install openhab on a fresh vm and test it for you tho and give you the errors I encounter


Uninstalling any managed binding(s) and installing openhab-serial-transport...
mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
KARAF_BASE is not valid: /usr/share/openhab2/userdata
... a 'No matching bundles' error mesage is normal, if a binding had not been previously installed.

Backing up and uninstalling any unmanaged installs of Zigbee...
mv: cannot stat '*.jar': No such file or directory



!!!!! It has taken more than two minutes to uninstall the Zigbee binding, so exiting !!!!!


this is on a fresh ubuntu 18.10 server installation with zulu 8 jvm installed, no other software is installed on the vm

I used the current script from your github repo, the rename error is gone

Those errors are from the /runtime/bin/client script and others have reported them. They usually turn out to be account/permissions related. The script must be run by the account that runs OH, which is typically openhab, from the addons directory while OH is running. Could you show more of the output from the script, starting with command that was used to execute it?

Maybe drive space…

It’s probably time for me to get a repository installation setup :slightly_smiling_face:. Thank you for taking the time to help troubleshoot this!

I ran it as the openhab user

 sudo -u openhab ./zzManualInstaller.sh

there is plenty df free space on the disk

/dev/mapper/openhab2test--vg-root  8.9G  3.2G  5.2G  39% /


!!!!! If you have manually added the Zigbee or Z-Wave binding to your addons.cfg file, they must be removed from the file or the old version will reinstall !!!!!

What would you like to do?
1) Install or upgrade Zigbee binding
2) Install or upgrade Z-Wave binding
3) Install or upgrade both bindings
4) Install the openhab-transport-serial feature
5) Uninstall Zigbee binding
6) Uninstall Z-Wave binding
7) Uninstall both bindings
8) Exit
#? 1


Zigbee binding: The OpenHAB snapshot binding will be downloaded, but Which libraries would you like to use?
!!!!! DO NOT select 'ZigBee Library snapshot' unless Chris has specifically instructed you to do so !!!!!
1) OpenHAB baseline (included in OpenHAB snapshot)
2) ZigBee Library release (pre-OpenHAB snapshot)
3) ZigBee Library snapshot (still in development)
4) Exit
#? 1

     *****     SUMMARY     *****

Addons path: /usr/share/openhab2/addons
OpenHAB account: openhab
Requested action: Install or upgrade Zigbee binding
Current OpenHAB snapshot version: 2.5.0
Requested Zigbee version: OpenHAB baseline (included in OpenHAB snapshot)
Requested Zigbee library version: 1.1.6

Is this correct?
1) Yes, start now                      3) Exit
2) No, take me back to the first menu
#? 1

Uninstalling any managed binding(s) and installing openhab-serial-transport...
mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
KARAF_BASE is not valid: /usr/share/openhab2/userdata
... a 'No matching bundles' error mesage is normal, if a binding had not been previously installed.

Backing up and uninstalling any unmanaged installs of Zigbee...
mv: cannot stat '*.jar': No such file or directory


!!!!! It has taken more than two minutes to uninstall the Zigbee binding, so exiting !!!!!

1 Like

Just one more bit of info for me to reproduce this… could you please run pwd from where you launched the script from?

/usr/share/openhab2/addons

1 Like

Hi, I get the same error.

sudo -u openhab ./zzManualInstaller.sh
Script version: 1.0.2

This script is capable of downloading and manually installing the latest development or snapshot builds of the Z-Wave and Zigbee bindings, and/or the openhab-transport-serial
feature. The script must reside inside the addons folder and be executed on the machine running OpenHAB. Before a binding is installed, any previous versions will be
uninstalled. Any manually installed versions will also be backed up by moving them to /addons/archive. The installation of any binding will also include the installation
of the openhab-transport-serial feature. After using this script, you can uninstall the bindings by deleting their jars from addons, or you can use this script.

!!!!! If you have manually added the Zigbee or Z-Wave binding to your addons.cfg file, they must be removed from the file or the old version will reinstall !!!!!

What would you like to do?
1) Install or upgrade Zigbee binding
2) Install or upgrade Z-Wave binding
3) Install or upgrade both bindings
4) Install the openhab-transport-serial feature
5) Uninstall Zigbee binding
6) Uninstall Z-Wave binding
7) Uninstall both bindings
8) Exit
#? 3


Z-Wave binding: Would you like to download the OpenHAB snapshot or development version?
!!!!! DO NOT select 'Development' unless Chris has specifically instructed you to do so !!!!!
1) OpenHAB snapshot
2) Development
3) Exit
#? 1


Zigbee binding: The OpenHAB snapshot binding will be downloaded, but Which libraries would you like to use?
!!!!! DO NOT select 'ZigBee Library snapshot' unless Chris has specifically instructed you to do so !!!!!
1) OpenHAB baseline (included in OpenHAB snapshot)
2) ZigBee Library release (pre-OpenHAB snapshot)
3) ZigBee Library snapshot (still in development)
4) Exit
#? 1

     *****     SUMMARY     *****

Addons path: /usr/share/openhab2/addons
OpenHAB account: openhab
Requested action: Install or upgrade both bindings
Current OpenHAB snapshot version: 2.5.0
Requested Z-Wave version: OpenHAB snapshot
Requested Zigbee version: OpenHAB baseline (included in OpenHAB snapshot)
Requested Zigbee library version: 1.1.6

Is this correct?
1) Yes, start now                      3) Exit
2) No, take me back to the first menu
#? 1

Uninstalling any managed binding(s) and installing openhab-serial-transport...
mkdir: das Verzeichnis »/usr/share/openhab2/userdata/tmp“ kann nicht angelegt werden: Datei oder Verzeichnis nicht gefunden
KARAF_BASE is not valid: /usr/share/openhab2/userdata
... a 'No matching bundles' error mesage is normal, if a binding had not been previously installed.

Backing up and uninstalling any unmanaged installs of Zigbee...
mv: Aufruf von stat für '*.jar' nicht möglich: Datei oder Verzeichnis nicht gefunden

Backing up and uninstalling any unmanaged installs of Z-Wave...
mv: Aufruf von stat für '*.jar' nicht möglich: Datei oder Verze done. nicht gefunden


!!!!! It has taken more than two minutes to uninstall the Zigbee binding, so exiting !!!!!

pwd

/usr/share/openhab2/addons

Disk Space via df

/dev/mapper/System-Root    51475068   30299464   18576452   62% /

ls -la

drwxr-xr-x 3 openhab openhab  4096 Apr  3 22:40 .
drwxr-xr-x 4 openhab openhab  4096 Mär 26 00:08 ..
drwxr-xr-x 4 openhab openhab  4096 Apr  3 22:21 archive
-rw-r--r-- 1 openhab openhab    70 Dez 17 09:01 README
-rwxr-xr-x 1 openhab openhab 35314 Apr  3 22:15 zzManualInstaller.sh

System Infos

Distributor ID: Ubuntu
Description:    Ubuntu 18.10
Release:        18.10
Codename:       cosmic

4.18.0-16-generic x86_64

java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

@SMHRambo and @Nozlaf, I setup a package installation and was able to use this to run the script…

sudo -E -u openhab bash zzManualInstaller.sh

ill rebuild my test vm and try today

its strange that when I tested it i got the errors but when you tested it you didnt, so I thought maybe you were running a different distro to me, I have tested this on fresh installs of centos 7 and ubuntu 18.10 and I can see that it works on centos but not ubuntu

CENTOS 7

1st time executing


Addons path: /usr/share/openhab2/addons
OpenHAB account: openhab
Requested action: Install or upgrade Zigbee binding
Current OpenHAB snapshot version: 2.5.0
Requested Zigbee version: OpenHAB baseline (included in OpenHAB snapshot)
Requested Zigbee library version: 1.1.6

Is this correct?
1) Yes, start now                      3) Exit
2) No, take me back to the first menu
#? 1

Uninstalling any managed binding(s) and installing openhab-serial-transport...
Logging in as openhab
Error executing command: No matching bundles
... a 'No matching bundles' error mesage is normal, if a binding had not been previously installed.

Backing up and uninstalling any unmanaged installs of Zigbee...
mv: cannot stat ‘*.jar’: No such file or directory              done.

Downloading new Zigbee jars... done.

Installing unmanaged Zigbee binding...

!!!!! It has taken more than two minutes to install the Zigbee binding, so exiting !!!!!


2nd time executing


     *****     SUMMARY     *****

Addons path: /usr/share/openhab2/addons
OpenHAB account: openhab
Requested action: Install or upgrade Zigbee binding
Current OpenHAB snapshot version: 2.5.0
Requested Zigbee version: OpenHAB baseline (included in OpenHAB snapshot)
Requested Zigbee library version: 1.1.6

Is this correct?
1) Yes, start now                      3) Exit
2) No, take me back to the first menu
#? 1

Uninstalling any managed binding(s) and installing openhab-serial-transport...
Logging in as openhab
... a 'No matching bundles' error mesage is normal, if a binding had not been previously installed.

Backing up and uninstalling any unmanaged installs of Zigbee... done.

Downloading new Zigbee jars... done.

Installing unmanaged Zigbee binding... done.

Complete!

Ubuntu 18.10 I get the following error every time I execute it (also note that ubuntu has the cannot create directory error)

     *****     SUMMARY     *****

Addons path: /usr/share/openhab2/addons
OpenHAB account: openhab
Requested action: Install or upgrade Zigbee binding
Current OpenHAB snapshot version: 2.5.0
Requested Zigbee version: OpenHAB baseline (included in OpenHAB snapshot)
Requested Zigbee library version: 1.1.6

Is this correct?
1) Yes, start now                      3) Exit
2) No, take me back to the first menu
#? 1

Uninstalling any managed binding(s) and installing openhab-serial-transport...
mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
KARAF_BASE is not valid: /usr/share/openhab2/userdata
... a 'No matching bundles' error mesage is normal, if a binding had not been previously installed.

Backing up and uninstalling any unmanaged installs of Zigbee... done.

Downloading new Zigbee jars...


!!!!! It has taken more than two minutes to install the Zigbee binding, so exiting !!!!!


both environments were configured identically only difference being that the ubuntu environment used the deb packages via the apt repo instead of the rpm’s via the yum repo

I’m testing the Fedora 29 (rpm). I really thought using the -E option for sudo would resolve this for you, but maybe there is something different in the deb packages.

If you just run sudo -E -u openhab /usr/share/openhab2/runtime/bin/client, you get the same KARAF_BASE is not valid error?

I guess the next option is to use openhab-cli console for package installations. Is that how you normally get into the console?

yeah i ran it with the -E option on both distro’s
yes i’d run openhab-cli console to access the console

I setup a VM of Ubuntu, and I’m seeing the same error you are reporting, just as I did before using -E. I changed the script to check for the existence of /usr/bin/openhab-cli, and if it exists, I use that to launch the console. If not, I call ../runtime/bin/client directly. This worked on my Ubuntu setup. Hopefully that gets the script working for everyone! Please try running it again (and have it grab the latest).

curious you are needing to specify the path to the executable, openhab-cli should be in the path and executable without specifying the full path to the executable
on both rpm installs and apt installs it is anyway not sure if it would be for a manual install

I edited the script and removed the path to the client executable on both ubuntu and centos and it worked fine calling openhab-cli console {karaf

this is all i did

  if [[ -f "/usr/bin/openhab-cli" ]]; then
        openhab-cli console ${KARAF_FUNCTION} --
        echo -e "apt installation"
    else
        openhab-cli console ${KARAF_FUNCTION} --
      echo -e "rpm installation" 
    fi

you could obviously remove all the logic and just call the command
if this wont work for manually installed environment i’d suggest checking for the manual installed environment and then calling that differently maybe

first time i run it I get the timeout 2 minutes thing (also had this on centos) but 2nd time I ran it success

It is not needed, but if I’ve tested for its existence in a specific path, why not fully qualify it? Both apt and yum/dnf based systems will have openhab-cli in /usr/bin/, so the else in your if/then would be unreachable, and will error for manual installations. That’s why I did this…

if [[ -f "/usr/bin/openhab-cli" ]]; then
    /usr/bin/openhab-cli console ${KARAF_FUNCTION} --
else
    ../runtime/bin/client ${KARAF_FUNCTION} --
fi

I was noticing that too and will look into it later. However, I don’t think manual installations are necessary in most cases, so I plan to make a version of the script that will just upgrade the binding in place, using this method…

bundle:update org.openhab.binding.zwave https://openhab.jfrog.io/openhab/online-repo-snapshot/2.5/org/openhab/binding/org.openhab.binding.zwave/2.5.0-SNAPSHOT/org.openhab.binding.zwave-2.5.0-SNAPSHOT.jar

For zwave, there’s not much need for a script, but it makes it convenient. For zigbee, you’d need to enter it four times, so much more convenient with a script. And no jar files or addons.cfg to worry about! Of course, the best solution is to add the ability to individually select which release/repository a binding is pulled from, and a UI for triggering the update.

ah fair enough I didn’t even check on my centos install if the openhab-cli existed there I assumed it didn’t (was late when I wrote that)

i’d still lean towards not specifying the path to the openhab-cli command, check for its existence (not in a specific location just that it exists) and then execute it
like this

command -v openhab-cli >/dev/null 2>&1 || { echo >&2 "I cant seem to find openhab-cli"; exit 1; }

it would allow for a broader range of openhab installation options and future proof the script

and I agree using the bundle:update method would probable be the best way

Also I think this script is essential for anyone wanting to run zigbee binding without upgrading to the testing branch of openhab2 so great work

I have pushed v1.2.0…

* Changed download directories for the bindings after the BND migration 
* Changed to openhab-core-io-transport-serial
* Added openhab-core-config-discovery-usbserial
* Added org.apache.servicemix.bundles.xstream

Note: when installing/upgrading Zigbee, I have found that a restart of OH is required :slightly_frowning_face:.