Help deleted cache now Openhab doesn't startup

I had some strange leftovers from adding and removing bindings, adding and removing items through Paper UI that wouldn’t go away etc so looking through some threads I thought I would clear the temp and cache files

sudo rm --recursive /var/lib/openhab2/cache/*
sudo rm --recursive /var/lib/openhab2/tmp/*

Now openhab won’t start any more. I can’t access via :8080 (site can’t be reached)
I can’t open a karaf console ssh: "connect to host localhost port 8101: Connection refused"
And nothing is coming up in the events.log (clearly because OH isn’t starting)

I tried manually restarting the service, rebooting multiple times, and eventually reinstalled the latest stable version from openhabian-config (same version I was running)

What log do people need to see to help me here I’m lost

try to execute start_debug to see if something useful comes up in the console and/or in the openhab.log:

sudo systemctl stop openhab2
cd /usr/share/openhab2/
sudo ./start_debug.sh

Hi @Dim

Launching the openHAB runtime…
Listening for transport dt_socket at address: 5005
java.lang.RuntimeException: Exception instantiating lock class org.apache.karaf.main.lock.SimpleFileLock
Could not create file lock: Invalid karaf.lock.dir system property ‘/var/lib/openhab2/tmp’ : does not exist
at org.apache.karaf.main.Main.createLock(Main.java:443)
at org.apache.karaf.main.Main.doMonitor(Main.java:371)
at org.apache.karaf.main.Main.access$100(Main.java:72)
at org.apache.karaf.main.Main$2.run(Main.java:362)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.karaf.main.Main.createLock(Main.java:439)
… 3 more
Caused by: java.lang.RuntimeException: Could not create file lock: Invalid karaf.lock.dir system property ‘/var/lib/openhab2/tmp’ : does not exist
at org.apache.karaf.main.lock.SimpleFileLock.(SimpleFileLock.java:58)
… 8 more
Caused by: java.lang.IllegalArgumentException: Invalid karaf.lock.dir system property ‘/var/lib/openhab2/tmp’ : does not exist
at org.apache.karaf.main.lock.SimpleFileLock.validateDirectoryExists(SimpleFileLock.java:117)
at org.apache.karaf.main.lock.SimpleFileLock.getKarafLock(SimpleFileLock.java:93)
at org.apache.karaf.main.lock.SimpleFileLock.(SimpleFileLock.java:46)
… 8 more

sudo mkdir /var/lib/openhab2/tmp
sudo chown -R openhab:openhab /var/lib/openhab2/tmp

you should be ready after this

And then restart openhab?

yup

sudo systemctl restart openhab2

note: i think that in openHABian, the username that should be used is: openhabian
if the above doesn’t work, try:

sudo chown -R openhabian:openhab /var/lib/openhab2/tmp

check other folder permissions with:

ls -al /var/lib/openhab2/

by the way: this command does not remove the tmp directory…
it seems that you wiped it out with another command… :slight_smile:

Thanks, a whole lot of errors in the logs as it starts but I’ll change the ownership to openhabian (you are right all the other directories are openhabian) then try again, but a lot seem s related to the camera binding,

Before I’ve changed the ownership it has started though, but I’ll change ownership regardless.

-----snip----
2017-07-12 16:13:32.798 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.camera-2.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.camera [9]
Unresolved requirement: Import-Package: org.apache.commons.io; version="2.2.0"
at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:392)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)[4:org.apache.felix.fileinstall:3.5.6]
2017-07-12 16:13:34.059 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.camera-2.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.camera [9]
Unresolved requirement: Import-Package: org.eclipse.smarthome.config.core
Unresolved requirement: Import-Package: org.apache.commons.io; version=“2.2.0”
-> Export-Package: org.apache.commons.io; bundle-symbolic-name=“org.apache.commons.io”; bundle-version=“2.2.0”; version="2.2.0"
org.apache.commons.io [30]
No resolution report for the bundle.
at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:392)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)[4:org.apache.felix.fileinstall:3.5.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)[4:org.apache.felix.fileinstall:3.5.6]
2017-07-12 16:13:35.533 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.camera-2.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.camera [9]
Unresolved requirement: Import-Package: org.eclipse.smarthome.config.core
Unresolved requirement: Import-Package: org.apache.commons.io; version=“2.2.0”
-> Export-Package: org.apache.commons.io; bundle-symbolic-name=“org.apache.commons.io”; bundle-version=“2.2.0”; version="2.2.0"
org.apache.commons.io [30]
---- snip ----

I suspect I left off the /* doh!!

this is expected the first time you start OH2 after nuking cache and tmp (I get this all the time :stuck_out_tongue:)

https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/1/1f853db20f7139aab8e3ee996fbddacdfdab6488.jpg

no worries… restart OH2 and these messages will (most likely…) go away (after OH2 has repopulated the cache and tmp)

Oops after the second rename the group and owner look reversed

drwxrwxr-x+ 4 openhab openhabian 4096 Jul 12 16:13 cache
drwxrwxr-x+ 5 openhab openhabian 4096 Jul 12 16:15 config
drwxrwxr-x+ 2 openhab openhabian 12288 Jul 4 11:39 etc
drwxrwxr-x+ 2 openhab openhabian 4096 May 13 15:42 habmin
drwxrwxr-x+ 3 openhab openhabian 4096 Jul 4 11:34 jsondb
drwxrwxr-x+ 3 openhab openhabian 4096 Jul 10 13:37 kar
drwxrwxr-x+ 2 openhab openhabian 4096 Jul 9 16:08 log
drwxrwxr-x+ 2 openhab openhabian 4096 May 9 10:22 openhabcloud
drwxrwxr-x+ 5 openhab openhabian 4096 May 8 12:08 persistence
drwxrwxr-x+ 5 openhabian openhab 4096 Jul 12 16:13 tmp
-rw-rw-r-- 1 openhab openhabian 36 May 9 10:22 uuid
drwxrwxr-x+ 2 openhab openhabian 4096 Jul 12 15:36 var
drwxrwxr-x+ 3 openhab openhabian 4096 Jul 9 15:55 voicerss
drwxrwxr-x+ 2 openhab openhabian 4096 May 8 13:38 zwave

reversed the command, I can never remember which is group which is user
sudo chown -R openhab:openhabian /var/lib/openhab2/tmp

first is user, second is group
(my bad… the correct chown command is the one you used…)
sudo chown -R openhab:openhabian /var/lib/openhab2/tmp

is everything ok now?

Minor emergency there, the Razpberry module didn’t power up.
Ok after shutdown and physical power off.

Anyway -
[Service]
EnvironmentFile=/etc/default/openhab2
User=openhab
Group=openhab
WorkingDirectory=/usr/share/openhab2

… and then you withdrew your post :slight_smile:

Well I seem to be working so for now thank you very much.

sorry :slight_smile: I realized that you found the answer yourself (from looking at the other dirs within /var/lib/openhab2)