Openhabian: Clean Install - Why won't it auto-start on Linux? - karaf error

Hello,

I’ve used openHABian to install openHAB multiple times on my PC (running MX Linux/Debian 10 “Buster”) and never have any issues. However, when I have “purged” and reinstalled both openHAB as well as openHABian multiple times the last two days, it does install properly but I have to manually start openHAB every time the system boots. I know how to set it to auto-start myself either with a script or through systemd but there must be an error in the openHABian installation script. Can somebody please help me troubleshoot this?

Thank you,

Richard

EDIT: Upon trying to manually set systemctl to start openHAB (by running “sudo systemctl enable openhab2” and then “sudo systemctl start openhab2”) nothing would start. I looked at “sudo systemctl status openhab2” and found the following error:

● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/openhab2.service.d
           └─override.conf
   Active: activating (start-post) (Result: exit-code) since Fri 2020-06-26 08:43:07 CDT; 1min 50s ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
 Main PID: 14729 (code=exited, status=127); Control PID: 14730 (sleep)
    Tasks: 1 (limit: 4290)
   Memory: 1.8M
   CGroup: /system.slice/openhab2.service
           └─14730 /bin/sleep 120

Jun 26 08:43:07 HomeServer systemd[1]: Starting openHAB 2 - empowering the smart home...
Jun 26 08:43:07 HomeServer karaf[14729]: /usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
Jun 26 08:43:07 HomeServer karaf[14729]: /usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
Jun 26 08:43:07 HomeServer karaf[14729]: /usr/share/openhab2/runtime/bin/karaf: 95: [: Illegal number:
Jun 26 08:43:07 HomeServer karaf[14729]: /usr/share/openhab2/runtime/bin/karaf: 296: [: Illegal number:
Jun 26 08:43:07 HomeServer karaf[14729]: /usr/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
Jun 26 08:43:07 HomeServer systemd[1]: openhab2.service: Main process exited, code=exited, status=127/n/a

Something bigger is going on. This was with a completely fresh install, using openHABian.

This looks like a Java issue, could you post the response of:

java -version

and

uname -a

Thank you for your help @Benjy! I just purged zulu/java as well as openHAB and tried a clean install again and it started up, but then a few moments later shut down and showed this error:

  Process: 3547 ExecStartPre=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.rules" -exec /usr/bin/rename.ul .rules .x {} \; (code=exited, status=0/SUCCESS)
  Process: 3564 ExecStartPost=/bin/sleep 120 (code=exited, status=0/SUCCESS)
  Process: 4980 ExecStartPost=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.x" -exec /usr/bin/rename.ul .x .rules {} \; (code=exited, status=0/SUCCESS)
 Main PID: 3563 (java)
    Tasks: 179 (limit: 4290)
   Memory: 800.3M
   CGroup: /system.slice/openhab2.service
           └─3563 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.l

Jun 26 09:09:30 HomeServer karaf[3563]:         at java.lang.Thread.run(Thread.java:748)
Jun 26 09:10:29 HomeServer karaf[3563]: java.lang.IllegalStateException: Resource has no uri
Jun 26 09:10:29 HomeServer karaf[3563]:         at org.apache.karaf.features.internal.service.Deployer.getBundleInputStream(Deployer.java:1633)
Jun 26 09:10:29 HomeServer karaf[3563]:         at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:898)
Jun 26 09:10:29 HomeServer karaf[3563]:         at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
Jun 26 09:10:29 HomeServer karaf[3563]:         at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
Jun 26 09:10:29 HomeServer karaf[3563]:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
Jun 26 09:10:29 HomeServer karaf[3563]:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
Jun 26 09:10:29 HomeServer karaf[3563]:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
Jun 26 09:10:29 HomeServer karaf[3563]:         at java.lang.Thread.run(Thread.java:748)

Here are the results from java -version:
richard@HomeServer:~
$ java -version
openjdk version “1.8.0_252”
OpenJDK Runtime Environment (Zulu 8.46.0.19-CA-linux64) (build 1.8.0_252-b14)
OpenJDK 64-Bit Server VM (Zulu 8.46.0.19-CA-linux64) (build 25.252-b14, mixed mode)

and from uname -a:
$ uname -a
Linux HomeServer 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux

Okay, still odd then, but less likely a Java issue…

Can we see a little more of the error? It’ll be listed when you use the command:

sudo journalctl -u openhab2 -b

Thank you for your help! This one was very, very long, and some of the error code repeated over and over for about an hour and a half worth of time, so I cut that part out.

Edit: I tried to paste it all here, but it was too long to be accepted, so I have used a pastebin.

My error code is here.

Thank you again!

Sorry @richaardvark, I’m not entirely sure what’s going on. Would you suspect if there are any errors with your disk?

Another command that might help tell us what’s going on (blank out if there’s anything you don’t want us to see):

openhab-cli info 

Also, when you did a complete reinstall did you (this will remove any existing items etc):

sudo systemctl disable openhab2
sudo apt purge openhab2
sudo apt update
sudo apt install openhab2
sudo systemctl enable openhab2
sudo systemctl start openhab2

It might be worth doing it once more for good measure.

I had been using the openHABian script to install/reinstall openHAB but just tried it your way and there are no issues with the fresh install. :heavy_check_mark: Now I am going to restore my backed-up installation using the cli and the restore command. I suspect this is where the strange karaf errors start to occur :-/

Restoring now and I will write back with an update on how it goes. Thank you again so very much!
Richard

1 Like

Glad you’re getting there!

There could have been a corrupt config file on your side, these typically won’t get removed unless you do a purge. But we should keep an eye out on it just in case there’s anything to do openHABian side.

FYI @mstormi

Thank you again for your help! It’s been running a couple of hours now with no issues and no errors!
:blush:
I’m experiencing some strange behavior with a rule / a dimmer randomly changing to a specific value for reasons I am not able to figure out, but I’ll ask for help with that issue in a new thread in the “rules” section. Thank you again!

Richard

1 Like