Could not create rrd4j database file / File [...] is not a RRD4J RRD file

i’ve been running openHAB 3 for a while now with this setup (zram enabled):

##   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 5.10.103-v7l+
##  Platform = Raspberry Pi 4 Model B Rev 1.1
##    Uptime = 0 day(s). 0:18:17
## CPU Usage = 0.75% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.52, 5m: 0.37, 15m: 0.30
##    Memory = Free: 2.46GB (65%), Used: 1.32GB (35%), Total: 3.79GB
##      Swap = Free: 0.53GB (100%), Used: 0.00GB (0%), Total: 0.53GB
##      Root = Free: 2.63GB (39%), Used: 4.04GB (61%), Total: 7.00GB
##   Updates = 132 apt updates available.
##  Sessions = 1 session(s)
## Processes = 138 running processes of 32768 maximum processes
###############################################################################

                          _   _     _     ____   _
  ___   ___   ___   ___  | | | |   / \   | __ ) (_)  ____   ___
 / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ | | / _  \ / _ \
| (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )| || (_) || | | |
 \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ |_| \__|_||_| | |
      |_|                  openHAB 3.3.0 - Release Build

on monday i had to shutdown the raspberry (sudo shutdown -h now) and after reboot my item states weren’t restored to their previous state.
after another reboot (sudo reboot) the problem was the same. yesterday i noticed that some rules aren’t working like they are supposed to (and as they did before shutdown on monday) i checked the logs and there are many entries with the same error (different items):

[ERROR] [d4j.internal.RRD4jPersistenceService] - Could not create rrd4j database file '/var/lib/openhab/persistence/rrd4j/WS_UV.rrd': Invalid file header. File [/var/lib/openhab/persistence/rrd4j/WS_UV.rrd] is not a RRD4J RRD file

i searched the community for help and tried to delete the file (actually i deleted the rrd file for all items with this error):

sudo systemctl stop openhab.service
sudo rm /var/lib/openhab/persistence/rrd4j/WS_UV.rrd
sudo systemctl start openhab.service

but the error reappears again. also tried to reboot. same effect. and i still lose items states on start or reboot. from what i experienced this might have to do with zram, but i’m not sure how to verify this.

best regards
Peter

The contents of zram is only written to disk when the zramd service is shutdown normally. That’s something to keep in mind with your reboots and testing.

Before proceeding to much farther, definitely have a backup of everything important.

From openhabian-config you can disable zram. If the problem persists you’ll know it’s not zram that’s the problem.

so “shutdown -h now” was the wrong command?

i’m planning my openhab4 upgrade. so the next backup will be restored on a fresh system.

That is the right command. I’m just trying to explain when the contents are saved and restored so that you understand what you are looking at. It can help trace where the files you are looking at are coming from.

But if you brick your current system figuring out this problem :person_shrugging:

yeah, if there’s no simple (or obvious) way to fix this i’ll probably live with this problem until i have migrated to oh4…