[SOLVED] Openhab2 not starting after apt-get update = solved

I am experiencing almost the same problem:
Platform: Mini-PC Celeron amd-64 architecture, Ubuntu 18 and OH 2.3.0 Stable

After a cold restart the System binding would not deliver some CPU-information (load and temperature).

On advise from @H102 I reinstalled the binding but no progress. Then I cleaned the cache and tmp files using the commands openhab-cli stop, openhab-cli clean-cache, openhab-cli start.
Since I am running the PC headless, I did this over SSH.

So, OH started, everything OK but now I was stuck in Karaf. Logging out or closing the session also terminates OH .
I solved this by connecting a screen and keyboard locally to the PC but I am not able to start OH the usual way by systemctl. openhab-cli start does start OH and it is running with everything up as before.

Now OH is running fine since yesterday. I could disconnect the screen and kbd but when I log in via SSH and check the status, I get this info:

[10:33:23] openhab@ib9-oh2-2:~$ systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2018-11-27 10:33:34 CET; 4s ago
     Docs: https://www.openhab.org/docs/
  Process: 23792 ExecStart=/usr/share/openhab2/runtime/bin/karaf $OPENHAB_STARTMODE (code=exited, status=1/FAILURE)
 Main PID: 23792 (code=exited, status=1/FAILURE)

I am fairly experienced with OH, starting with 1.8 on a RPi but when it comes to Karaf, I am a noob.
What I have not done so far is reinstalling OH.

anything useful in openhab.log?

try the following:

sudo su //switch permanently to root (optional)
systemctl stop OH2  //stop the OH2 service
mv /var/log/openhab2/openhab.log /var/log/openhab2/openhab.log.old  //keep a copy of the log
openhab-cli clean-cache  //clean cache
systemctl start OH2   //start OH2
systemctl status OH2  //check status
tail -f /var/log/openhab2/openhab.log //monitor log file

Thanks for your support!
That did the trick but I had to do it from the console on the PC itself. The OH2 instance was running there and I could not stop it from the SSH session.

Now everything is normal!

1 Like

Next time you can do the following from SSH:

  1. ps -ef | grep java
  2. Look for the line that has openhab in the first column, unless OH is running as a different user in which case look for the line that has java -Dopenhab.home= in it.

openhab 18183 18058 2 Nov23 pts/0 02:22:19 /usr/lib/java-8/bin/java -Dopenhab.home=/openhab -Dopenhab.conf=/openhab/conf -Dopenhab.runtime=/openhab/runtime -Dopenhab.userdata=/openhab/userdata -Dopenhab.logdir=/openhab/userdata/logs -Dfelix.cm.dir=/openhab/userdata/config -Djava.library.path=/openhab/userdata/tmp/lib -Djetty.host= -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses= -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -XX:+UseG1GC -Xbootclasspath/a:/openhab/userdata/jython/jython.jar -Dpython.home=/openhab/userdata/jython -Dpython.path=/openhab/userdata/lib/python -Djava.endorsed.dirs=/usr/lib/java-8/jre/lib/endorsed:/usr/lib/java-8/lib/endorsed:/openhab/runtime/lib/endorsed -Djava.ext.dirs=/usr/lib/java-8/jre/lib/ext:/usr/lib/java-8/lib/ext:/openhab/runtime/lib/ext -Dkaraf.instances=/openhab/userdata/tmp/instances -Dkaraf.home=/openhab/runtime -Dkaraf.base=/openhab/userdata -Dkaraf.data=/openhab/userdata -Dkaraf.etc=/openhab/userdata/etc -Dkaraf.logs=/openhab/userdata/logs -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/openhab/userdata/tmp -Djava.util.logging.config.file=/openhab/userdata/etc/java.util.logging.properties -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true -classpath /openhab/runtime/lib/boot/activation-1.1.1.jar:/openhab/runtime/lib/boot/jaxb-api-2.3.0.jar:/openhab/runtime/lib/boot/jaxb-core-2.2.11.jar:/openhab/runtime/lib/boot/jaxb-impl-2.2.11.jar:/openhab/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.2.1.jar:/openhab/runtime/lib/boot/org.apache.karaf.jaas.boot-4.2.1.jar:/openhab/runtime/lib/boot/org.apache.karaf.main-4.2.1.jar:/openhab/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

  1. The second column will be the PID for the running OH. 18183 in the example above. You can nicely stop the program with the command sudo kill -HUP 18183 or immediately end the program without giving it a chance to shutdown with sudo kill -9 18183. Of course, replace the PID with your PID.
1 Like

Similar problem here - OpenHAB did not start after an apt update - those steps solved it form me. Currently waiting for the Paper UI to become available again.

EDIT: Yes everything back to normal :ok_hand:

I followed the installation guide from here:

This is how the services file looks:

Description=The openHAB 2 Home Automation Bus Solution

ExecStart=/opt/openhab2/start.sh server
ExecStop=/bin/kill -SIGINT $MAINPID


But shouldn’t it look like this?

You only need to follow those instructions if you’re installing openHAB 2 manually using a zip file. You should remove that file if you are using apt to manage the install, as this is done for you.

Otherwise, you are right in thinking that the service file should be updated. I’ve made a PR to change the documentation.