[SOLVED] All Things lost from openHab

Dear Everyone!

I have restarted today my openHab rig and it lost all my things… all things were set-up through PaperUI so it was not stored in files…

Are there any chance to get back these things or should I re-add them? Why I’m experiencing this issue? I had same problems with items, the solution was to use .item files, not PaperUI. Should I do the same with things?

Thanks

This may be a dumb response, but this happened to me once, and all i did was wait a bit, then restart again, and the things showed back up. I presume you’re posting this only after a while and restarting? Try clearing TMP / Cache as well?

1 Like

Thanks, I’ll try to restart it…

I don’t know why, but earlier one time when I cleared the cache, it almost did the same thing. Some of my bindings were gone (specifically if I can remember correctly) the ones which were installed through Eclipse IoT Market Binding.

However I will try clearing the cache, thanks.

I don’t know why they disappeared but it is curious and shouldn’t happen.

Luckily everything created through PaperUI gets stored in /var/lib/openhab2/jsondb/backup.

Look in there. The big number at the front of the file names are the timestamp so pick the set of files with the biggest numbers and copy them back to /var/lib/openhab2/jsondb, removing the big number from the name.

Do all this copying while OH is stopped.

If you are unlucky, whatever wiped out your original jsondb files also wiped out your automated backups.

8 Likes

Thanks @rlkoshak
I was lucky and I had backups there! If anyone has same issues, I have copied the Thing, ItemChannelLink backup files. Weird that for example homekit database wasn’t lost…

Thanks for your help!

This is normal behaviour and not a bug:

Note 2 : The jars are installed in the OSGi cache - which means that they are lost upon an openHAB distro upgrade (which cleans the cache) - you will have to manually re-install then from the marketplace. As the main use case for the start will be for testing pre-releases, I think this is acceptable.

Oh thanks, I thought that something like this is behind that case :slight_smile: However I’m curious that some bindings are work as it is a stable version and yet not included in the OH bindings…

Sometime over the last few days, my HabPanel stopped working (blank white screen) so I rebooted my OpenHab hardware and when it came back I’d lost all my Things. Using the above idea for restoring the backup file (1550469048694–org.eclipse.smarthome.core.thing.Thing.json) I am now up and running again. Just noting it here so someone is aware that this problem is still happening with v2.4.0

Paul

1 Like

These are really weird issues. I only had this issue once (when posted). Also I have to mention that for me it took a while to get a system which can be used everyday (had several issues with hardware, etc… and I just added and added the new Things to my smart home system and to openHab, so that time I had some really weird and mostly hard to solve issues…)

This just happened to me, maybe this helps someone to identify what exactly is causing this:

The openhab process ran out of java heap space (cause still to be identified, I suspect the HTTP binding I installed last).

I used sudo systemctl restart openhab2, which hung for about 5 minutes before I killed it. I checked the status off the process and it was running, but did a manual stop & start to be sure.

Now I noticed that all my things were missing.
I restarted openhab again, but still nothing.

My logs aren’t much help, as they are flooded with out of memory exceptions


Luckily I have backups!
Thanks @rlkoshak! I would have started from scratch without your comment. Saved me a lot of time and frustration.

How to watch and look through logging might help you filter out the noise should you need to.

One thing to realize is that OH periodically writes out to the JSONDB, including when OH closes down. If OH ran out of heap while it was in the middle of writing to the JSONDB, or if you kill the process while it is writing to the JSONDB, the DB will become corrupted.

I thought it would be something like that in my case.

Nice post on the logs.
Maybe you could add a part on less instead of tail and the build in search?
I always recommend less, you can scroll up and it has other useful navigation keyboard shortcuts.
Granted, for piping into grep it doesn’t matter and maybe even uses a bit less system resources.

My event logs don’t show any sign of anything weird/broken, except they stop a few days ago.
Around the same time the openhab log starts showing out of memory exceptions on every action openhab was taking (polling my devices, sending stuff to influxdb,…).

So yeah, useless to identify the cause of the out of memory exception. I’ll see if it returns, if so, I’ll remove the HTTP binding and wait again for a few days.

But things are working again as they should with the backups

You just need to pipe the grep into the less. It’s nearly impossible to write a comprehensive tutorial on this sort of thing. It’s turn into a huge text processing on Linux tutorial and I’m not up for that.

Well you’re right. It is already a great post none the less

I don’t understand why this thread marked as solved. Is there anyway to fix or improve it, sometimes I remove things but it’s not removed in thing json db files, and when i restart a bundle, my things lost all channnels. Any advice or trick to makesure things are synchronized???

You first need to unlink all Channels from the Items for that Thing, then remove the Thing.

What? Please describe step by step what you are doing and check your openhab.log when this occurs. And please provide more information about your setup:

1 Like

Because the original poster flagged a post as the solution to his posted problem.

You are describing a different problem from the OP. Please answer sihui’s question, and perhaps open a new thread.

Hi! I can confirm that this bug is still round and now if wipes out the backup as well. My Things was gone when I restarted after OH2 stopped responding. The backups for Things database are all 0 bytes.

Any news on a solutions/fix for this?

It could be discussed but I mean that this is wrongfully marked as solved, the fix for the symptom is solved (or was) but not the problem itself.

We are sitting with a not working alarm system, watering system, lightning system and automation system…not in ideal situation :stuck_out_tongue:

Best Regards
Emil

RPi user? SD card wearing out?

Thanks for a quick answer sihui!

I use RPi :slight_smile:

No I don’t think that the SD is the problem, everything else runs fine.