Fixing Corrupt Mail Folders in Evolution

I normally find that Evolution is a very stable and very functional piece of software. But if it does end abnormally (by a sudden, and unexpected system restart, for example), the database managing the various mailbox files and folders can become corrupted. It’s taken me all morning to find a solution – one that turned out to be annoyingly simple in its effectiveness.

The Evolution error messages are a bit terse and corrupted data can be indicated by one or more of the following error messages:

  • Emptying Trash Fails with ‘Error while expunging folder’
  • Summary and folder mismatch, even after a sync
  • Error while Expunging folder
  • Evolution: error storing ‘~/.evolution/mail/local/Inbox (mbox)’

The solution that finally worked was this one:

  • Close Evolution client
  • Move file /home/dc/.evolution/mail/local/folders.db to trash
  • Restart Evolution again. It will rebuild the database and everything should synch successfully.

Poking around various bug trackers did suggest that there have also been problems with some of the metadata files. So if the above fix on its own doesn’t work, it might be worth trying the following:

  • Switch Evolution to Offline mode (File -> Work Offline)
  • Close Evolution client
  • Shut down Evolution: evolution --force-shutdown
  • Remove the metadata files:
    • find ~/.evolution/mail/local -name "*ev-summary" -exec rm -f {} \;
    • find .evolution -name \*index.data -exec rm -f {} \;
    • find .evolution -name \*index -exec rm -f {} \;
    • find .evolution -name \*cmeta -exec rm -f {} \;
  • Start Evolution client
  • Wait until the status bar at the bottom is empty. This could take several seconds.
  • Close Evolution client. This may take a while
  • Start Evolution client
  • Switch Evolution back to Online mode (File -> Work Online)

If all else fails, you can always delete everything and start again:

  • Backup your files! (File -> Backup Settings)
  • Start deleting:
    • rm -rf ~/.evolution
    • rm -rf ~/.gconf/apps/evolution
    • evolution –force-shutdown
  • Find the process ID for โ€˜gconfdโ€™: ps -ef|grep gconfd.
    This will return a line that looks like this:
    YourUserID 1485 1 0 13:56 ? 00:00:03 /usr/lib/libgconf2-4/gconfd-2
    The 1485, in this case is the process ID
  • Kill that process: kill 1485
  • Start Evolution client. You will be prompted to start creating your accounts.

Flattr this!

6 thoughts on “Fixing Corrupt Mail Folders in Evolution

  1. Carl

    Thanks for Posting this solution! Removing the folders.db file worked like a charm for me.

    You won’t believe how loong I’ve been looking for a solution to this problem.

    Again, THANKS!

    Carl

  2. Chris

    Running Evoloution 2.32.2 on Mint 11, the problem occurred for me, but I found the folders.db file in a different place

    ~/.local/share/evolution/mail/local

    Renamed it, and restarted Evolution. For the moment it seems more stable. Thanks for the guidance.

  3. Paul

    1. An alternative is to create a new ‘mailbox’ or ‘folder’. Lets call it Europa. (I love the name)

    2. Copy the emails from the confused index folder to Europa. Highlight and drag will work.

    3. Ensure every mail in the bad folder/mailbox has been copied – compare the contents total with the total of Europa,

    4. In the left column highlight the bad folder/mailbox. Then click FOLDER, EXPUNGE and the contents of the bad folder/mailbox will vanish.

    5. Highlight the contents of Europa and drag them into the now empty ‘bad’ folder/mailbox. A new and more accurate Index will now be created.

    6. In the left column highlight the Europa folder/mailbox. Then click FOLDER, EXPUNGE and the contents of the Europa will vanish. Either retain or delete Europa.

    It works for me on Centos 5 with Evolution 2.12.3 I like Evolution but the index corruption problem is very irritating.

    Paul
    An European English man.

  4. Bundyo

    Lately the folders.db file that needs to be removed/renamed is located in

    ~/.cache/evolution/mail/[your_mail_folder_id]

    Hope this helps. ๐Ÿ™‚

  5. JP

    Hi Paul, thank you very much for these very valuable recipes.
    Under my distribution below, the root directory was in ~/.local/share/evolution/mail/local
    jpp@junon:~$ grep “^NAME” /etc/*rel*
    NAME=”Debian GNU/Linux”
    Anyway, again, thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *