Clear the Cache

Tags: #<Tag:0x00007f1829114db8> #<Tag:0x00007f1829114c00>

(Rich Koshak) #1

Often when one encounters a problem with OH, particularly after an update, OH will refuse to run or certain parts of OH stop working. Some reported errors include:

  • 500 or 404 errors when accessing the UIs
  • lots of exceptions from Jetty or other core components in openhab.log
  • OH refuses to start at all

The first step in debugging the problem is to clear the tmp and cache.

Installed OH

If you are running an installed OH (openHABian, installed using apt or yum):

  1. openhab-cli stop

  2. openhab-cli clean-cache

  3. openhab-cli start

  4. Watch openhablog for errors, test if the problems persist. If so, serach the forum and post a new thread if you do not find a solution. To get more information in openhab.log, use openhab-cli start --debug to enable debug logging.

Manual OH Install / Docker

  1. Stop OH if it is running.

  2. Delete the /var/lib/openhab2/cache and /var/lib/openhab2/tmp folders. For manual installations these folders are in your OH home folder under userdata.

  3. Start OH.

  4. Watch openhab.log for errors, test if the problems persist. If so, search the forum and post a new thread if you do not find a solution. Log into the karaf console and enable debug logging to get more information about the errors.

EDIT: Reworked to use openhab-cli for installed OH and to delete the cache and tmp folders, not just their contents.

Installing Javascript Transformation leads to "Internal Server Error"
Jetty update, Karaf 4.1.3 upgrade and full LSP support
Insteonplm Binding - Ignored attempt to add duplicate port:
Openhab2 not starting after reinstall
Netatmo error HANDLER_CONFIGURATION_PENDING after update to OH 2.2 (from 2.1)
Astro Binding gets not initialized
New binding: Isy
I sort of want to start over
Mqtt binding stops unexpectedly
Inbox broke - Error 500 after installing KODI binding
Impossible to delete chromecast thing
Switching and dimming DMX light with a KNX wall switch
After reinstall sonos does not work
BasicUI gives Server Error 500 after a few hours
Yeelight binding issue (2.4.0, 2.3.0), few channels than before and can't find items
Updating Openhab 2.3.0 to 2.4.0-SNAPSHOT issue on Mac OS
Octoprint, MQTT, and JSONPATH
[SOLVED] Javascript Transformation Error with MQTT
Does open hab require raspberry pie or any other device to operate?
Eclipse Issue after upgrade to OH 2.3 - 8080 not reachable any longer
Cron based rules still executing at old time in spite of changes
HABmin, zwave things, items, and dashboards
REST API error
[SOLVED] Ghost item
After upgrade 2.2.0-1 (Stable) to 2.3.0-1 (Stable) & iOS (11.4.1) App: ServerRuntime$Responder - I/O error when closing the app
Astro binding throwing exceptions for moon since 00:00 this morning
OpenHab 2.3 not working with Wemo
[SOLVED] Still some log presents
RRD4J item store problem
KNX Binding needs daily reinstall
Emerson Sensi Thermostat
Problem with knx binding after update
Failed installing 'openhab-misc-myopenhab'
Problems with Z-wave after update to 2.3.0
Current travel time on favorit route
OH2 Z-Wave refactoring and testing... and SECURITY
[SOLVED] OpenHab MQTT binding install - takes forever and does not install
Dashboard problem (LAN access) openhab 2.3.0 on CentOS
Error 409 means uninstall?
Zwave and OH 2.3
WeatherUnderground binding fails to install
Can't update items via GUI?
Nibe uplink binding
REST API install problems
After openhabe 2.3 update, homematic binding don't update item status
UI does not load after restore 2.2 config on 2.3 release
Released: Openhab2 Amazon Echo Control Binding (controlling alexa from openhab2)
After 2.3 Update most things gone
2.3.0 - wifiled/2.3.0 does not contain a manifest
Cannot get service reference for transformation service of type JSONPATH after update to openhab 2.3
After upgrade to OH2.3 zwave binding not working after upgrading
Rough start (lots of errors) on OpenHab 2.3 Release
Problems after upgrade to OH 2.3
Update to openhab 2.3 kinda broke everything
Yamaha Binding Problems
NTP and Yahoo Weather Bindings not working
[SOLVED] Lost most of my Things, can't add them back
Using non-deprecated functions with Pushover action
Rules stop executing after a while
mySQL: Connection is not valid!
[SOLVED] MQTT for SONOFF/TASMOTA this is difficult
Mi(Xiaomi) Smart home bindings?
MapDB creates errors
Hue Mystery bridge - endless loop
Astro binding throws XML parsing error at initialization
MODBUS binding works intermittently with WAGO 750-881 PLC
Endless errors after openhabian update today
OH 2.3 Snap 1224 = clear cache + tmp
Karaf console throws error when logging in and exits
[Solved] Artifact Issue on the Raspberry
Paper UI replies Error 500 - a lot
[Solved] Can no longer access any UI after upgrade
OH2.2 MQTT binding can't be used after changing password for Mosquitto broker
Problems with paperUI AND habmin
OpenHab MQTT Item Extra Publish
How to get my first rule running
Reset hue binding
Binding gets stopped w/o any obvious reason
Mqttitude failing with "no lat/lon configured for home" (but there is)
Upgrade has killed my install - desperate times
OH2.2 Crashing randomly
Mi(Xiaomi) Smart home bindings?
Weather bindings
Regular KNX Link Loss since upgrade to 2.2
Paper UI - Error 500: Internal Server Error
A URL must be configured for calendar ''
Menu extensions no visible in paper ui
Cannot select any items in HABPanel
Error resolving artifact org.jline:jline:jar:3.5.1-sp1?
Sitemaps are no longer working after upgrading from 2.0 to 2.1.0-1
How to setup things files?
New install of OH2 and Ubuntu - cannot get a sitemap displayed
MQTT Binding Config - Where did I do that?
HTTP ERROR 404 (PaperUI, ClassicUI)
OpenHabian Raspi3 Bootloop
HTTP ERROR 404 (PaperUI, ClassicUI)
HTTP ERROR 404 (PaperUI, ClassicUI)
GPSTracker with OwnTracks and GPSLogger integration
Help installing binding - Could not resolve module
[SOLVED] HarmonyHub: NPE when starting activity
[SOLVED] Update to 2.3.0 failed
ZWave Wrong identification of manufacturer / model of Door / Window sensor
[SOLVED] MQTT for SONOFF/TASMOTA this is difficult
Screwed my OpenHab 2.2.0
Updating from 2.1,0-1
MQTT binding in waiting status
(Philipp) #2

Hi Rich,

thanks for the Thread.
Could you please help a noob like me with the commands ?

  1. Stop OH
sudo systemctl stop openhab2.service
  1. Delete the contents of /var/lib/openhab2/cache and /var/lib/openhab2/tmp. DO NOT DELETE THE FOLDERS THEMSELVES, JUST THE CONTENTS.
  1. Start OH.
cd /etc/init.d
sudo ./openhab2 start

dont want to break OH - Thanks

Karaf.Feature issues after update to 2.3
(pmc) #3

Stop OH / Start OH

Depends on the installation:

for example:
start, restart, stop and retrieve status
sudo systemctl start openhab2.service
sudo systemctl restart openhab2.service
sudo systemctl stop openhab2.service
sudo systemctl status openhab2.service

for example
FTP Client: Log in with FTP Client, delete all subfolders and files from folders above
Samba Mount: Mount Fodlers via Samba (if enabled), delete all subfolders and files from folders above

Export Binding to Raspi
(Thomas Binder) #4

hi Philipp,

openHABian HowTo
if running OH2 on a Debian like Linux (openHABian being one of those), it’s done like this:

sudo /etc/init.d/openhab2 stop
sudo rm -rf /var/lib/openhab2/cache/*
sudo rm -rf /var/lib/openhab2/tmp/*
sudo /etc/init.d/openhab2 start


  • If you installed OH2 manually (e.g. not with openHABian), the cache and tmp folders are located in another place, but you will know (as then you’re supposedly an expert).
  • if running OH2 in another OS as Debian, the OH2 Service ist stopped and started differently and the folders for cache and tmp are in a different place (again: then you’re supposedly an expert and know how and where),

Released: Openhab2 Amazon Echo Control Binding (controlling alexa from openhab2)
New openHab2 EnOcean binding
[velux] New OpenHAB2 binding - feedback welcome!
Ubiquiti Unifi Binding Feature Discussion
(Philipp) #5

Thank you!

(walwe) #6

Is there any information available that explains / documents the bug(s) that require a manual deletion of tmp & cache?

The implications of randomly requiring a manual deletion of tmp & cache are dramatic when trying to automatically update OH as it will sometimes brick it. Deleting the cache & tmp on every update also seems to be troublesome as this requires re-downloading dependencies (bundles) that are stored in cache, which from my experience is also not very reliable and will lead (on first start after deletion) to a fast number of NotFound exceptions, thus forcing a second restart.

(Kim Skatun) #7

Is cache the same that is stored in the xml/java database? I had some issues that i had 2 entries for mqtt binding etc… when I checked in the karaf console. Is there a way to clear out all info in that cache/Db so it reloads it from the .cfg .items .rules .things file?

(Rich Koshak) #8

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

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

(Marcel) #9

Hey @rlkoshak,

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

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,

(Rich Koshak) #10

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.

(shane kevin) #11

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?

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 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

(Rich Koshak) #12

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.

(shane kevin) #13

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…

OpenHab not connecting to MQTT
(Ian Ward) #15

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.

(Eric Einstein) #16

@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??

(Angelos) #17

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

(Eric Einstein) #18

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.

(James) #20

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?

(Rich Koshak) #21

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

(James) #22

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