OH1.8 runs fine but can't start OH2 (karaf)

An older snapshot of OH2 I’d tried worked (deleted by now of course) but OH2 latest (post RC) gives error when I try to start:

Launching the openHAB runtime…
./start.sh: exec: line 7: ./runtime/bin/karaf: not found

I suppose I should add, this is on a fairly cut down limited “linux” NAS box. I managed to get Java installed on it (

Java™ SE Embedded Runtime Environment (build 1.8.0_101-b13, headless)
Java HotSpot™ Embedded Client VM (build 25.101-b13, mixed mode)

) which is running OH 1.8 just fine, but for some reason won’t run OH2. It doesn’t have access to packages like apt-get.

Guessing this is in the too hard basket?

which model?
How did you deploy the OH2 2.0.0 zip file? In which sub-directory? How are you trying to start OH2?

It seems that the script is not using the variable ${DIRNAME} and it is trying to execute the karaf binary from a wrong path.

The NAS box is a D-Link DNS320L running fonz fun plug to unlock it for installing other things, however it’s still quite limited in what I can easily get on there (e.g. no python, apt-get, etc)

It’s pretty low spec however it’s been running OH1.8 fine - hoping OH2.0 isn’t much heavier to run.

I unzipped the 2.0 zip file in a directory I created next to the running 1.8 directory, and I’m trying to start 2.0 the same way I start 1.8, which is a .sh file I added to populate the java path into PATH and JAVA_HOME before it calls start.sh. I copied the .sh file from my 1.8 install, which it starts fine, and the java path in both is the same.

same problem here with a fresh install of openhab 2 on synology dsm 5.2

Hmm, could it be that between OH1.8 and OH2 (likely between some OH2 snapshots and OH2 release) changes were made to how it receives environmental variables?

I’m just using the classic export PATH=/path/to/java:$PATH and it’s working fine for OH1.8 but not OH2 release.

Edit the first line of ./runtime/bin/karaf from #!/bin/bash to #/bin/sh

I ran into the same issue getting running on FreeBSD. For some reason karaf is looking for bash, but your system doesn’t have it. These startup script files are as they come from the karaf project, it’s not openhab. This “fix” may well break things, but it’s working like a champ for me now. I suppose alternatively you could install bash, but it sounds like getting that on the D-Link NAS would be a pain.

For eveyone coming to this thread looking for solution:

Download and unzip OpenHab2

pkg install bash openjdk8 git
vi start.sh
#!/usr/local/bin/bash in first line
ln -s /usr/local/bin/bash /bin/bash

Now you wait 5 mins and access IP:8080 in webbrowser

Hmm, yep well I changed it to bin/sh and it progresses further now. Once I clean out it’s belief of a running instance pid, it sits and shows nothing (trying to run?) rather than throwing an error and exiting.

Re the other post, I checked and I have ‘ln’ alhough it will lose it’s settings between reboots, and I don’t have ‘pkg’ (or any package manager).

Which Java-Version are you using?


I’m on 121 now. Had to switch from OpenJDK to Oracle to make some things work. Was pretty touch because I’m using FreeBSD Jail in FreeNAS. I will sum things up after everything is running, maybe you can draw some conclusions from that.