Backup/Restore scripts for Linux and MacOS

Installation successfully finished (I hope). Unfortunately there is no way to find out when it is really finished - or not.
The previous Openhabian image had the heartbeat which showed it is finished.
This one does not.
As a last message, I got the line “First time boot setup successfully finished”, but that line I do always get.
Anyway - it does not switch over to the “normal login screen afterwards” as described in the article.

And here we go with the restore results:
It seemed like the restore worked (mostly).
All my dashboards were back - most of the stuff was working - as far as I tested.
Anyway - the diagram was not working and I could not find a reason why.
So I switched back to the old ua-netinst based image (which I wanted to replace originally).

What I learned from this:
When it says “finished” or “successfull”, it does not realy mean that it is “ready”.
When it says “finished”, wait another hour or two.
It seems like OH2 goes wild for some time when starting it after restore.

I do have additional information on this topic and can give a total overview of all steps (reproducable):

  • Flashed openhabianpi-raspbian-201706161358-git7ff273e-crc00389b9f.img.xz to the SD card
  • placed the SD card into the PI3 and powered it on
  • called putty and connected to the PI3, monitoring the setup process
  • once finished (First time boot setup successfully finished), no redirect happened to the logon screen as promised
  • started a new session with PUTTY and started openhabian-config
  • installed “OPENHAB 2.2 unstable” (to have the restore scripts available)
  • chnaged the port numbers from 8080 and 8443 to something different
  • copied the backup.zip file to the configuration folder (via SAMBA)
  • stopped the openhab2.service
  • successfully restored the backup
  • restarted the PI

So this are the findings:

  • Classic UI is working
  • Habpanel is working
  • Paper UI is partly working (thowing error 500 - internal server error) when trying to change properties of ZWAVE things.
  • HABadmin is not working !!!

Additional details on HABadmin:

When starting HABadmin, throwing a %%KEY_NOT_FOUND%% on the top right in orange
Throwing “The Service is offline!” errors which I have to close.
Throwing all of the following errors (from habmin.lang.json):

  • ErrorGettingThings
  • ErrorGettingBindings
  • ErrorGettingPersistence or so (different lang file, I guess)

So my question:
What can I do to check/repair my installation?

Some more information:
HABadmin does not work after updating to 2.2.0 and before restoring either.

The old heartbeat is not provided any longer but the openHAB dashboard as well as the SSH progress log view are valid replacements. When the log says “successfully finished”, it successfully finished and the system is ready to be used.

That is correct. Looking at the documentation I’m not sure where we promise that. It is needed to start a new ssh session. That’s the way how the underlying commands are working, not sure if we can do anything about that. Maybe this aspect can be clarified in documentation.

Did you check the forum search function? Maybe @chris can help out here.

What sd card are you using? I had two sandisk cards and they were very slow. Two hours to install openhabian just like your case. If I remember correctly everything worked though. Somewhere along the way i tested one kingston card witch was much more faster. Aprox. 20min the whole setup. Last configuration was with usb stick and that was as fast as kingston.

One another thing. Do you have anything else connected to your RPi? Any usb stuff? I had a usb-rs485 converter with a fake FTDI chip that made my RPi to restart multiple times without any obivous reason. That made my sd card corrupt and not even burning new image did help. After that I hade same kind of symptoms of not beeing able to ssh into RPi.

openHABian installation speed depends on your internet downlink, not the SD card peak performance.

That might be true but all those installations with different sd cards and usb stick was done with same rasperry at same location with exactly same internet connection. Thats why I stated that sd card corruption or faulty usb devices might have something to do with it.

Hi,

one question on my side.
I’m currently running (an old) netinst of openhabian with OH 2.1.0 stable.
I want to install on a new SD card with openhabian 1.4 (an OH 2.2.0)
How can I create a backup of old installation?
How can I restore on new installed sd card?

Thanks a lot

helmar

Just follow

http://docs.openhab.org/installation/linux.html#backup-and-restore

Thanks, but I don’t have
$OPENHAB_RUNTIME/bin/backup

Regards

Helmar

Backup script: https://github.com/openhab/openhab-distro/blob/master/distributions/openhab/src/main/resources/bin/backup

Restore script: https://github.com/openhab/openhab-distro/blob/master/distributions/openhab/src/main/resources/bin/restore

I’d be tempted to update to openhab 2.2 first and then use the backup script that will appear in the runtime folder. Just to make sure hat the update scripts finds the correct paths.

I’ve had similar problems to most of you. I’ve moved from rpi to a server but I’m still using the openhabian script to update and maintain the system. The first update didn’t work great so I went through various other update and tried again. This time it was worse, habpanel wouldn’t even open up. I then used the option to change to stable from unstable, etc. which fixed most things. Still have weird shit going but I haven’t sorted out the logs to narrow down the issue.

I cannot find the backup zip…

Using '/etc/openhab2' as conf folder...
Using '/var/lib/openhab2' as userdata folder...
Making Temporary Directory
Copying configuration to temporary folder...
Removing unnecessary files...
Backup Directory is inside userdata, not including in this backup!
Zipping folder...
Removing temporary files...
Success! Backup made in Backup20171223

$OPENHAB_BACKUPS <-- it is empty

You should find the backup zip file in /var/lib/openhab2/backups.

Will there be any chance at any time that we can handle all maintenance tasks from inside the (Paper) UI?
This would include updates as well as Backup/Restore jobs?

1 Like

Hi,

Sry, I am new with Openhab and docker…
If I am correct, if I am using using docker I just need to copy the data stored in the mounted volumes?
So in this case /Opt/Openhab

Hi,

great script, woks like a charm on a standard openhabian installation. For me it would be nice to be able to exclude certain folders from the copy (before they are copied), as I’ve mounted a picture folder into the html directory to be able to access them, but they shouldn’t go into the backup to keep it as small as possible (and also it’s too big to be copied on the sd card for the backup). Would it be possible to add kind of an exclude file?

thx

Hello,

I’m having trouble upgrading to 2.2 (sudo runtime doesn’t work) so I thought I could backup my 2.1 and reinstall 2.2 from scratch. How do I do this backup/restore given the new backup/restore scripts in 2.2?

Many thanks!

Three thoughts on this:

  1. on which platform do you run openHAB 2.1?
  2. do you want to switch platform or just upgrade?
  3. did you configure someting outside the openHAB-context on the machine you’re running oh2 from?
  4. did you use PaperUI for configuration or file-based for all configuration?

ad 1)
if you run on Debian/Rapbian/Ubuntu and installed with apt, you should easily have an sudo apt-get update && sudo apt-get upgrade to upgrade to 2.2 - if you on openHABian, you could also just use sudo openhabian-config

ad 2)
when switching, you have to backup your configuration and restore it on the new one

ad 3)
if you didn’t configure somethin outside of openHAB2 (e.g. scripts or stuff on the OS of the machine, not within openHAB-configuration), you just have to backup the configuration and can easily restore virtually on every other 2.2 instance of openHAB

ad 4)
if you configured in PaperUI, be sure not only to backup Things/Items/Rules/… but also the PaperUI-database as described here in the thread.

finally, I’m not sure, what you mean with “new backup/restore scripts in 2.2”? the underlying structure of the files didn’t Change between 2.1 and 2.2 - what came with 2.2 is the ability to use the backup/restore script out-of-the-box…?
So, if you can’t upgrade to 2.2, you need to backup your files independently from the new 2.2 backup/restore functionality. You can then after upgrading use the new scripts.

finally: I think you should find the issue, which prevents you from upgrading in the first place? :wink:

Hi,

Is it possible to redirect /tmp to another location when the backup is being generated?

I’m running on a PI3 but /tmp is mounted as a very small tmpfs as I’m mounting other tmpfs file systems and memory is a premium, the backup generates files under /tmp before combining into the zip file but /tmp runs out of space before this can be completed.

if we could perhaps do something like the following that would help.

TMP_FS=/<another location>; $OPENHAB_HOME/runtime/bin/backup

or 

TMP_FS=/<another location>; openhab-cli backup <filename>

Regards

Kevin