Page 3 of 3
Re: FIX for The database disk image is malformed
Posted: Tuesday 21 April 2020 21:44
by waaren
jake wrote: ↑Tuesday 21 April 2020 21:13
Would it be worthwhile to mv the whole backup folder to another folder name? Maybe this gives domoticz the possibiliy to build the data set again.
It certainly looks like a access rights related issue so it's worth a try. I don't know when domoticz looks for the directory structure so to be sure it picks up the absence of the backup directory I would:
deactivate automatic backup and apply changes in settings page
stop domoticz
cd <domoticz dir>
mv backups/ backups_keep/
start domoticz
activate automatic backup and apply changes in settings page
Re: FIX for The database disk image is malformed
Posted: Tuesday 21 April 2020 21:48
by jake
waaren wrote: ↑Tuesday 21 April 2020 21:44
jake wrote: ↑Tuesday 21 April 2020 21:13
Would it be worthwhile to mv the whole backup folder to another folder name? Maybe this gives domoticz the possibiliy to build the data set again.
It certainly looks like a access rights related issue so it's worth a try. I don't know when domoticz looks for the directory structure so to be sure it picks up the absence of the backup directory I would:
deactivate automatic backup and apply changes in settings page
stop domoticz
cd <domoticz dir>
mv backups/ backups_keep/
start domoticz
activate automatic backup and apply changes in settings page
Yes, that sound like the safest plan to me too. I will try it, within 12 minutes I am supposed to know if it workd (21:48 at the moment of writing)
Re: FIX for The database disk image is malformed
Posted: Tuesday 21 April 2020 22:02
by jake
jake wrote: ↑Tuesday 21 April 2020 21:48
waaren wrote: ↑Tuesday 21 April 2020 21:44
jake wrote: ↑Tuesday 21 April 2020 21:13
Would it be worthwhile to mv the whole backup folder to another folder name? Maybe this gives domoticz the possibiliy to build the data set again.
It certainly looks like a access rights related issue so it's worth a try. I don't know when domoticz looks for the directory structure so to be sure it picks up the absence of the backup directory I would:
deactivate automatic backup and apply changes in settings page
stop domoticz
cd <domoticz dir>
mv backups/ backups_keep/
start domoticz
activate automatic backup and apply changes in settings page
Yes, that sound like the safest plan to me too. I will try it, within 12 minutes I am supposed to know if it workd (21:48 at the moment of writing)
There we go, actually in my previous post was the answer already. See the difference in access rights of the backup folder. I really messed it up by not using sudo (which I actually did on purpose, because the domoticz file itself also has pi:pi ownership. I forgot to check the access rights to the domoticz.db file
Code: Select all
drwxr-x--- 5 root root 4096 Apr 21 22:00 backups
drwxr-xr-x 5 pi pi 4096 Apr 21 21:08 backups_keep
Re: FIX for The database disk image is malformed
Posted: Tuesday 21 April 2020 22:14
by waaren
jake wrote: ↑Tuesday 21 April 2020 22:02
Code: Select all
drwxr-x--- 5 root root 4096 Apr 21 22:00 backups
So All good now?
Re: FIX for The database disk image is malformed
Posted: Tuesday 21 April 2020 22:27
by jake
waaren wrote: ↑Tuesday 21 April 2020 22:14
jake wrote: ↑Tuesday 21 April 2020 22:02
Code: Select all
drwxr-x--- 5 root root 4096 Apr 21 22:00 backups
So All good now?
Yes, thanks for the suggestions.
Btw, the backup folder was only generated at the time of backup, not immediately after applying the settings.
Re: FIX for The database disk image is malformed
Posted: Sunday 20 December 2020 14:32
by Wienen
jvdz wrote: ↑Saturday 05 January 2019 14:26
You could try this approach by dumping the current database and loading the dumpfile into a new database like this bash file:
Code: Select all
#! /bin/sh
sudo service domoticz stop
cd /home/pi/domoticz
rm -f dump.sql
echo Dump domoticz.db to dump.sql
sudo sqlite3 domoticz.db <<EOF
.mode insert
.output dump.sql
.dump
.exit
EOF
rm -f domoticz.fixed.db
echo create new domoticz.fixed.db loading dump.sql
sudo sqlite3 domoticz.fixed.db <<EOF
.read dump.sql
.exit
EOF
After this you only need to rename the old domoticz.db file to something else and the new domoticz.fixed.db to domoticz.db.
Worth try?
Jos
Thanks Jos, you are my hero!! This fixed my corrupted .db!!