Openhabian restore doesn't work

running on a raspberry Raspberry Pi 3 Model B Rev 1.2
just downloaded last openhabian version (1.7.1 from 02 Dec 21), let it do its magic and first thing I did:

openhabian-config => 51 “restore” backup"

with an error message coming up, that something messed up. so I checked the logs:

++ ls -alh /var/lib/openhab/backups/openhab-backup-22_01_08-15_11_18.zip
++ head -20
++ xargs -d '\n' -L1 basename
++ awk -F ' ' '{ print $9 " " $5 }'
++ awk -F ' ' '{ print $1 "\n" $1 " " $2 }'
+ [[ -z openhab-backup-22_01_08-15_11_18.zip openhab-backup-22_01_08-15_11_18.zip 4.6M ]]
++ whiptail --title 'Choose openHAB configuration to restore' --cancel-button Cancel --ok-button Continue --notags --menu '\nSelect your backup from most current 20 files below:' 22 80 13 openhab-backup-22_01_08-15_11_18.zip 'openhab-backup-22_01_08-15_11_18.zip 4.6M'
+ fileSelect=openhab-backup-22_01_08-15_11_18.zip
+ echo OK
OK
+ filePath=/var/lib/openhab/backups/openhab-backup-22_01_08-15_11_18.zip
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2022-01-08_19:13:13_CET [openHABian] Restoring openHAB backup... '
2022-01-08_19:13:13_CET [openHABian] Restoring openHAB backup... + [[ '' == \t\e\x\t\o\n\l\y ]]
+ cond_redirect systemctl stop openhab.service
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ systemctl stop openhab.service \033[39;49;00m'

$ systemctl stop openhab.service
+ systemctl stop openhab.service
+ return 0
+ yes
+ cond_redirect openhab-cli restore /var/lib/openhab/backups/openhab-backup-22_01_08-15_11_18.zip
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ openhab-cli restore /var/lib/openhab/backups/openhab-backup-22_01_08-15_11_18.zip \033[39;49;00m'

$ openhab-cli restore /var/lib/openhab/backups/openhab-backup-22_01_08-15_11_18.zip
+ openhab-cli restore /var/lib/openhab/backups/openhab-backup-22_01_08-15_11_18.zip

Started /usr/share/openhab/runtime/bin/restore /var/lib/openhab/backups/openhab-backup-22_01_08-15_11_18.zip

##########################################
          openHAB restore script
##########################################

Using '/etc/openhab' as conf folder...
Using '/var/lib/openhab' as userdata folder...
Making Temporary Directory
Extracting zip file to temporary folder.

 Backup Information:
 -------------------
 Backup Version         | 3.2.0 (You are on 3.2.0)
 Backup Timestamp       | 22_01_08-15_11_18
 Config belongs to user | openhab
             from group | openhab

Your current configuration will become owned by openhab:openhab.

Any existing files with the same name will be replaced.
Any file without a replacement will be deleted.

Okay to Continue? [y/N]: Moving system files in userdata to temporary folder
Deleting old userdata folder...
rm: cannot remove '/var/lib/openhab/persistence': Device or resource busy
Restoring system files in userdata...
Deleting old conf folder...
Restoring openHAB with backup configuration...
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoblueRossbuehel_TmrHumidityMin.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoblueRossbuehel_Day2Predictability.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/XiaomiTemperatureKuche_Pressure.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_Day2WindSpeedMax.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoblueRossbuehel_Day2HumidityMean.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/WeatherPL12_Wind_TmrGust.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_CurWindSpeedMax.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoblueRossbuehel_TmrFeltTempMean.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/RB_LifteZell_KrimmlXPress.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_Day2FeltTempMin.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoBlueRossbuhel_ForecastDay4_MeanSeaLevelPressure.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_TmrWindSpeedMin.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/WeatherPL12_Day2Cloudiness.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/WeatherRB_Day2WindSpeed.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/XiaomiTemperaturVorraum_Temperature.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/RB_MiWeather_Pressure_Kitchen.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_TmrUVIndex.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/Rossbuehel_Sonoff_PowerGestern.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/WeatherPL12_CurHumidity.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_TmrFeltTempMin.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_CurPrecipitation.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/WeatherRB_TdyGustSpeed.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_Day3WindSpeedMin.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/Astro_NightEvent.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoblueRossbuehel_TmrRain.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/RossbuhelSonnendaten_Night_Duration.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoblueRossbuehel_TmrPredictability.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_CurTempMean.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/WeatherRB_Day2GustSpeed.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/WeatherRB_Station_Location.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteoblueRossbuehel_TmrTempMax.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/MeteobluePL12_CurPressureMax.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/SpeedtestResultPing.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/Rossbuehel_Sonoff_PowerTotal.rrd': No space left on device
cp: error writing '/var/lib/openhab/persistence/rrd4j/ONVIFRossbuhelSud_StorageAlarm.rrd': No space left on device
Failed to copy /tmp/openhab/restore/userdata/ to /var/lib/openhab/...
Please check /tmp/openhab/restore and replace userdata.
+ return 1
+ echo 'FAILED (restore)'
FAILED (restore)
+ return 1
+ '[' 1 -ne 0 ']'
+ whiptail --msgbox 'There was an error or interruption during the execution of:\n  "50 | Backup/Restore"\n\nPlease try again. If the error persists, please read /opt/openhabian/docs/openhabian-DEBUG.md or https://github.com/openhab/openhabian/blob/main/docs/openhabian-DEBUG.md how to proceed.' 14 80

similar messages appear, if I use sudo openhab-cli restore with the same backup.

openhabian@openhabian:~ $ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       29534460 4688852  23605088  17% /
devtmpfs          464768       0    464768   0% /dev
tmpfs             498048       0    498048   0% /dev/shm
tmpfs             199220    1464    197756   1% /run
tmpfs               5120       4      5116   1% /run/lock
/dev/mmcblk0p1    258095   49292    208803  20% /boot
/dev/zram1        330424  323256         0 100% /opt/zram/zram1
overlay1          330424  323256         0 100% /var/lib/openhab/persistence
/dev/zram2        429288   17396    379636   5% /opt/zram/zram2
overlay2          429288   17396    379636   5% /var/log
tmpfs              99608       0     99608   0% /run/user/1000

Is there something I can do? wanted to update my remote pi with the current distribution while I’m at it.

Hi Thomas,

I had similar issues after a complete crash.
I think I solved your problem with removing the folder “userdata\persistence\rrd4j” files from my zip file. I recognized that my zip files were continuous increasing there size.

After removing the folder I was able to restore the zip file

BUT: I still have issues an playing around to solve other problems. I am not sure if I destroyed something with this step.

Regards Köchi

1 Like

openHAB is stopped while you are trying to restore backup?

1 Like

Here are some of my further issues:

When I backup my config it is stored with the root user. I think this is wrong

Then I tried to execute fix permission “14” but the command was not successfully executed.

Today I have installed everything new and I now the fix permission works again :wink:

Increase zram size limits in /etc/ztab and/or stop zram before restore.
You have accumulated too much persistence data.

1 Like

ah. ok. I deactivated ZRAM and then the update went through. Not yet activated, because I don’t know if I need it, because this Pi starts from a harddisk.

I just ran into this during a restore too - also with a sizable amount of persistence data, my backup file is 300+ MB - and stopping zram before restoring was the solution.

@mstormi, would it make sense to edit the openhabian and openhab-cli scripts to preemptively stop zram before attempting a restore operation, and then restart it afterwards? I’m happy to open a PR, if so.

openhab-cli is not specific to openhabian so cannot change that.
Of course you can always perform that manually.
But I don’t get your point in that. If there was enough zram space for the original data to fit in there should be enough to restore to.

I was wondering why it happened too, it’s been a while since I set up the prior system but I don’t recall changing the zram settings. Either way, it’s disconcerting when a backup/restore just errors out. Same thing happened when attempting to restore using openhab-cli too.

Either way, seems like temporarily shutting zram off, restoring, and re-enabling it would be a low-risk way to avoid the OP’s and my problem? Happy to open a PR to both repos. Looks like it would be around here in openhabian and here in openhab-cli.

I’d hope it would need to be done in openhabian only.
Happy to take a PR. Maybe it’s sufficient to change the service name in l80 from openhab to zram as service dependencies should stop openhab when you stop zram. But please thoroughly test that, and do so with current openhabian not with any oldish system as service setup has changed over time, too.
Remember this is applicable to systems to run zram only.
Users can disable zram or not install it in the first place, plus it only applies to Raspis but openhabian also runs on debian/x86.
So make sure to also check for zram service existence before.

2 Likes