Restore backup without .zip-file !?

Hi Guys,
i’ve made my backup this way:

sudo systemctl stop openhab2
TIMESTAMP=`date +%Y%m%d_%H%M%S`;
sudo mkdir /backup
sudo mkdir /backup/openhab2-backup-$TIMESTAMP
sudo cp -arv /etc/openhab2 /backup/openhab2-backup-$TIMESTAMP/conf
sudo cp -arv /var/lib/openhab2 /backup/openhab2-backup-$TIMESTAMP/userdata

my sd-card with openhabian 2.3 is broken and i installed a fresh openhabian image with 2.4.0.1 and want to restore my backup files, but i dont have a zip file !?
can i just make a zip of the 2 folders (conf/userdata) and restore the files with

sudo $OPENHAB_RUNTIME/bin/restore $OPENHAB_BACKUPS/myBackup.zip

thank you

EDIT:

i tried it, but i get this:

sudo $OPENHAB_RUNTIME/bin/restore /backup/openhab2-backup-20181014_171357.zip
[sudo] Passwort für openhabian: 
                                          
##########################################
       openHAB 2.x.x restore script       
##########################################
                                          
Using '/etc/openhab2' as conf folder...
Using '/var/lib/openhab2' as userdata folder...
Making Temporary Directory
Extracting zip file to temporary folder.
Backup was not created by openHAB scripts, please resort to a manual restore...

whats the best way to restore now ? thank you

You didn’t create the backup using the built in backup scripts so the built in restore script is almost certainly not going to work.

You need to do just what the error message tells you and do it manually. Unzip the files manually and copy them where they need to go.

hey rich, thanks for reply.
i already did that, but somehow the log isnt showing anything.
seems like OH isnt running ?

how i copied the files:

[18:08:40] openhabian@openhab:~$ sudo cp -a conf/. /etc/openhab2
[18:10:02] openhabian@openhab:~$ sudo cp -a userdata/. /var/lib/openhab2

i checked

tail -f /var/log/openhab2/openhab.log -f /var/log/openhab2/events.log

and see this:

2019-11-22 19:30:08.561 [SCHWERWIEGEND] [org.apache.karaf.main.Main] - Could not launch framework
java.lang.RuntimeException: Could not resolve mvn:org.eclipse.platform/org.eclipse.osgi/3.11.3
at org.apache.karaf.main.util.SimpleMavenResolver.resolve(SimpleMavenResolver.java:59)
at org.apache.karaf.main.Main.createClassLoader(Main.java:467)
at org.apache.karaf.main.Main.launch(Main.java:254)
at org.apache.karaf.main.Main.main(Main.java:178)
1 Like

The permissions are probably wrong so the openHAB users can’t read it write to them. You copied using sudo meaning the files are owned by root. Charger the ownership to openhab:openhab.

i tried , but no success. i am already reinstalling the sd-card. :frowning:

i did a fresh installation and copied the config-folder successfully.
then i tried to copy the userdata folder and i get the framework error again.
2019-11-22 21:50:19.208 [SEVERE] [org.apache.karaf.main.Main] - Could not launch framework

so i deleted the files and copied back the original ones, and OH is running again.

i didnt had a big OH Setup, but would be nice to get something back and save time.
which files/folders do i really need from the USERDATA folder ? so i can test one by one and get hopefully the most back.

thanks

Potentially you need everything except for cache and tmp.

How can I change the ownership to openhab:openhab?

On Linux?

openhab-cli has a “fix-permissions” option.

The Linux command to do it yourself is sudo chown openhab:openhab <path to file>. See the man page or search for all that chown can do if you don’t use openhab-cli

1 Like