Install OpenHAB2 on emonSD / emonPi

Hi all,

I tried to install OpenHAB 2 beta 4 on this image. Because of the absence of a openhab2 folder in /var/log OpenHAB 2 doesn’t start. So rpi-rw, sudo mkdir openhab2, sudo chown openhab:openhab openhab2 and openhab 2 works. But after a reboot my openhab2 folder is gone… Any ideas?

Also started a thread here: Trying to install OH 2 beta 4 on OpenEnergyMonitor image - #4 by rlkoshak - Beginners - openHAB Community

This is because on the emonpi /var/log is mounted as a temp RAM partition.

You need to edit ~/emonpi/rc.local_jessieminimal which is symlinked to /etc/rc.local to create the folder you need on startup:

Once you get openHAB 2 up and running it would be great if you could update us on OpenHAB development. How soon should we all update to openHAB 2? How can we replicate the OpenEnergyMonitor OpenHAB setup on openHab2?

Done, now a small step further :slight_smile:

pi@emonpi:/var/log $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
Active: active (running) since Fri 2016-09-30 12:35:16 UTC; 945ms ago
Docs: http://docs.openhab.org
https://community.openhab.org
Process: 7024 ExecStop=/usr/share/openhab2/runtime/karaf/bin/stop (code=exited, status=1/FAILURE)
Main PID: 7172 (karaf)
CGroup: /system.slice/openhab2.service
├─7172 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
├─7270 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
├─7271 /usr/bin/java -version
├─7272 grep -E “([0-9].[0-9]..[0-9]).
├─7273 awk {print substr($3,2,length($3)-2)}
├─7274 awk {print substr($1, 3, 3)}
└─7275 sed -e s;.;;g

Sep 30 12:35:16 emonpi systemd[1]: Started openHAB 2 - empowering the smart home.
Sep 30 12:35:16 emonpi start.sh[7172]: Launching the openHAB runtime…
pi@emonpi:/var/log $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
Active: active (running) since Fri 2016-09-30 12:35:25 UTC; 1s ago
Docs: http://docs.openhab.org
https://community.openhab.org
Process: 7593 ExecStop=/usr/share/openhab2/runtime/karaf/bin/stop (code=exited, status=1/FAILURE)
Main PID: 7739 (karaf)
CGroup: /system.slice/openhab2.service
├─7739 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
└─7852 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenh…

Sep 30 12:35:25 emonpi systemd[1]: Starting openHAB 2 - empowering the smart home…
Sep 30 12:35:25 emonpi systemd[1]: Started openHAB 2 - empowering the smart home.
Sep 30 12:35:25 emonpi start.sh[7739]: Launching the openHAB runtime…
Sep 30 12:35:27 emonpi start.sh[7739]: Unable to update instance pid: /usr/share/openhab2/runtime/karaf/instances/instance.properties (Read-only file system)

1 Like

The other trick we do on the emonSD is mount var/lib/openhab onto tmpfs

~/emonpi/fstab is symlinked to /etc/fstab

It looks like you might need to add an entry to also mount /usr/share/openhab2

I already changed that one to /openhab2

Some more log files :grinning:

pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 14:58:49 UTC; 2min 39s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 982 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 982 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1590 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -...

Sep 30 14:58:49 emonpi systemd[1]: Started openHAB 2 - empowering the smart home.
Sep 30 14:58:49 emonpi start.sh[982]: Launching the openHAB runtime...
Sep 30 14:58:52 emonpi start.sh[982]: Unable to update instance pid: /usr/share/openhab2/runtime/karaf/instances/instance.properties (Read-only file system)
pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 14:58:49 UTC; 2min 47s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 982 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 982 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1590 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -...

Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 15:01:34 emonpi start.sh[982]: at java.lang.Thread.run(Thread.java:745)
pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 14:58:49 UTC; 2min 50s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 982 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 982 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1590 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -...

Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 15:01:34 emonpi start.sh[982]: at java.lang.Thread.run(Thread.java:745)
pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 14:58:49 UTC; 2min 52s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 982 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 982 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1590 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -...

Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 15:01:34 emonpi start.sh[982]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 15:01:34 emonpi start.sh[982]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 15:01:34 emonpi start.sh[982]: at java.lang.Thread.run(Thread.java:745)
pi@emonpi:~ $ ssh karaf@localhost -p8101
ssh: connect to host localhost port 8101: Connection refused
pi@emonpi:~ $ tail -f /var/log/openhab2/openhab.log
  Unresolved requirement: Import-Package: org.eclipse.smarthome.ui.items; resolu                                                                                                                                    tion:="optional"
    -> Export-Package: org.eclipse.smarthome.ui.items; bundle-symbolic-name="org                                                                                                                                    .eclipse.smarthome.ui"; bundle-version="0.9.0.b1"; version="0.0.0"
       org.eclipse.smarthome.ui [130]
         Unresolved requirement: Import-Package: org.osgi.service.http

        at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.                                                                                                                                    osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispat                                                                                                                                    chEvent(ModuleContainer.java:1498)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispat                                                                                                                                    chEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventM                                                                                                                                    anager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(Even                                                                                                                                    tManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
^C
pi@emonpi:~ $ tail -f /var/log/openhab2/openhab.log
  Unresolved requirement: Import-Package: org.eclipse.smarthome.ui.items; resolution:="optional"
    -> Export-Package: org.eclipse.smarthome.ui.items; bundle-symbolic-name="org.eclipse.smarthome.ui"; bundle-version="0.9.0.b1"; version="0.0.0"
       org.eclipse.smarthome.ui [130]
         Unresolved requirement: Import-Package: org.osgi.service.http

        at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1498)[org.eclipse.osgi-3.10.2.v20150203-1939.                                                          jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar                                                          :]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
^[[A^[[A^[[A^[[A^C
pi@emonpi:~ $ tail -f /var/log/openhab2/openhab.log
  Unresolved requirement: Import-Package: org.eclipse.smarthome.ui.items; resolution:="optional"
    -> Export-Package: org.eclipse.smarthome.ui.items; bundle-symbolic-name="org.eclipse.smarthome.ui"; bundle-version="0.9.0.b1"; version="0.0.0"
       org.eclipse.smarthome.ui [130]
         Unresolved requirement: Import-Package: org.osgi.service.http

        at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1498)[org.eclipse.osgi-3.10.2.v20150203-1939.                                                          jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar                                                          :]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
^C
pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 16:08:04 UTC; 5min ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 988 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 988 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1610 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab...

Sep 30 16:08:04 emonpi systemd[1]: Started openHAB 2 - empowering the smart home.
Sep 30 16:08:04 emonpi start.sh[988]: Launching the openHAB runtime...
Sep 30 16:08:08 emonpi start.sh[988]: Unable to update instance pid: /usr/share/openhab2/runtime/karaf/instances/instance.properties (Read-onl...e system)
Hint: Some lines were ellipsized, use -l to show in full.
pi@emonpi:~ $ rpi-rw
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 16:08:04 UTC; 5min ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 988 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 988 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1610 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab...

Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolEx...java:180)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 16:13:34 emonpi start.sh[988]: at java.lang.Thread.run(Thread.java:745)
Hint: Some lines were ellipsized, use -l to show in full.
pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 16:08:04 UTC; 5min ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 988 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 988 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1610 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab...

Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolEx...java:180)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 16:13:34 emonpi start.sh[988]: at java.lang.Thread.run(Thread.java:745)
Hint: Some lines were ellipsized, use -l to show in full.
pi@emonpi:~ $ sudo systemctl status openhab2.service -l
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 16:08:04 UTC; 5min ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 988 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 988 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1610 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Xmx256m -Djava.awt.headless=true -Djava.endorsed.dirs=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/jre/lib/endorsed:/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/endorsed:/usr/share/openhab2/runtime/karaf/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/jre/lib/ext:/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/ext:/usr/share/openhab2/runtime/karaf/lib/ext -Dkaraf.instances=/usr/share/openhab2/runtime/karaf/instances -Dkaraf.home=/usr/share/openhab2/runtime/karaf -Dkaraf.base=/var/lib/openhab2 -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/usr/share/openhab2/runtime/karaf/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab2/tmp -Djava.util.logging.config.file=/var/lib/openhab2/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.diagnostic.boot-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.jaas.boot-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.main-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 16:13:34 emonpi start.sh[988]: at java.lang.Thread.run(Thread.java:745)
pi@emonpi:~ $ sudo systemctl status openhab2.service -l
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 16:08:04 UTC; 5min ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 988 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 988 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1610 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Xmx256m -Djava.awt.headless=true -Djava.endorsed.dirs=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/jre/lib/endorsed:/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/endorsed:/usr/share/openhab2/runtime/karaf/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/jre/lib/ext:/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/ext:/usr/share/openhab2/runtime/karaf/lib/ext -Dkaraf.instances=/usr/share/openhab2/runtime/karaf/instances -Dkaraf.home=/usr/share/openhab2/runtime/karaf -Dkaraf.base=/var/lib/openhab2 -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/usr/share/openhab2/runtime/karaf/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab2/tmp -Djava.util.logging.config.file=/var/lib/openhab2/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.diagnostic.boot-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.jaas.boot-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.main-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 16:13:34 emonpi start.sh[988]: at java.lang.Thread.run(Thread.java:745)
pi@emonpi:~ $ sudo systemctl status openhab2.service -l
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 16:08:04 UTC; 6min ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 988 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 988 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1610 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Xmx256m -Djava.awt.headless=true -Djava.endorsed.dirs=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/jre/lib/endorsed:/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/endorsed:/usr/share/openhab2/runtime/karaf/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/jre/lib/ext:/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/ext:/usr/share/openhab2/runtime/karaf/lib/ext -Dkaraf.instances=/usr/share/openhab2/runtime/karaf/instances -Dkaraf.home=/usr/share/openhab2/runtime/karaf -Dkaraf.base=/var/lib/openhab2 -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/usr/share/openhab2/runtime/karaf/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab2/tmp -Djava.util.logging.config.file=/var/lib/openhab2/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.diagnostic.boot-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.jaas.boot-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.apache.karaf.main-4.0.4.jar:/usr/share/openhab2/runtime/karaf/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 16:13:34 emonpi start.sh[988]: at java.lang.Thread.run(Thread.java:745)
pi@emonpi:~ $ tail -f /var/log/openhab2/openhab.log
  Unresolved requirement: Import-Package: org.eclipse.smarthome.ui.items; resolution:="optional"
    -> Export-Package: org.eclipse.smarthome.ui.items; bundle-symbolic-name="org.eclipse.smarthome.ui"; bundle-version="0.9.0.b1"; version="0.0.0"
       org.eclipse.smarthome.ui [130]
         Unresolved requirement: Import-Package: org.osgi.service.http

        at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1498)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
^C
pi@emonpi:~ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Fri 2016-09-30 16:08:04 UTC; 6min ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 988 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─ 988 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
           └─1610 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/open...

Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Sep 30 16:13:34 emonpi start.sh[988]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Sep 30 16:13:34 emonpi start.sh[988]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Sep 30 16:13:34 emonpi start.sh[988]: at java.lang.Thread.run(Thread.java:745)
pi@emonpi:~ $ tail -f /var/log/openhab2/openhab.log
  Unresolved requirement: Import-Package: org.eclipse.smarthome.ui.items; resolution:="optional"
    -> Export-Package: org.eclipse.smarthome.ui.items; bundle-symbolic-name="org.eclipse.smarthome.ui"; bundle-version="0.9.0.b1"; version="0.0.0"
       org.eclipse.smarthome.ui [130]
         Unresolved requirement: Import-Package: org.osgi.service.http

        at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1498)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
^C
pi@emonpi:~ $

Just tried a empty jessie lite image and installed openhab2, this works fine.
So it only comes from removing openhab 1.8 and/or the read-only filesystem.

From the log files this seems to be the main issue. Any idea what this is and how it can be installed?

Ok, I retried. Took a clean image. How I started:

sudo apt-get update
sudo apt-get remove openhab-runtime
java -version
sudo apt-get install screen mc vim git htop
sudo apt-get install oracle-java8-jdk
sudo echo 'deb http://dl.bintray.com/openhab/apt-repo2 testing main' | sudo tee /etc/apt/sources.list.d/openhab2.list
sudo wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
sudo apt-get update
sudo reboot

sudo nano ~/emonpi/rc.local_jessieminimal
Changed line 11 openhab to openhab2
Changed line 17 /var/log/openhab to /var/log/openhab2
sudo reboot

sudo nano ~/emonpi/fstab
Changed line 5 /var/lib/openhab to /var/lib/openhab2
added underneath line 5 tmpfs           /usr/share/openhab2 tmpfs  nodev,nosuid,size=40M,mode=1777 0  0
sudo apt-get install openhab2-offline
sudo systemctl start openhab2.service
sudo systemctl status openhab2.service
sudo systemctl daemon-reload
sudo systemctl enable openhab2.service
sudo reboot

openHAB2 won’t run, also no log file in /var/log/openhab2

pi@emonpi:/ $ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: failed (Result: start-limit) since Mon 2016-10-10 22:23:32 UTC; 3s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
  Process: 32132 ExecStop=/usr/share/openhab2/runtime/karaf/bin/stop (code=exited, status=203/EXEC)
  Process: 32130 ExecStart=/usr/share/openhab2/start.sh server (code=exited, status=203/EXEC)
 Main PID: 32130 (code=exited, status=203/EXEC)

Oct 10 22:23:32 emonpi systemd[1]: Unit openhab2.service entered failed state.
Oct 10 22:23:32 emonpi systemd[1]: openhab2.service holdoff time over, scheduling restart.
Oct 10 22:23:32 emonpi systemd[1]: Stopping openHAB 2 - empowering the smart home...
Oct 10 22:23:32 emonpi systemd[1]: Starting openHAB 2 - empowering the smart home...
Oct 10 22:23:32 emonpi systemd[1]: openhab2.service start request repeated too quickly, refusing to start.
Oct 10 22:23:32 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Oct 10 22:23:32 emonpi systemd[1]: Unit openhab2.service entered failed state.

Then again, a sudo reboot and a sudo apt-get upgrade. Same result :neutral_face:.

Oh dear, this is not cool.

I can’t see anything useful in the log files. I’m afraid I don’t know the intricacies of how openhab works let alone openhab2 to debug further without better info from the log. Maybe it’s time to ask the openhab forum guys regarding running on R/O FS.

Already a work in progress :slight_smile: Trying to install OH 2 beta 4 on OpenEnergyMonitor image - Beginners - openHAB Community

Mmm good conversation on that thread. I’m away this week but when I’m home I will try and install open hab 2 myself. Would be good to get install procedure written up to work with our r/o image.

Have you tried added in a line to rc.local to restart openhab2 after creating the log directory?

E.g

This is my effort so far once openhab2 is installed via deb:
> mount -t tmpfs tmpfs /var/lib/openhab2/cache

mount -t tmpfs tmpfs /var/lib/openhab2/mapdb
mount -t tmpfs tmpfs /var/lib/openhab2/tmp
mount -t tmpfs tmpfs /var/lib/openhab2/log
ln -s /var/lib/openhab2/tmp/port /var/lib/openhab2/port
ln -s /var/lib/openhab2/tmp/lock /var/lib/openhab2/lock
rm -rf /var/lib/openhab2/persistence && ln -s /mnt/rwdata/openhab2/persistence /var/lib/openhab2/persistence
1 Like

Did it work?!

  • sent from my mobile device

Sorry! Yes it works. Just wanted to add to the thread in case it helps, I’ve got it running fine on a Pi with the above commands. /mnt/rwdata is a writeable usb stick here (there’s quite a lot of persistence data which could probably be stored in a ram disk if you don’t need to store it permanently). It may help to have mapdb on writeable storage because it takes quite a long time to start up openhab when mapdb database needs to be recreated (and it will store any config created via UI rather than stored in config files in /etc/openhab2).

1 Like

Nice work :smile:

I’ll add a link to this thread from the OpenEnergyMonitor OpenHAB git repo

There’s been a few changes with openhab2, not least the change to jsondb (replacing mapdb) for saving configuration through the UI. /mnt/rwdata is a read/write usb key. Any config I wish to save is moved to /etc/openhab2 so I can manage it easily.
Below are the steps I’m currently using:

mount -t tmpfs tmpfs /var/lib/openhab2/cache
mount -t tmpfs tmpfs /var/lib/openhab2/tmp
mount -t tmpfs tmpfs /var/lib/openhab2/log
rm /var/lib/openhab2/port && ln -s /var/lib/openhab2/tmp/port /var/lib/openhab2/port
rm -rf /var/lib/openhab2/lock && ln -s /var/lib/openhab2/tmp/lock /var/lib/openhab2/lock
rm -rf /var/lib/openhab2/persistence && ln -s /mnt/rwdata/openhab2/persistence /var/lib/openhab2/persistence
mv /var/lib/openhab2/etc /etc/openhab2/etc
ln -s /etc/openhab2/etc /var/lib/openhab2/etc
mv /var/lib/openhab2/jsondb /etc/openhab2/jsondb
ln -s /etc/openhab2/jsondb /var/lib/openhab2/jsondb

Quick update on this to autoconfigure this:

Create file /usr/share/openhab2/start_pre.sh:

#!/bin/sh
test -d /var/lib/openhab2/cache || mkdir /var/lib/openhab2/cache
mountpoint -q /var/lib/openhab2/cache || mount -t tmpfs tmpfs /var/lib/openhab2/cache
test -d /var/lib/openhab2/tmp || mkdir /var/lib/openhab2/tmp
mountpoint -q /var/lib/openhab2/tmp || mount -t tmpfs tmpfs /var/lib/openhab2/tmp
test -d /var/lib/openhab2/log || mkdir /var/lib/openhab2/log
mountpoint -q /var/lib/openhab2/log || mount -t tmpfs tmpfs /var/lib/openhab2/log

Modify /usr/lib/systemd/system/openhab2.service:

[Unit]
Description=openHAB 2 - empowering the smart home
Documentation=http://docs.openhab.org
Documentation=https://community.openhab.org
Wants=network-online.target
After=network-online.target

[Service]
EnvironmentFile=/etc/default/openhab2
User=openhab
Group=openhab
WorkingDirectory=/usr/share/openhab2
PermissionsStartOnly=true
ExecStartPre=/usr/share/openhab2/start_pre.sh
ExecStart=/usr/share/openhab2/start.sh server
ExecStop=/usr/share/openhab2/runtime/bin/stop
# Shutdown delay in seconds, before process is tried to be killed with KILL (if configured)
TimeoutStopSec=120
Restart=on-failure

[Install]
WantedBy=multi-user.target

(Note: The PermissionsStartOnly=true is important as the start_pre script needs to run as root).

You still need to run the commands on initial setup:

rm /var/lib/openhab2/port && ln -s /var/lib/openhab2/tmp/port /var/lib/openhab2/port
rm -rf /var/lib/openhab2/lock && ln -s /var/lib/openhab2/tmp/lock /var/lib/openhab2/lock
rm -rf /var/lib/openhab2/persistence && ln -s /mnt/rwdata/openhab2/persistence /var/lib/openhab2/persistence
mv /var/lib/openhab2/etc /etc/openhab2/etc
ln -s /etc/openhab2/etc /var/lib/openhab2/etc
mv /var/lib/openhab2/jsondb /etc/openhab2/jsondb
ln -s /etc/openhab2/jsondb /var/lib/openhab2/jsondb

but don’t need the mount commands as they are taken care of in start_pre.sh each run.

Hi Matthew,

I tried your steps on a clean emonSD image (the latest nov16 release) and removed OH1.8 before installing OH2 (stable branch) and OH2-addons.

pi@emonpi(ro):~$ rpi-rw
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
pi@emonpi(rw):~$ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: failed (Result: start-limit) since Mon 2017-02-27 11:42:22 UTC; 3min 28s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
  Process: 1432 ExecStartPre=/usr/share/openhab2/start_pre.sh (code=exited, status=203/EXEC)

Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service holdoff time over, scheduling restart.
Feb 27 11:42:22 emonpi systemd[1]: Stopping openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: Starting openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service start request repeated too quickly, refusing to start.
Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
pi@emonpi(rw):~$ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: failed (Result: start-limit) since Mon 2017-02-27 11:42:22 UTC; 3min 48s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
  Process: 1432 ExecStartPre=/usr/share/openhab2/start_pre.sh (code=exited, status=203/EXEC)

Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service holdoff time over, scheduling restart.
Feb 27 11:42:22 emonpi systemd[1]: Stopping openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: Starting openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service start request repeated too quickly, refusing to start.
Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
pi@emonpi(rw):~$ sudo systemctl stop openhab2.service
pi@emonpi(rw):~$ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: failed (Result: start-limit) since Mon 2017-02-27 11:42:22 UTC; 4min 1s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
  Process: 1432 ExecStartPre=/usr/share/openhab2/start_pre.sh (code=exited, status=203/EXEC)

Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service holdoff time over, scheduling restart.
Feb 27 11:42:22 emonpi systemd[1]: Stopping openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: Starting openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service start request repeated too quickly, refusing to start.
Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
Feb 27 11:46:22 emonpi systemd[1]: Stopped openHAB 2 - empowering the smart home.
pi@emonpi(rw):~$ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: failed (Result: start-limit) since Mon 2017-02-27 11:42:22 UTC; 4min 4s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
  Process: 1432 ExecStartPre=/usr/share/openhab2/start_pre.sh (code=exited, status=203/EXEC)

Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service holdoff time over, scheduling restart.
Feb 27 11:42:22 emonpi systemd[1]: Stopping openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: Starting openHAB 2 - empowering the smart home...
Feb 27 11:42:22 emonpi systemd[1]: openhab2.service start request repeated too quickly, refusing to start.
Feb 27 11:42:22 emonpi systemd[1]: Failed to start openHAB 2 - empowering the smart home.
Feb 27 11:42:22 emonpi systemd[1]: Unit openhab2.service entered failed state.
Feb 27 11:46:22 emonpi systemd[1]: Stopped openHAB 2 - empowering the smart home.

I’m also struggling with the same issue. I think it could be that OH2 requires some contents in /var/lib/openhab2. I need to look into this further.

What is the content of your /usr/lib/systemd/system/openhab2.service and /usr/share/openhab2/start_pre.sh files?

It’s the start_pre.sh script that’s failing according to those logs which means openhab won’t try and start. Make sure PermissionsStartOnly=true is set in openhab2.service as the start_pre.sh script must run as root. Check that the start_pre.sh script will run by itself.