Page 1 of 1

database corrupted after reboot or domoticz.service restart

Posted: Sunday 27 December 2020 18:55
by scimmiettarossa
hi everyone!
I've been running domoticz on a Cubieboard1, for 3 years now;

in order to preserve the SD from excessive writes, I followed the advice in https://domoticz.com/wiki/Moving_Log_an ... _RAM_Drive, by modifying the start script to create a symbolic link from the domoticz.db-wal and domoticz.db-shm in the working directory to the target in /var/log (that is on RAM, managed by log2ram), each time the service is started

Until a certain point (I really I do not know the exact moment, because normally I do not reboot very often), everything was working perfectly; suddenòly, in case of reboot (or even simply a service restart), Domoticz does not see any hw, device, setting anymore: even the localization settings are lost (reverting not to the default, but to Albanian, that is the first item in the list).. checking the database with sqlite3 domoticz.db --> pragma integrity_check, it shows that the "database disk image is malformed"

All I can do is to restore a copy of the database, but this is not sufficient: general settings, notifications, appearance are all wrong; therefore in addition I need to go to Settings (where at this point the settings seem OK) and then click on "apply settings" to force the reaload; furthermore, the notiification settings for each individual device/sensor "seem" gone: I have to go to any device that has no notification, click on "notifications", then "Clear", and finally I've my working confguration back

In spite of all of this, the pragma integrity check on the db shows again "malformed" error plus a number of other error

I tried to update to the last release, I made a fresh installation, reloading the old database (very bad idea!!), then I did a fresh installation restoring any configuration manually and this solved the issue... everything works correctly, even in case of a restart, BUT when i repeated the trick of the simbolic link to the ram disk, the same corruption occurred

Any idea on why simply linking domoticz.db-wal and domoticz.db-shm to /var/log creates this disruption? ( I tried different permissions and owners for these two files, no luck)

Re: database corrupted after reboot or domoticz.service restart

Posted: Monday 28 December 2020 8:23
by waaren
scimmiettarossa wrote: Sunday 27 December 2020 18:55 Any idea on why simply linking domoticz.db-wal and domoticz.db-shm to /var/log creates this disruption? ( I tried different permissions and owners for these two files, no luck)
You might want to check this and this post.

Re: database corrupted after reboot or domoticz.service restart

Posted: Monday 28 December 2020 11:23
by scimmiettarossa
thanks, waaren, for the links: in my digging on the web I missed those!
I think I'll try to implement the solution "all the db on ramdisk, and backup to physical hw" (twice per day, or a bit more frequently) viewtopic.php?p=244398#p244398 ... In my implementation there is no particular risk in losing the last few hours of logs, modification, etc