[SOLVED] OH2 (Karaf) not starting after clean-cache

Hi all,
I am using openhabian 2.4 stable on PI3.

Today I ran the command as per this thread https://community.openhab.org/t/clear-the-cache/36424:
openhab-cli clean-cache
and since then OH won’t start properly.

Actually it starts but Karaf do not start with the following error message:

KARAF_BASE is not valid: /usr/share/openhab2/userdata

Infact in openhabian KARAF_BASE should point to /srv/openhab2-userdata or /var/lib/openhab2

So I imagine that the command clean-cache messed up the KARAF directories settings.

I already tried to reboot, delete manually the cache and tmp.
I even tried to set manually the KARAF_BASE variable, but it didin’t change:

[17:26:50] openhabian@openHABianPiVarazze:/srv$ export KARAF_BASE=/var/lib/openhab2
[17:27:15] openhabian@openHABianPiVarazze:/srv$ sudo /usr/share/openhab2/runtime/bin/karaf start
mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
KARAF_BASE is not valid: /usr/share/openhab2/userdata

It means that the KARAF_BASE is set somewhere else at a higher level.

Can anyone help me to reset them properly?

Added more info:

[17:35:09] openhabian@openHABianPiVarazze:/srv$ openhab-cli info

Version:     2.4.0 (Build)

User:        openhab (Active Process 6383)
User Groups: openhab tty dialout audio bluetooth gpio

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | openhab:openhab
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

URLs:        http://192.168.88.5:8080
             https://192.168.88.5:8443

More info:

[17:45:52] openhabian@openHABianPiVarazze:/srv$ sudo systemctl status openhab2.service -l
[sudo] password for openhabian:
Sorry, try again.
[sudo] password for openhabian:
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Wed 2019-08-28 15:50:13 CEST; 1h 57min ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 6231 ExecStop=/usr/share/openhab2/runtime/bin/karaf stop (code=exited, status=0/SUCCESS)
 Main PID: 6383 (java)
   CGroup: /system.slice/openhab2.service
           └─6383 /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 -Dfelix.cm.dir=/var/lib/openhab2/config -Djava.library.path=/var/lib/openhab2/tmp/lib -Djetty.host=0.0.0.0 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -Xms250m -Xmx350m -Djava.endorsed.dirs=/usr/lib/jvm/zulu-embedded-8-armhf/jre/lib/endorsed:/usr/lib/jvm/zulu-embedded-8-armhf/lib/endorsed:/usr/share/openhab2/runtime/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/zulu-embedded-8-armhf/jre/lib/ext:/usr/lib/jvm/zulu-embedded-8-armhf/lib/ext:/usr/share/openhab2/runtime/lib/ext -Dkaraf.instances=/var/lib/openhab2/tmp/instances -Dkaraf.home=/usr/share/openhab2/runtime -Dkaraf.base=/var/lib/openhab2 -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/var/lib/openhab2/etc -Dkaraf.logs=/var/log/openhab2 -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/lib/boot/activation-1.1.1.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-api-2.3.0.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-core-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-impl-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.main-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

Aug 28 15:50:13 openHABianPiVarazze systemd[1]: Started openHAB 2 - empowering the smart home.

I eventually managed to get the system working again without reinstalling it.
I don’t know exactly what solved the issue, but after running the following comands from inside openhabian config menu it worked again:
“40 OpenHab related” -> “Default order”
“60 Manual/Fresh Setup” -> “65 System Tweaks”

Then I rebooted and waited 15-20 minutes.
Then I rebooted again and it worked as usual.

Maybe @ThomDietrich can give an explanation of what could have happened and why the above commands solved the issue?

1 Like