Help with corrupt databases

After an update I was made aware of the fact that I lost data from my energy-board. After searching google and this forum I wanted to apply the following steps:

  1. Stop HA via the SSH CLI using ha core stop
  2. Move the database-file to my windows computer using samba
  3. download sqlite CLI for windows from
  4. perform sqlite3 ./home-assistant_v2.db_old ".recover" | sqlite3 ./home-assistant_v2.db_fix
  5. move the new db-file back using samba
  6. rename the db-file (remove the _fix part)
  7. re-start HA via the SSH CLI using ha core start

But in my case there are some issues to deal with:

  1. If I want to copy paste the database to windows I get the follwing error:
    Why do I get this error? I can see them there! :confused:

  2. I have 4 corrupted databases (2 power outs and the other 2 I don’t know why they are corrupted), is there a way to combine/merge these if I have recovered them? :pleading_face:

As an alternative I have HA running on an ubuntu setup with virtualbox as a VM-machine where HA is running in. I’ve read this site where he talks about login to the HA-box or VM. Does he mean that I have to login as root using port 22222? I have managed to get port 22222 open and I can login to the host using putty, but when I want to install sqlite3 on the host HA comes back with erros complaining that apt or sudo isn’t installed.

Stupid me hasn’t checked if HA made backups on an regular basis so my last full backup dates from january 2022.

Could someone help me with this complicated issue (for me at least :smiley:)?

Thanks in advance!


Try renaming the file. I think “+” is disallowed in windows file names.

1 Like

When I want to rename the file it still gives the same error:

Using visual studio code the renaming worked!

1 Like

thanks, had the same problem. it works in File Editor inside HASS too.
VS Code is probably better.