I migrated my openHAB installation to new hardware:
Pi 5 Model B 8GB
Installed Openhabian 64 bit with Raspberry Pi Imager
Imported Openhab backup via openhabian-config
After the setup, everything was working as expected until the first reboot. After the reboot, the historic state for all items is gone. At first I suspected an issue with RRD4J, but I think it has to do with zram.
I created a test file in /var/log/test.log, after a reboot the file is gone. I stopped zram using sudo zram-config stop, created the file, rebooted and the file is still here.
I installed grafana and influx using sudo openhabian-config, created an openhab database, after a reboot the database file is gone.
I am on a clean, fresh installation. Thereās nothing running on the host except for components that come with the Pi Imager.
Any idea on how to solve the problem, except for permanently disabling zram which is a bad idea as I donāt want to kill my SD card too quickly, and no, I also donāt plan to switch to an SSD.
I donāt know that a standard backup includes the persistence data. Open the zip file and see if you have userdata/persistence/rrd4j and one file in that folder for each Item. If not your backup didnāt include persistence.
How did you reboot? Zram will write out itās contents to the SD card on a normal reboot. Itās only when power is pulled that you would lose data.
Not without a few more details on how exactly you are rebooting and knowing whether or not your backup included persistence or not. When using openhab-cli, persistence is only included when the --full option is supplied.
also openHABian 1.9.1 was just released it has some changes wrt zram I suggest to use that.
Imager should use it but to make sure you do: manually download it.
Thanks, checked that. Persistence is included and available right after the update. The data is gone after rebooting.
How did you reboot? Zram will write out itās contents to the SD card on a normal reboot. Itās only when power is pulled that you would lose data.
Clean reboot with sudo reboot.
Not without a few more details on how exactly you are rebooting and knowing whether or not your backup included persistence or not. When using openhab-cli, persistence is only included when the --full option is supplied.
Itās a full backup, persisted data is there and loaded correctly after importing the backup. The data disappears after a reboot, which indicates that the zram information is not written back to the file system. If I disable zram, apply the backup, then turn zram back on, the data is persisted during reboot, but comes with other problems when zram tries to restore data on boot.
Thx, verified and 1.9.1 is running. To make sure, uninstalled and re-installed zram. Installation works without problems. Thereās a log line that influx was successfully added to the zram config. So I tried setting up influx, rebooted and the influx configuration was gone again
RRD4J, the default. I am currently running a clone of my old Pi4 setup on the Pi5. Same software versions, same config, same persistence on both systems.
By the way, if I install MapDB, is there a way to sync MapDB with the RRD4J data so I can activate MapDB as the default moving forward without losing data?
Iām not sure if restoreOnStartup supposed to work at all with rrd4j.
Enable mapdb to do that instead.
You did not really explain what exactly is the problem. Is it that your item states do not restore ?
Is it that old states are restored ? Is it that the persistence files went missing ?
Can you still chart historic data after reboot, and if so, is there data missing ?
Sounds fishy, didnāt you say you did a fresh install ?
What do you mean by ācloneā then and what does that have to do with persistence ?
You can set an everyMinute strategy on the MapDB persistence startegy for a few minutes and then change it back to everyChange.
It works but only with number type data. It doesnāt save and therefore cannot restore stuff like Strings or DateTimes and the like but it can restoreOnStartup anything that it can save.
After every reboot, all historic data is empty. I ran the OH backup through openhabian-config which restored all items, all persistence files, everything accordingly. I could chart historic data until a reboot. After a reboot, all historic data is gone. The items start writing new data, and I see chart data from the reboot time to the next shutdown. Then again, all historic data is gone and the last item state is null until a new update comes in.
I did a fresh install on a Pi 5 and imported the backup from Pi 4. OH versions, persistence services, etc are identical. I am using the same persistence service on Pi4 with the same configurations. Rebooting on the Pi4 does not cause any issues, states are restored accordingly upon reboot. Files I put into /var/log are still there after a reboot, not on the Pi 5 though.
Fascinating, it sounds like the Pi 5 is having some weird interactions with zram on shutdown. Do me a favor and try uninstalling zram on your pi 5 and see if it works then.
After that, try reinstalling zram and see if the behavior returns. I donāt currently have a Pi 5 on hand to test on, so if you could help me debug this a little that would be great.
Also if you could provide me a copy of what the file /var/log/zram-config/zram-config.log has both before and after reboot, that would be great. You could also try manually stopping zram while the system is running and see if that works or if it doesnāt work even then.
Saved /var/log/zram-config/zram-config.log (I saved the file on 8/14/8:20 am after I imported the openhab backup, interestingly the last change in the log file was on 8/13/8:23pm, so yesterday) zram-config.log (23.2 KB)
OK, I think I figured it out, thanks for the logs.
I was a little silly when I made some recent updates to zram-config, and probably should have tested better that they worked correctly. There was a change to one of the options I used in merging the directories on an upstream dependecy and I forgot to change it in the zram-config code.
I just updated it and pushed it to zram-config, if you go and update zram-config with openhabian-config and test again, I think it should be fixed. Please let me know if it doesnāt work.
Just figured out that I also was running into this problem - but on a Raspi 4 .
Running a fresh Openhabian 1.9.1 (64 Bit ) install and restore of OH config (coming from from OH 4.2).
A simple daily OH config Backup script saved some days of persistance - from initial OH config restore till I made first āsudo rebootā.
Thanks to the quick fix - you are my heroes!
If one needs a simple instruction on how to fix this, here is what I (finally) did:
While ZRAM is still installed do a āupdate zramā in openhabian-config (Menue pt.below 38.)
Do a āuninstall zramā in openhabian-config Menue
Do a āuse zramā ,which is openhabian-config Menue pt. 38.
Initially I tried 1) update zram and 2) Use-zram , but that did not update /usr/local/sbin/zram-config , therefore the 3 steps.
Realized that above (stroke out) 3 Steps did not solve my problem. I have to investigate myself a bit moreā¦
I might need you to provide logs again, I just tested on my system and after updating zram, mine appears to work correctly. Can you give some more details?
As I just did some simple tests to chek if zram woks for me, I think the zram issue is not limited to Raspi 5
So here what I did on a Raspi 4 2GB:
Installed Openhabian v1.9.1 (used this file: openhabian-raspios32-latest-202408061716-crc411a778e.img.xz)
Very basic OH setup (Timezone, Location, installed the 3 suggested persistance bindings mapdb, memory and rrd4j)
Created a small txt file in /var/lib/openhab/persistence/rrd4j/
Issued a sudo rebootā¦ log in again ā¦ file is gone. (that was expected)
In openhabian-config : update zram ā¦ Uninstall zram ā¦sudo reboot
Created a small txt file in /var/lib/openhab/persistence/rrd4j/
Issued a sudo rebootā¦ log in again ā¦ file persists ( so all ok without zram !)
In openhabian-config : use zram
Created a small txt file in /var/lib/openhab/persistence/rrd4j/
Issued a sudo rebootā¦ log in again ā¦ file persists ( so thats with zram !?!)
Created a small txt file in /var/lib/openhab/persistence/rrd4j/
Issued a sudo rebootā¦ log in again ā¦ file is gone ( so thats with zram !)
Dont know why test file persisted one time after step 10 (which was created right after zram re-install), guess zram needs a reboot to start?. After zram update and reinstall AND a reboot the small testfile is always gone after a reboot.