Error message rrd4j invalid file header

Hi there,

first of all i apologize for my english, this comes from google translate…

I have a problem, which I feel with some items, it is getting more and more, the following error message appears:

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

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

2022-02-11 19:47:57.226 [ERROR] [d4j.internal.RRD4jPersistenceService] - Could not create rrd4j database file '/var/lib/openhab/persistence/rrd4j/Szenen_EG_beenden.rrd': Invalid file header. File [/var/lib/openhab/persistence/rrd4j/Szenen_EG_beenden.rrd] is not a RRD4J RRD file

If I look in the file, there is an .rrd file for the corresponding item.

I created all items via VSC. Things integrated into UI, configuration everything via text files. About 30 of about 450 items are affected. Among them are many dummy items, but also dimmers and sensors. Here, for example, the item mentioned above with other dummy items:

Number:Energy                    Fritzdect200_Energy1         "Gesamtverbrauch"                         (gdect200)                      ["Energy", "Measurement"]         {channel="avmfritz:FRITZ_DECT_200:192_168_178_1:087610216050:energy"}
Number:Power                     Fritzdect200_Power1          "Leistung"                                (gdect200)                      ["Energy", "Measurement"]         {channel="avmfritz:FRITZ_DECT_200:192_168_178_1:087610216050:power"}
Switch                     Szene_EG_Nachtlicht                        "Szene Nachtlicht Wohnbereich"                                                  
Switch                     Szene_EG_Taglicht                          "Szene Taglicht Wohnbereich"                                                     
Switch                     Szenen_EG_beenden                          "Szenen ausschalten"  (gdummyitemsrule) ["Switch"]                                                           
Number                     nSzene_WB                                  "Szene [%d]"
Number                     nSzene_Kueche                              "Szene [%d]"
Number:Time           WLEDPresetDuration                     "Preset duration"   (gwledtv)    {channel="wled:wled:5002915fde49:presetDuration"}
Dimmer                     LEDIKEA_OG_RaphaelDH            "Helligkeit Raphael"  (gschreibtisch_raphael)     ["Control"]  {ga="light", alexa="BrightnessController.brightness,PowerController.powerState", channel="hue:0220:172096dd33:6:brightness"}
Number:Time            CurrentTime_CC                              "Laufzeit"   (gchromecast)      ["Point"]         {channel="chromecast:chromecast:9db1686e3d212b80335fc7dcdec3abeb:currentTime"}
Switch                           Handy_Tanja                  "[MAP(]"           (ganwesend,gElternanwesend)    ["Switch"]                        {channel="tr064:subdeviceLan:ec1744dd32:uuid_3A75802409_2Dbccb_2D40e7_2D8e6b_2D444E6D4905A0:macOnline_66_XXXX_XXXX_XXXA_3A64_3A70"}

I have already deleted the relevant files (previously stopped OH). Unfortunately no change after that. The files exist but are empty.

It runs OH3.2. stable on a rpi 3b.

Restart often.

Values ​​are displayed normally “kWh” “W”, On /OFF etc… However, no diagrams are displayed in the UI as with other items (e.g. temp.)

Does anyone know this problem and can help me to solve it?

Many greetings

It could be caused by corruption and it is safe to:

  1. stop openHAB
  2. Delete the file
  3. restart openHAB

The persistance file will get recreated.

If it is corruption, then you need to find the reason why as it is probably happening to other files that openHAB needs.

Do you have ZRAM setup? good power supply? UPS ? good quality uSD card?

Many thanks for your response.

Power supply should be sufficient, is a 2A power supply.

I don’t use ZRAM.

UPS now I don’t know what you mean?

I use Sandisk extreme 32gb as sd card. So far I haven’t had any problems with it. But the card was a bit older. I put the image on a new sd card. Unfortunately, there are still errors here. But what I noticed: It’s not because of the items. I have now frequently reinstalled the system or deleted some or all of the .rrd files. The error message then comes again and again with other items. So I imagine that the system might be overloaded with 500 items at once. Therefore I have now excluded a part (complete weather items.) (currently running). Hope it works now…

… unfortunately does not work. All items loaded correctly on startup. When I added the weather items again, the error messages came back. But this time only from the weather items.

Is there a maximum number of .rrd files.

Yes. The default settings (“everything”) are there to get you started, not because they are efficient. By the time you have progressed beyond beginner level to 500 Items you should be thinking about tailoring your persistence.

I do not think so. But with an SD card on a Pi there will be a maximum rate that you can save data. If it takes a minute to save “everything every minute” it will all go wrong.

An ‘A1’ rated SD card can do 500 IOPS. rrd4j default is to persist every minute, I don’t know exactly how many IOPS a persist operation takes but it’s more than one. With 500 items do the math yourself. They all are persisted in one go i.e. the same second of the minute.
Plus there’s system I/O, and many cards aren’t even A1.
Another big time reason to go with openHABian and ZRAM.

I’ve never figured out quite when rrd4j does its time based average-and-archive thing, which must take quite a few cycles per Item. Maybe every minute, depending on archive settings.
Presumably it does that on any archive files it finds, which implies if you stop persisting some Items you’d better delete their rrd files too if you want to lose the overhead.

Actually I didn’t want OH to save all states. But it does that automatically.

In my naive assumption that OH3 makes everything better and is better, I simply linked all the channels that existed for the individual items. Now I’ve limited myself to the essentials again, and the error message no longer comes up.

Now a question: As I understand it, all items are persisted. If no second service is specified in the item (e.g. influx), the data is automatically saved in rrd4j. Is that correct, or can the peristration also be switched off?

So far my OH2 system has performed well without ZRAM. To be honest, I don’t even know what ZRAM does exactly (memory is swapped out like swap).

But if it really makes sense, I’ll deal with it. I just hope I’m not opening a new site with this. If I’m being completely honest, I think OH3 is good, but I also feel that it’s not quite mature in some places.

I’m not quite sure what you are thinking. The various persistence services are independent of each other.

OH3 installs rrd4j by default, so that pretty charts can be seen.
By default, rrd4j stores everything it can (which is not quite every type)
If you want to change that, you can control what and when rrd4j stores, by creating and editing a xxx.persist file as described in persistence docs.
It’s a bit old-fashioned, no GUI controls here.

If you want to install another persistence service like influxdb, you can.
It makes no difference at all to what rrd4j is doing.
These other services will also have default settings for “everything they can”, and you would generally want to control these with their own xxx.persist files.

If you want to uninstall rrd4j, you can.

Charting shown in the GUI will use whichever service you point it to, that’s the default service, which does not influence what any service actually does

Because OH2 did not persist items per default like OH3 does.

You sort of already did as apparently you installed the RPi on your own (and you failed telling us relevant details such as which OS) rather than to go with the recommendation (openHABian that is). ZRAM is standard in openHABian but not recommended to setup on its own outside of that.

This means that if I create a .persist file for ffd4j, not all items are saved, but only those specified in the file? I would prefer that e.g. rrd4j saves all switches, dimmers, etc. And influx the temperature, humidity, solar data, etc. for nice charts with grafana.

Today I updated openhabian to OH 3.3 Milestone and the whole thing runs on an rpi 3b+. They say ZRAM was installed automatically… do I have to/should I then make any settings?

Please stop providing tiny incoherent bits of info and be clear in stating what you actually run as the Operating System of your RPi and what you changed about it.
OpenHAB is not openHABian so the openHAB version is irrelevant. openHABian has a version (you see it in the header when you start openhabian-config) and a branch. Tell us.

Who, “they” ? What exactly did “they” say ? Do you have a log ? Was it installed before ? Is it installed now ? What is the output of zramctl ?

:slight_smile: You say…

OH 3.3.0.M1 is currently running

OH 3.3.0.M1 is currently running

ZRAM may be installed, but I haven’t configured it and never messed with it. So far I haven’t needed it.

I don’t have a problem with ZRAM either. My problem was that, as written in the first post, I got error messages from individual .rrd files. Apparently I read in too many items at once. I have now reduced the items to the essential ones and now OH runs without an error message.

Sorry if some texts are a bit unclear. I’m writing via Google translator, so translation errors can occur.

I don’t think it’s due to translation. It is a number of fundamental misunderstandings.
Re-read your last post: You still didn’t say anything about the OS you use, about the openHABian version and you did not answer any of my questions.
wenn man schon bereit ist, wildfremden Leuten zu helfen, dann sollte man ihnen nicht auch noch alles dazu Nötige aus der Nase ziehen müssen

I can understand you well and I’m happy for any help. You will definitely have a better overview. For me, the problem was actually over when there were no more error messages…

I can’t find the openhabian version, sorry! I installed this image:


This morning I updated to OH 3.3.0.M1 from the OH version that came with the above image. Isn’t that the OS?

I haven’t made any changes to OH. I laboriously recreated my items in text files. Now I want all bindings to run properly and I’m moving my rules.


/dev/zram2 zstd          450M  18.4M  1.4M  2.1M       4
/dev/zram1 zstd          350M 198.7M 12.2M 14.3M       4

Log I don´t have.

Installiert habe ich nur standart Bindings wie deconz, harmony, Shelly etc… Gibt es einen Befehl wie ich alle Bindings als Liste auslesen kann?

I did change something. As with OH2, with OH3 I want to make regular backups via raspibackup. I have done this. The current image is a backup. What I noticed is that the log files for Frontail are missing. These had to be created manually. I’m writing this because this afternoon Frontail suddenly stopped showing logs. Only a restart showed logs again.

Now my general questions:

Is it still possible to make a backup with raspibackup?

Is an rpi 3b+ still sufficient for OH3

Log file locations changed from OH2 to OH3. People often get in a twist when they follow the upgrade path. There are a few threads about this.

So you are using zram, good. Although it does not show the mountpoint so possibly something is wrong there. I would reinstall to be on the safe side. Just backup your current config, download and flash latest openHABian and restore the config after reinstall.

One question one thread please, this isn’t a helpline.
For backup you should not have been using raspibackup.
Use the tools of openHABian menu 50 instead (Amanda).

does this output look better?

/dev/zram2 zstd          450M  19.5M 486.1K  944K       4 /opt/zram/zram2
/dev/zram1 zstd          350M 198.9M  10.6M 11.9M       4 /opt/zram/zram1
/dev/zram0 lzo-rle       450M   1.3M 275.4K  624K       4 [SWAP]

Thanks for the tip about the backups. I think I need to change. But it looks like there should be a viable way for me.

yes that’s fine.