OH3, fresh OpenHABian 3.0.1 installation - autostart does not work

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Plus Rev 1.3

    • OS: OpenHABian (3.0.1?)

    • Java Runtime Environment:
      openjdk version “11.0.10” 2021-01-19 LTS
      OpenJDK Runtime Environment Zulu11.45+27-CA (build 11.0.10+9-LTS)
      OpenJDK Client VM Zulu11.45+27-CA (build 11.0.10+9-LTS, mixed mode)

    • openHAB version: 3.0.1

Dear community,

I have been using OH for some time and decided to start anew with OH3 because my OH2-configuration (items/things) was pretty messed up.

I have installed the latest OpenHABian several times, but the UI does not start on port 8080 of my local server. After many hours of poor troubleshooting attempts (selecting different OH3 branches, updating everything, disabling IPv6) I found out that I can get things working by starting OH manually in a SSH session:

sudo openhab-cli start

When I do that, I can use the UI, configure things/items and everything seems to work just fine. However, it seems I cannot keep the session alive 24/7.

I tried

sudo journalctl -u openhab.service -b

and got a bunch of text that contained the following errors:

Jan 31 07:50:38 openhabian karaf[31406]: !ENTRY org.eclipse.osgi 4 0 2021-01-31 07:50:38.568
Jan 31 07:50:38 openhabian karaf[31406]: !MESSAGE Error reading configuration: /var/lib/openhab/cache/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
Jan 31 07:50:38 openhabian karaf[31406]: !STACK 0
Jan 31 07:50:38 openhabian karaf[31406]: java.io.FileNotFoundException: /var/lib/openhab/cache/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
Jan 31 07:50:38 openhabian karaf[31406]:         at java.base/java.io.RandomAccessFile.open0(Native Method)
Jan 31 07:50:38 openhabian karaf[31406]:         at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:345)
Jan 31 07:50:38 openhabian karaf[31406]:         at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:259)
Jan 31 07:50:38 openhabian karaf[31406]:         at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:214)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.internal.location.Locker_JavaNio.lock(Locker_JavaNio.java:36)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.storagemanager.StorageManager.lock(StorageManager.java:388)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:701)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:1776)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:1793)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.storage.Storage.<init>(Storage.java:132)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:85)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:68)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.apache.karaf.main.Main.launch(Main.java:256)
Jan 31 07:50:38 openhabian karaf[31406]:         at org.apache.karaf.main.Main.main(Main.java:178)
**Jan 31 07:50:38 openhabian systemd[1]: openhab.service: Main process exited, code=exited, status=255/EXCEPTION**
**    Jan 31 07:50:38 openhabian systemd[1]: openhab.service: Failed with result 'exit-code'**.

Similarly with sudo systemctl status openhab.service:

● openhab.service - openHAB - empowering the smart home
   Loaded: loaded (/lib/systemd/system/openhab.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2021-01-31 09:06:37 CET; 3s ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 17358 ExecStart=/usr/share/openhab/runtime/bin/karaf ${OPENHAB_STARTMODE} (code=exited, status=255/EXCEPTION)
 Main PID: 17358 (code=exited, status=255/EXCEPTION)

I found several forum topics concerning OH2 and some similar errors, but I could not figure out if my problem is the same and how I can fix it.

Does anybody know how I can fix this? I really appreciate your help!

Thanks
Tobi

Ouch you must not manually start OH like you did.
You possibly have messed up permissions now so eventually need to reinstall.

If you properly install openHABian from the image openHAB will be running.
Use systemctl status/stop/start openhab.service to control.

In case you use openhabian-config you may try to run menu entry 14 fix-permissions after stopping the running service/karaf console.
It may fix it. The start the service as suggest by mstormi.
What then is the output of

sudo systemctl status openhab

It might be faster, easier and you will be on the safe side by starting from scratch.

1 Like

Thank you both! It worked!

Although I do not fully understand what went wrong here, I am aware that this was obviously a “noob problem”. In my defense: I strictly followed the instructions at https://www.openhab.org/docs/installation/openhabian.html#openhabian-configuration-tool. These instructions give the impression that after installation (=etching the image to an SD card an inserting it into the Pi, then waiting 15-45 minutes) the openHAB service starts without any further action on part of the user. That just didn’t work for me.

I am glad that it works now, but there remains an uneasy feeling that I don’t understand what happened. I would be really grateful if you could venture an explanation.

Thanks again for helping out a novice who is eager to learn and understand!

Tobi

at some point in time you ran the karaf console as user root which created files and/or directories with the user’s root permission. The process later continues to run with an other users privileges which then is not allowed to read and/write. By running fix permissions the ownership of the files and directories is corrected and the user openhab which is used when you start OH via systemctl can read and write files/directories.

1 Like