OH3 persistence freeze

I have issue with persitence that causes OH freeze after some time.

[ERROR] [d4j.internal.RRD4jPersistenceService] - Could not create rrd4j database file '/var/lib/openhab/persistence/rrd4j/pcpSalonTV_CurrentPlayingTime.rrd': /var/lib/openhab/persistence/rrd4j/pcpSalonTV_CurrentPlayingTime.rrd (Permission denied)

I’ve checked permissions and I’ve got:

[10:48:51] root@openHABianDevice:/var/lib/openhab# ls -ld /var/lib/openhab/
drwxrwxr-x 9 openhab openhab 4096 Jan  3 19:51 /var/lib/openhab/
[10:54:02] root@openHABianDevice:/var/lib/openhab# ls -ld /var/lib/openhab/persistence/
drwxrwxr-x 1 openhabian openhabian 4096 Jan  3 19:55 /var/lib/openhab/persistence/

I’m not sure what is the root cause, but I presume that the owenrship should be ‘openhab’ instead ‘openhabian’ so I’ve changed it manually, however it went back by itself to ‘openhabian’ anyway.
Tried “fix permissions” from openhabian-config, but I’ve got error

2021-01-04_10:58:59_CET [openHABian] Applying file permissions recommendations... FAILED (openhab folders)

Manually it worked, but after running OH3 again, the problem went back:

[10:59:37] root@openHABianDevice:/var/lib/openhab# sudo chown -R openhab:openhab /var/lib/openhab
[11:00:57] root@openHABianDevice:/var/lib/openhab# ls -ld /var/lib/openhab/persistence/
drwxrwxr-x 1 openhab openhab 4096 Jan  3 19:55 /var/lib/openhab/persistence/

after restart:

[11:11:51] root@openHABianDevice:/home/openhabian# ls -ld /var/lib/openhab/persistence/
drwxrwxr-x 1 openhabian openhabian 4096 Jan  4 11:07 /var/lib/openhab/persistence/
[11:11:56] root@openHABianDevice:/home/openhabian# ls -ld /var/lib/openhab/
drwxrwxr-x 9 openhab openhab 4096 Jan  4 11:05 /var/lib/openhab/

How to fix it?

Do you use ZRAM ?
In case you do then shutdown the ZRAM service before applying the directory permissions.

1 Like

BINGO. I’ve uninstalled ZRAM and fixed permissions manually. After OH restart it worked without issue. For the record, “fix permissions” from openhabian still ends up with error.
Thanks @Wolfgang_S.
Now, I wonder if I should turn on ZRAM back again or leave it as it is.

It should work with ZRAM enabled.
My suggestion would be to turn ZRAM on again; check it out and in case it does not work report back.

I’ve turned ZRAM on and it worked fine in terms of the original issue I had with persistence folder permissions.
However for some reason, probably because of my ignorance about handling ZRAM, I was facing issues like crashes (restarts) of OH resulting in neverending loop while loading modules, items, rules etc.
So, I left ZRAM off for now.