Clear the Cache

You can search the forum. But whenever there is an error that seems to point to a corruption (e.g. 500 errors, screen saying to wait while UIs are installed never goes away, add-ons refuse to be installed or uninstalled) that corruption would be in the cache and tmp. This is why that is one of the first recommendations for people to try. Their system is already broken, clearing the cache will not make it any worse.

There is even a command line option you can provide to cause karaf to do this on its own every time it starts for you, so it isn’t really that big of a deal. It will lead to longer startup times but shouldn’t cause any further problems. I don’t recommend doing that unless you find that you need to clear the cache every time you restart OH.

Absolutely and positively not. Only Things and Items and such created using PaperUI go in the JSONDB.

The proper solution there is to remove one of them using console commands. See http://docs.openhab.org/administration/index.html

It depends on how you have your system set up. If you have used PaperUI for ANYTHING then you need to tread carefully.

Hey @rlkoshak,

thanks for this input, it helped me getting my avmfritz binding working again!

Question:
After deleting those folder contents, I did notice the following things

  • All my Bindings where gone!
  • All my Actions where gone!
  • All my Persistence items where gone!
  • Misc, Transformations and User Interfaces where still there!

It was not really a big deal but if I had known that something would be missing,
I would have created a short list with the bindings I had installed :slight_smile:.

Do you know if this behaviour is correct in OH 2.2.0, and why?
[Openhabian 1.4 on Raspberry 3]

Best regards,
Marcel

When you clear the cache your add-ons should be reinstalled. If that didn’t happen then that is incorrect behavior but I can’t guess as to why that didn’t happen.

The steps I outline above are part of the standard steps that happen during all upgrades.

1 Like

Hi @rlkoshak, thanks for the tuts, a non cache/tmp question, what is core file? This file located in /userdata root with about 274,552KB size(2.3snapshot #1225), can I also need to delete this core file when upgrading?
image

add1: I’ve deleted this core file and it seems nothing happen, system still running well, so I am confused, what exactly does this core file do and why so large? Thanks

add2: may I also ask you where to find the “changelog” when a snapshot image get pushed? I don’t see any changelog thing on https://openhab.ci.cloudbees.com/ or the docker github page. I can see the #1225 number is growing but how to see what exactly change comparing to prviously number? Thanks

A core file occurs when a program crashes hard work a segfault. I’m surprised to see one here. It is late because it contains everything in ram at the time of the segfault. Had OH ever just inexplicably stopped?

There is no changed log for the snapshot. The snapshot is intended for the devs and for those who are good at debugging problems and consist of the result of the nightly builds. There is no release process beyond the nightly build succeeding. You can watch the prs on the various GitHub repos. Once a PR is merged it becomes party of the nightly build.

Nope, this is a brand new docker pull today, I never happen to see this core file ever, I docker pull the same image on rpi3,2,1 and x86 vm machine, never get that core file thing, and I think OH never accidently stop.
although there is one thing maybe related to this core file, is because I use a brand new sbc called NanoPi Duo to setup this openhab server(screenshot from that server), everything running so good but memory usage is go very high(435 of 512ram + 64 of 621zram, also running 10 containers in background, grafana,influx,mqtt,etc…), not sure if this is causing the core file thing created due to low mem…
so far so good still…

Oh, wow, thank you.
After ugrading to 2.3 on Ubuntu 16.04 LTS , the openhab mqqt binding stopped functioning.
This was critical for my mysensors network.
Clearing the cache refreshed the vital components that fixed the issues
Openhab2 began to react to mqqt inputs and publishing the openhab2 event bus to mqqt broker.

@rlkoshak, reading another (misguided) post, I did not heed your advice here and deleted the folders /var/lib/openhab2/cache and /var/lib/openhab2/tmp, not just their contents. Now my bundles aren’t starting among other issues. Is there any way to fix this without starting over??

just recreate the folders and give them the correct ownership:

(sudo su)
mkdir /var/lib/openahab2/cache
mkdir /var/lib/openahab2/tmp
chown openhab:openhab /var/lib/openahab2/cache
chown openhab:openhab /var/lib/openahab2/tmp
1 Like

Thanks. Actually, it did that automatically with 2.3. However the missing link was that I needed to reinstall the serial transport in the console. Hope this helps someone.

I followed this thread and deleted files in cache and tmp because things were just going bonkers. Now Paper UI is gone, all I have are homebuilder, logviewer, and help. I didn’t have a backup, but I do have the items files, which is where I spent most of my time. What is my best course of action now?

Edit addons.cfg to install PaperUI and your other needed bindings.

Could you elaborate a little more? Stating “edit” means nothing.

The file is fully documented in the comments of the file itself. Open the file addons.cfg in the services directory of your conf folder, add the bindings you use, saved the file.

Search the forum and you will find dozens of examples and threads.

Thanks for the help, I was able to get things going again…

It may sound cynical, but your first step - before going any further - should be to setup a backup solution including a test restore run. OpenHabian comes with the option to install Amanda, a network backup solution. Documentation can be found here.
After that you may start experimenting, you now have a proper restore point and can freely proceed without fear :wink:

Hi @rlkoshak, this helpful thread comes up quite a bit in the searches so I thought I’d offer some suggestions to add to your post:

  1. It should be fine now to remove the /tmp/ and /cache/ directories completely. The distribution recreates this if they are missing. In fact, using the typical command sudo rm -rf /var/lib/openhab2/tmp/* would not remove the hidden files inside so removing the directory would be better in this case.

  2. Those using the deb or rpm packages (including openHABian) can use the command openhab-cli clean-cache, this will check if openHAB is running before continuing.

I’ll update the OP.

  1. This runs even for manual installs? Cool. At the time of the writing of the OP deleting the folders would cause havoc since they were not recreated.

  2. I’ll definitely add that. At the time of the OP writing there was no openhab-cli.

1 Like

Yep, for any OS too. :slight_smile:

1 Like

Be very careful with this instructions.

I am on windows, installed OpenHAB 2.3 with Chocolatey.
Then I used PaperUI to install necessary bindings and actions
I used text files to configure bindings and write my items and rules.

Then on start of OpenHAB I got an error regarding HTTP binding with a key that I couldn’t find in any file - but which I finally found in PaperUI to be some (already deleted) comments in my files, which I couldn’t delete in PaperUI

So I found this thread, followed the instructions (deleted cache and tmp directory), started OpenHAB and the log file didn’t stop anymore for the next 15 minutes…
OpenHAB installed many AddOns I had never installed, of course they were spitting out every possible error message. My conf/services directory previously had 6 files, now it’s 90 (automatically added) files. My conf/transform directory previously had 5 files, now it’s 35 files (mios transform files were added automatically), …

This will take some time to clean up the mess :frowning: