How to backup/restore managed items/links to new install

After an apt-get upgrade all my extensions are uninstalled. They are not just marked as so in PaperUI, as I’ve noticed mentioned on other threads.
A bundle:list confirms they are gone.

I can re-install all the extensions and everything eventually comes back to life, but it happens again after another upgrade.

I have created all my Items and Links using PaperUI/HABmin, so no text files.

What I want to do is a complete purge of openHAB and re-install.
Can I just save files in /var/lib/openhab/mapdb to the new install? or is there a better way.

in /etc/openhab2/services/addons.cfg you should list the extentions you’re using: e.g:

# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave")
binding = zwave,weather,hue,network,astro,systeminfo,ntp

# A comma-separated list of UIs to install (e.g. "basic,paper")
ui = basic,paper,habmin

# A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
persistence = mysql,mapdb

# A comma-separated list of actions to install (e.g. "mail,pushover")
action = 

# A comma-separated list of transformation services to install (e.g. "map,jsonpath")
transformation = map

This way they’ll install themselves back onto the system when you’ve upgraded.

You’ll need to wait a while while these are upgraded in turn after each upgrade and then your system will resume to function as normal. You can look at the karaf console (ssh -p 8101 openhab@localhost) and log:tail to see which extension is being installed. I find that it does it in the order I specify in the above file! (i.e. it finishes on the map transformations)

Regarding backup, that /var/lib/openhab/ folder will contain bits and pieces per module, the mapdb folder will contain the things/items, but you may have folders which are important to particular bindings (/webapps for older bindings, /zwave for the zwave binding, /persistence for in-house persistence… etc). You’ll also want to backup /etc/openhab2 for the configurations of those bindings!

1 Like

Thanks Ben for the full reply.
I didn’t mention it but I have other problems as well - errors and exceptions at startup. A week or so ago I switched from online to offline and it looks like it didn’t go cleanly - hence the decision to re-install.

As for addons.cfg - I currently do not have anything in there, and before “the troubles” everything started up OK after an upgrade.

I do know about the other folders, but at the moment I only have a small setup, so I’m able to re-instate them. I’ll do a full backup anyway.

The thing that would be a pain to recreate would be the items and links for my Z-Wave setup. I can get a list from the REST interface and with some editing pipe it back but…

Maybe I’ll give it a try with the mapdb folder on a another SD card.

Then you’ll definitely want the mapdb and zwave folders. Add the information to addons.cfg anyway, since I think i’m right in saying it’s recommended to so?

Yes I’ll give it a try tomorrow.
Up to now I have been avoiding all config files I don’t need.
I’ve been following the discussion on text file vs database configuration and hopefully something good will come out of it. Just wish I had the skills to contribute.

@Benjy, would you be willing to write this up as a new topic in the Tutorials and Examples section? This has been asked numerous times and it would be great to have an easy to find posting to point people to until such time as W can copy it into the docs.

Sure thing! I’ll try to get on that tomorrow!

@rlkoshak I made one here but unknowingly this was also covered by @Dim four hours ago here.