Ubuntu Evolution fix database disk image is malformed

=Evolution 3.2.2 - eeep is broken!=

I fire up Evolution after yet another system freeze and find no folders are present except the 'Search Folders > Unmatched'

Run from terminal to see whats going on
$ evolution & [1] 3097 xxxxx@UbuntuSSDx64:~$ (evolution:3097): camel-CRITICAL **: camel_service_set_display_name: assertion `CAMEL_IS_SERVICE (service)' failed

(evolution:3097): GLib-GObject-CRITICAL **: g_object_set: assertion `G_IS_OBJECT (object)' failed

(evolution:3097): evolution-mail-CRITICAL **: Could not initialize local store/folder: database disk image is malformed

(evolution:3097): evolution-mail-CRITICAL **: e_mail_local_get_store: assertion `CAMEL_IS_STORE (local_store)' failed

Bit of debugging on
CAMEL_DEBUG=on

$ CAMEL_DEBUG=all evolution  & [2] 4677 xxxxx@UbuntuSSDx64:~/.local/share/evolution/mail/local$ Database succesfully opened

=
DB SQL operation [ATTACH DATABASE ':memory:' AS mem] started Camel SQL Exec: ATTACH DATABASE ':memory:' AS mem Error in SQL EXEC statement: ATTACH DATABASE ':memory:' AS mem [database disk image is malformed]. DB Operation ended. Time Taken : 0.000105 

A bit of strace
What database is broken though?

$ CAMEL_DEBUG=all strace evolution &> evo.log

 access("/home/xxxxx/.local/share/evolution/mail/local", F_OK) = 0 stat("/home/xxxxx/.local/share/evolution/mail/local", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 stat("/home/xxxxx/.local/share/evolution/mail/local/folders.db", {st_mode=S_IFREG|0644, st_size=4280320, ...}) = 0 open("/home/xxxxx/.local/share/evolution/mail/local/folders.db", O_RDWR|O_CREAT, 0644) = 24 fcntl(24, F_GETFD)                     = 0 fcntl(24, F_SETFD, FD_CLOEXEC)         = 0 fstat(24, {st_mode=S_IFREG|0644, st_size=4280320, ...}) = 0 lseek(24, 0, SEEK_SET)                 = 0 read(24, "SQLite format 3\0\4\0\1\1\0@ \0\0\20\375\0\0\20V"..., 100) = 100 brk(0x7f740b889000)                    = 0x7f740b889000 fstat(1, {st_mode=S_IFREG|0664, st_size=1070052, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7409e87000 write(1, "\nDatabase succesfully opened \n", 31 Database succesfully opened  ) = 31 write(1, "\n===========\nDB SQL operation [A"..., 74

=
DB SQL operation [ATTACH DATABASE ':memory:' AS mem] started ) = 74 write(1, "Camel SQL Exec:\nATTACH DATABASE "..., 50Camel SQL Exec: ATTACH DATABASE ':memory:' AS mem ) = 50 fcntl(24, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1}) = 0 fcntl(24, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741826, len=510}) = 0 fcntl(24, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1073741824, len=1}) = 0 access("/home/xxxxx/.local/share/evolution/mail/local/folders.db-journal", F_OK) = -1 ENOENT (No such file or directory) fstat(24, {st_mode=S_IFREG|0644, st_size=4280320, ...}) = 0 access("/home/xxxxx/.local/share/evolution/mail/local/folders.db-wal", F_OK) = -1 ENOENT (No such file or directory) fstat(24, {st_mode=S_IFREG|0644, st_size=4280320, ...}) = 0 lseek(24, 0, SEEK_SET)                 = 0 read(24, "SQLite format 3\0\4\0\1\1\0@  \0\0\20\375\0\0\20V"..., 1024) = 1024 fcntl(24, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 write(1, "Error in SQL EXEC statement: ATT"..., 99Error in SQL EXEC statement: ATTACH DATABASE ':memory:' AS mem [database disk image is malformed]. ) = 99 write(1, "DB Operation ended. Time Taken :"..., 54DB Operation ended. Time Taken : 0.000517 

Took a bit of a gamble here that folders.db is broken

~/.local/share/evolution/mail/local$ mv folders.db folders.db-

Yay, it works :) Click on the folder and out of it - (when clicking out you should see the number of mails in the folder quickly count up)