"database disk image is malformed" after snapshot restore

I’ve tried a snapshot restore, to avoid finding out they were useless or not working when in needing.
After the restore, all seemed to work well except for the History; checking the logs showed the error in the subject.

Following the instruction I’ve found here, I managed to fix the issue but I was wondering if anyone else is aware of this behavior and if there was anything I could have done to avoid losing all the history.

I never had any luck restoring the built-in db. The MariaDB addon wasn’t any better. I’m not fussed if I lose a weeks data as long as my config is ok!

I agree, it’s not a big deal the empty history. :+1:

But the snapshot restore feature has not been so seamless since the result was a not fully working environment (history was stuck in infinite loading and logfile was full of exceptions).
I’ve got to investigate and solve the issues, so I’m asking if there’s something wrong with the restore or it’s been just a fault of mine.

SAME PROBLEM:

If you have database errors easiest fix is to delete the database and restart Home Assistant. I always get errors if I restore a snapshot.

Ok, so this seems to be a bug in snapshot restore, good to know.
Thank you!

I don’t think it’s a bug but more of an inevitable conflict somewhere. You’ve created a new instance, a new db has started, and it’s already collecting data, times, dates, states, etc. Then some old db is restored and suddenly there are errors. It’s been this way since this beginning and I always delete the restored db at this point. I don’t even wait for the errors to show up.

1 Like

Is there any point in including the dB in the full snapshot then?

I wouldn’t mind having the option to ignore it, myself. It would make for nice, light snapshots. But since the default db exists in the /config directory it is included along with everything else.

1 Like

I did not create any new instance: I simply created a snapshot and immediately restored it, just to check the feature.
Out of the box, the restore didn’t fully work and it took a while to find out what was wrong.

Just my point of view, but I’d consider this a bug in the snapshot restore feature.
Not a big one, just deleting a file will solve it, but nonetheless a broken behavior.

Maybe it is worth to open an issue about this, isn’t it?

/Minor vent: on

I just did a another snapshot restore w/MariaDB. It’s the 20+ restore I’ve done over the corse of a few years, for various reasons. But mostly just moving the install from one box to another. And the MariaDB never restores and I end up deleting the restore and start again. /sigh

I’ve grown accustom to losing the DB after the restore now. Mainly because I’m, not good with DB stuff and have no clue what wrong. So I restore and hope the restore is successful for once. =)

/minor vent: off

Hi David,

I have all my ZHA data in the database and spend a lot of time getting it configured. If I delete the database as you suggest, I need to start all over again. Any other suggestions ?
I’m running HA on a VBox image by the way
Jens

Please don’t ask in multiple topics.

So far as I know none of that config is stored in the database (the home assistant database)

Hi David,

That’s what i thought as well but i deleted the database now a few times and “magically” none of the ZHA components works anymore. And now magically it works… sometimes I just don’t get it !

Anyhow it did the trick !

Regards,
Jens

Yeah sometimes coincidence. Correlation <> Causation.