fluppie
(Philippe)
September 29, 2016, 9:43am
1
Hi all,
I have the OpenEnergyMonitor image as a base (Jessie Lite, OH1.8, Node-Red, emonCS)
See: https://community.openenergymonitor.org/t/emonsd-03may16-release/
I removed openhab-runtime via apt-get and I installed the Oracle Java JDK and OpenHAB 2 through apt-get (sudo apt-get install openhab2-offline)
When I try to run OH2 I get the following error log:
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: deactivating (stop) (Result: exit-code) since Thu 2016-09-29 09:35:53 UTC; 665ms ago
Docs: http://docs.openhab.org
https://community.openhab.org
Process: 4435 ExecStart=/usr/share/openhab2/start.sh server (code=exited, status=255)
Main PID: 4435 (code=exited, status=255); : 4559 (karaf)
CGroup: /system.slice/openhab2.service
└─control
├─4559 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf stop
├─4656 /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java -version
└─4657 grep ^IBM
Sep 29 09:35:52 emonpi systemd[1]: Started openHAB 2 - empowering the smart home.
Sep 29 09:35:52 emonpi start.sh[4435]: Launching the openHAB runtime...
Sep 29 09:35:53 emonpi start.sh[4435]: /var/log/openhab2/openhab.log (No such file or directory)
Sep 29 09:35:53 emonpi systemd[1]: openhab2.service: main process exited, code=exited, status=255/n/a
Sep 29 09:35:53 emonpi stop[4559]: stop: Ignoring predefined value for KARAF_HOME
Any idea’s what this Karaf thing is?
Dim
(Angelos)
September 29, 2016, 3:44pm
2
Karaf info here: https://karaf.apache.org/manual/latest/overview.html (basically: it is used by OH2 as the main runtime container)
Not sure what is wrong here…
I have a hunch… try checking your folder permissions (example: check the permissions of the /var/log/openhab2 folder. It should be owned by the user openhab (not root).) Maybe some permissions are messed up due to the previous installation of OH1.
BR,
Dimitris
fluppie
(Philippe)
September 29, 2016, 4:44pm
3
Indeed, funny enough, I don’t have a openhab2 folder…
pi@emonpi:/var/log $ ls -l
total 10312
drwxr-xr-x 2 root adm 60 Sep 28 21:00 apache2
-rw-r----- 1 root adm 370016 Sep 29 16:01 auth.log
-rw------- 1 root utmp 384 Sep 29 16:00 btmp
-rw-r----- 1 root adm 1119185 Sep 29 16:01 daemon.log
-rw-r----- 1 root adm 1176003 Sep 29 15:17 daemon.log.1
-rw-r----- 1 root adm 1527289 Sep 29 14:17 daemon.log.2
-rw-r----- 1 root adm 1014 Sep 28 21:00 debug
-rw-rw-rw- 1 root root 935686 Sep 29 16:01 emoncms.log
drwxr-xr-x 2 emonhub root 100 Sep 29 14:17 emonhub
drwxr-xr-x 2 pi root 60 Sep 28 21:00 emonpilcd
-rw-r----- 1 root adm 509984 Sep 29 16:00 kern.log
drwxr-xr-x 2 pi pi 80 Sep 29 15:17 logrotate
-rw-r----- 1 root adm 508172 Sep 29 16:00 messages
-rw-rw-rw- 1 root root 0 Sep 28 21:00 mqtt_input.log
drwxr-xr-x 2 mysql adm 60 Sep 28 21:00 mysql
-rw-rw-rw- 1 root root 0 Sep 28 21:00 mysql.log
drwxr-xr-x 2 openhab openhab 40 Sep 28 21:00 openhab
drwxr-xr-x 2 redis redis 60 Sep 28 21:00 redis
-rw-rw-rw- 1 root root 0 Sep 28 21:00 service-runner.log
-rw-r----- 1 root adm 1142788 Sep 29 16:01 syslog
-rw-r----- 1 root adm 1208341 Sep 29 15:17 syslog.1
-rw-r----- 1 root adm 1559261 Sep 29 14:17 syslog.2
-rw-r----- 1 root adm 462292 Sep 29 16:00 ufw.log
-rw-rw-r-- 1 root utmp 3456 Sep 29 16:00 wtmp
When I manually create this folder and Chown the right rights to it, OpenHAB 2 works.
But after a reboot the folder is deleted and OpenHAB 2 won’t start before re-creating the folder and put the filesystem back into read-write mode ( rpi-rw ). I think there are some specific configurations (by the OpenEnergyMonitor team) to run in Read-Only mode.
1 Like
rlkoshak
(Rich Koshak)
September 29, 2016, 4:59pm
4
The openhab user does not have permission to create/write to log files in /var/log.
fluppie
(Philippe)
September 29, 2016, 5:26pm
5
I think I have to do this:
Read-only filesystem
If you want to run openHAB on emonPi with read-only file system you will need to mount /var/lib/openhab as tempfs in RAM
$ sudo sh -c "echo 'tmpfs /var/lib/openhab tmpfs nodev,nosuid,size=20M,mode=1777 0 0' >> /etc/fstab"
Also the correct ports will ned to be opend and RAM tmpfs log file created on startup. At the following to /etc/rc.local
sudo iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
sudo mkdir /var/log/openhab
sudo chmod 666 /var/log/openhab
/etc/init.d/openhab start
1 Like
fluppie
(Philippe)
September 29, 2016, 9:54pm
6
I confirm the steps from above won’t work. After a reboot my openhab2 folder is gone.
fluppie
(Philippe)
October 1, 2016, 3:45pm
7
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:]
According to Glyn from OpenEnergyMonitor, he thinks this line is the issue:
Unresolved requirement: Import-Package: org.osgi.service.http
Can I manually install this?
P.S.: Installing OH2 b4 on a clean Jessie Lite image works fine.
kevin
(kevin)
October 8, 2016, 10:38pm
9
The OEM Image runs read only, and the logging is redirected with folders being created in the ramdrive /var/log at boot. My guess is you will need to create the openhab2 folder in /var/log before you start OH2. I think this has something to do with /home/pi/emonpi/rc.local_jessieminimal which is linked to /etc/rc.local Buried away on the OEM site will be a guide for building the image which may contain clues about how this all works. Personally I’d image backup the card, and then edit /home/pi/emonpi/rc.local_jessieminimal to change “openhab” into “openhab2” on line 11 of the file.
I run a version of that image that I created myself with OH 1.8 in its own folder off the RW Data Partition.
fluppie
(Philippe)
October 9, 2016, 9:46pm
10
I’ve done that already
I also asked the OEM guys: https://community.openenergymonitor.org/t/install-openhab2-on-emonsd-emonpi/1741/2
So it must be something else where OH2 needs to write to.
kevin
(kevin)
October 9, 2016, 9:54pm
11
I’m interested in where this ends up - I took the easy way out on OH1 and ran it in a single RW folder at /home/pi/data/openhab with unnecessary logging turned off, and openhab.log redirected to the RAMDrive’d /tmp.
I may go the normal route when I go up to OH2, assuming the read only file system doesn’t make it stroppy
fluppie
(Philippe)
October 10, 2016, 10:30pm
12
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 .
Dim
(Angelos)
October 11, 2016, 3:30am
13
Not sure if this will help, but try adding more space to your /usr/share/openhab2 mount (and then re-install OH2).
In my system, it takes 56M and it is a new installation:
root@openhab:/usr/share/openhab2# du -h --max-depth=1
56M ./runtime
4.0K ./bin
8.0K ./addons
56M .
Try also the following: set DEBUG=true (or on?) in /etc/default/openhab2 and try to see if the log file gets populated (tail -f /var/log/openhab2/openhab.log)
On the other hand… remember that mounting this folder (/usr/share/openhab2) into ramdisk means that all files in that mount will be deleted upon reboot… and as a result, the start script will fail.
BR,
Dimitris
fluppie
(Philippe)
October 11, 2016, 9:18am
14
Correct, it was not nescessary to mount /usr/share/openhab2 to the ramdisk.
I removed it from fstab and now I’m a little bit further.
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 Tue 2016-10-11 09:08:36 UTC; 5min ago
Docs: http://docs.openhab.org
https://community.openhab.org
Main PID: 972 (karaf)
CGroup: /system.slice/openhab2.service
├─ 972 /bin/sh /usr/share/openhab2/runtime/karaf/bin/karaf server
└─1592 /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
Oct 11 09:11:50 emonpi start.sh[972]: at org.eclipse.osgi.storage.Storage.save0(Storage.java:1038)
Oct 11 09:11:50 emonpi start.sh[972]: at org.eclipse.osgi.storage.Storage.save(Storage.java:1009)
Oct 11 09:11:50 emonpi start.sh[972]: at org.eclipse.osgi.internal.framework.StorageSaver$StorageSaverTask.run(StorageSaver.java:28)
Oct 11 09:11:50 emonpi start.sh[972]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Oct 11 09:11:50 emonpi start.sh[972]: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Oct 11 09:11:51 emonpi start.sh[972]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
Oct 11 09:11:51 emonpi start.sh[972]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
Oct 11 09:11:51 emonpi start.sh[972]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Oct 11 09:11:51 emonpi start.sh[972]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Oct 11 09:11:51 emonpi start.sh[972]: 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:]
Again this: Unresolved requirement: Import-Package: org.osgi.service.http