Clear the Cache

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:

This is a known bug. An issue is open and I think it might already be fixed in the milestones and snapshots.

@StefanMUC track it here:

It has nothing to do with the instruction in this thread (which work fine)

Yeah, the Instructions here are not wrong - that’s not what I wanted to tell - but you have to be careful to follow them with current OpenHAB release, because they have side effects.
But it did cost me about two hours to fix my OpenHAB installation after I followed the instructions - i finally had to delete OpenHAB directory and start from scratch and hopefully found all bindings again that I need. Just found out today that I was missing one binding.

Now I won’t install bindings (and more) with PaperUI anymore but use addons.cfg, thats more convenient and so much easier to backup. Should have done that before and ignored PaperUI.

By the way: This is not what caused you the problems (the use of PaperUI)

The root-cause of your issues is the following: the offline addons .kar file (which comes with Choco) has a problem and when it is copied to the userdata/addons subfolder, OH2 starts to install every single available Add-on (actions, bindings, transformations, persistence, etc, etc). Of course, since none of these Add-ons are configured… logs explode

This has been already fixed in the latest Milestone Release (2.4.0.M6)

Also, as a second step, the Choco installation method is beening updated not to include the Offline Addons package anymore. Users can now use PaperUI to install the addons that they really want.

1 Like

Exactly, I understand the problem (but I didn’t have this one week ago as I installed OpenHAB with Choco). But that’s what made restoring backup from conf directory not so easy as Addons were missing after fresh install. So it’s better to use a config file which I can compare to earlier versions than to use a webinterface that looses it’s changes after a fresh install.

It is expected not to have any addons installed when you restore only conf subdirs on a fresh OH2 system.

The addons (*.jar files) are stored in userdata/cache & userdata/tmp subdirs and you don’t really need them, since OH2 will redeploy them on a new system. Actually, you shouldn’t back those stuff up (since they are the older versions).

The bug that you had on your previous system (ALL addons were installed) is not a normal condition.
The fresh install was empty of addons, something which is normal. You could have used PaperUI to install the new addons and you would have been fine.

Of course, the use of addons.cfg makes your life a bit easier (and the situation more “clear” I would say) in these upgrade scenarios. This is what I do also.

An alternative method to configuring addons.cfg and restoring it (to auto-deploy only the selected addons) is to backup stuff in userdata/config. Anyway, a full backup includes (on top of conf) everything in userdata (except cache & tmp).

Thanks, this was the information I was missing. There are quite many files there ^^

1 Like

I’m using openHAB over RPI and mqtt my items is not responding after clearing cache and Tmp files
What can I do

1 Like

It might save some heart attacks if, along with the instructions for how to clear a cache, it is pointed out that one may need to restore file ownership with:

sudo openhab-cli reset-ownership

I had cleared my cache, and then karaf / openhab wouldn’t restart, with logs stating “could not launch framework” and couldn’t initialize storage, etc.

After running:

sudo openhab-cli reset-ownership

Everything was working again.
Anyway, Putting this here for someone else who runs into the same surprise.


Thanks! Crisis averted :slight_smile:

good catch Ben
@rlkoshak as op, is this something that should be included in 1st post in case of issues.

@bdm what is your platform and version ect. to identify where this issue would need attention because not hear of such

clearing the cache shouldn’t have anything to do with file permissions. You are deleting files and folders created by openHAB so after you clear the cache those files and folders are recreated by openHAB so the ownership will be openhab:openhab.

Either the openhab-cli script was changed and an issue needs to be filed, or bdm did some other stuff before or after running the cache clearing that caused the problem. In either case, it was the OP that was the source of the problem. I’m hesitant to add warnings to the OP that are not directly related to the OP.

1 Like